Package jpicedt.graphic
Interface SelectionHandler
-
- All Known Implementing Classes:
AbstractSelectionHandler,DefaultSelectionHandler
public interface SelectionHandlera SelectionHandler allows to manage selection-related behaviours for a given instance ofDrawing. Concrete implementation may generally want to store references on selectedElement'shere. This may be easily carried out by relying on Java's collection framework, hence we have specified some useful methods here for this purpose.- Since:
- jpicedt 1.3.2
- Version:
- $Id: SelectionHandler.java,v 1.7.2.1 2007/09/02 11:56:17 reynal Exp $
- Author:
- Sylvain Reynal
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddToSelection(Element e)Add the given Element to the current selectionElement[]asArray()Return the selected elements wrapped in an array (may be a convenience call to asCollection)java.util.CollectionasCollection()Return the selected elements wrapped in a CollectionbooleancontainsClass(java.lang.Class clazz)Returns whether this selection-handler contains objects that are of the same type of inherit from the given clazz.java.util.ArrayListcreateFilteredCollection(java.lang.Class clazz)Returns a list containing elements in the selection that are of the same type or inherit the given clazz.voiddelete(Drawing d)Delete all selected Element's from the given Drawingjava.util.Iteratorelements()Return an iterator over the selected Element'sbooleanisSelected(Element e, boolean includeAncestors)Return whether the given Element is selected or notvoidreplaceSelection(Element e)Replace the current selection with the given element.voidselectAll(Drawing d)Select all Element's belonging to the given Drawing.intsize()Return the number of selected objectsvoidunSelect(Element e)Unselect the given Element, ie remove it from the current selection.voidunSelectAll()Unselect all selected Element's
-
-
-
Method Detail
-
size
int size()
Return the number of selected objects
-
elements
java.util.Iterator elements()
Return an iterator over the selected Element's
-
asCollection
java.util.Collection asCollection()
Return the selected elements wrapped in a Collection
-
asArray
Element[] asArray()
Return the selected elements wrapped in an array (may be a convenience call to asCollection)
-
isSelected
boolean isSelected(Element e, boolean includeAncestors)
Return whether the given Element is selected or not- Parameters:
includeAncestors- if true, return true if this Element or one of its ancestors (e.g. a BranchElement) is selected. This may be implemented using reentrance.
-
selectAll
void selectAll(Drawing d)
Select all Element's belonging to the given Drawing.
-
unSelectAll
void unSelectAll()
Unselect all selected Element's
-
addToSelection
void addToSelection(Element e)
Add the given Element to the current selection
-
replaceSelection
void replaceSelection(Element e)
Replace the current selection with the given element.
-
unSelect
void unSelect(Element e)
Unselect the given Element, ie remove it from the current selection.
-
delete
void delete(Drawing d)
Delete all selected Element's from the given Drawing
-
createFilteredCollection
java.util.ArrayList createFilteredCollection(java.lang.Class clazz)
Returns a list containing elements in the selection that are of the same type or inherit the given clazz.
-
containsClass
boolean containsClass(java.lang.Class clazz)
Returns whether this selection-handler contains objects that are of the same type of inherit from the given clazz.- Since:
- jpicedt 1.4pre5
-
-