Package jpicedt.graphic
Class AbstractSelectionHandler
- java.lang.Object
-
- jpicedt.graphic.AbstractSelectionHandler
-
- All Implemented Interfaces:
SelectionHandler
public abstract class AbstractSelectionHandler extends java.lang.Object implements SelectionHandler
Provides some basic implementation of the SelectionHandler interface. This implementation merely targets methods that can access or modify the content of the SelectionHandler via theasCollection()method, hence the latter method is left unimplemented here.
Besides, no storage mechanism is implemented in this abstract class. Concrete implementation of this mechanism should be based on mutable Java Collection's, otherwise selection operation will fail.
Finally, the content of the selection-handler is supposed to reflect the z-ordering of theDrawingit is associated with. This abstract implementation does not take care of this.- Since:
- jpicedt 1.3.2
- Version:
- $Id: AbstractSelectionHandler.java,v 1.5.2.1 2007/09/02 11:56:15 reynal Exp $
- Author:
- Sylvain Reynal
-
-
Constructor Summary
Constructors Constructor Description AbstractSelectionHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddToSelection(Element e)Add the given Element to the current selection.Element[]asArray()Return the selected elements wrapped in an array.abstract java.util.CollectionasCollection()Return the selected elements wrapped in a Collectionvoiddelete(Drawing d)Delete all selected Element's from the given Drawing, and remove the reference to them from this SelectionHandler.java.util.Iteratorelements()Return an iterator over the selected Element's.booleanisSelected(Element e, boolean includeAncestors)Return whether the given Element is selected or not.voidreplaceSelection(Element e)Replace the current selection with the given element.voidselectAll(Drawing d)Select all Element's in the given drawing.intsize()Return the number of selected objects.voidunSelect(Element e)Unselect the given Element, i.e.voidunSelectAll()Unselect all Element's in the given drawing.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jpicedt.graphic.SelectionHandler
containsClass, createFilteredCollection
-
-
-
-
Method Detail
-
size
public int size()
Return the number of selected objects. Convenience call toasCollection().- Specified by:
sizein interfaceSelectionHandler
-
elements
public java.util.Iterator elements()
Return an iterator over the selected Element's. Convenience call toasCollection().- Specified by:
elementsin interfaceSelectionHandler
-
asCollection
public abstract java.util.Collection asCollection()
Return the selected elements wrapped in a Collection- Specified by:
asCollectionin interfaceSelectionHandler
-
asArray
public Element[] asArray()
Return the selected elements wrapped in an array. Convenience call toasCollection().- Specified by:
asArrayin interfaceSelectionHandler
-
isSelected
public boolean isSelected(Element e, boolean includeAncestors)
Return whether the given Element is selected or not. Convenience call toasCollection().- Specified by:
isSelectedin interfaceSelectionHandler- Parameters:
includeAncestors- if true, return true if this Element or one of its ancestors is selected.
-
selectAll
public void selectAll(Drawing d)
Select all Element's in the given drawing.- Specified by:
selectAllin interfaceSelectionHandler
-
unSelectAll
public void unSelectAll()
Unselect all Element's in the given drawing. Convenience call toasCollection().- Specified by:
unSelectAllin interfaceSelectionHandler
-
addToSelection
public void addToSelection(Element e)
Add the given Element to the current selection. Convenience call toasCollection().- Specified by:
addToSelectionin interfaceSelectionHandler
-
replaceSelection
public void replaceSelection(Element e)
Replace the current selection with the given element.- Specified by:
replaceSelectionin interfaceSelectionHandler
-
unSelect
public void unSelect(Element e)
Unselect the given Element, i.e. remove it from the current selection. Convenience call toasCollection().- Specified by:
unSelectin interfaceSelectionHandler
-
delete
public void delete(Drawing d)
Delete all selected Element's from the given Drawing, and remove the reference to them from this SelectionHandler.- Specified by:
deletein interfaceSelectionHandler
-
-