public interface SelectionHandler
Drawing
.
Concrete implementation may generally want to store references
on selected Element's
here. This may be easily carried out
by relying on Java's collection framework, hence we have specified some useful methods here for
this purpose.Modifier and Type | Method and Description |
---|---|
void |
addToSelection(Element e)
Add the given Element to the current selection
|
Element[] |
asArray()
Return the selected elements wrapped in an array (may be a convenience call to asCollection)
|
java.util.Collection |
asCollection()
Return the selected elements wrapped in a Collection
|
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.
|
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.
|
void |
delete(Drawing d)
Delete all selected Element's from the given Drawing
|
java.util.Iterator |
elements()
Return an iterator over the selected Element's
|
boolean |
isSelected(Element e,
boolean includeAncestors)
Return whether the given Element is selected or not
|
void |
replaceSelection(Element e)
Replace the current selection with the given element.
|
void |
selectAll(Drawing d)
Select all Element's belonging to the given Drawing.
|
int |
size()
Return the number of selected objects
|
void |
unSelect(Element e)
Unselect the given Element, ie remove it from the current selection.
|
void |
unSelectAll()
Unselect all selected Element's
|
int size()
java.util.Iterator elements()
java.util.Collection asCollection()
Element[] asArray()
boolean isSelected(Element e, boolean includeAncestors)
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.void selectAll(Drawing d)
void unSelectAll()
void addToSelection(Element e)
void replaceSelection(Element e)
void unSelect(Element e)
void delete(Drawing d)
java.util.ArrayList createFilteredCollection(java.lang.Class clazz)
boolean containsClass(java.lang.Class clazz)
Submit a bug : syd@jpicedt.org