To select or deselect a graphic object in a manager,
use the setSelected
method:
void setSelected(IlvGraphic obj, boolean select, boolean redraw)
Once an object has been selected, you can retrieve its
selection object using:
IlvSelection getSelection(IlvGraphic obj)
This method returns null
if
the object does not have an associated selection object; in other
words, if the graphic object is not selected. You can also use the
following method to determine whether the object is selected or not:
boolean isSelected(IlvGraphic obj)
To obtain the selected object from the selection object,
use the
getObject method of
IlvSelection
.
You can obtain an enumeration of all the selected objects
in the manager with:
IlvGraphicEnumeration getSelectedObjects()
You can use this method as follows.
IlvGraphicEnumeration selectedobjs = manager.getSelectedObjects();
IlvGraphic obj;
while(selectedobjs.hasMoreElements()) {
obj = selectedobjs.nextElement();
//perform some action
}
Note
To avoid unpredictable results, you must not select
or deselect graphic objects when stepping through the enumeration
as in the example above.
Other methods of IlvManager
allow
you to select and deselect all objects in the manager or in a particular
layer:
void selectAll(IlvManagerView view, boolean redraw)
void selectAll(boolean redraw)
void deSelectAll(boolean redraw)
void deSelectAll(int layer, boolean redraw)
Selection interactor
The library provides the
IlvSelectInteractor
class
which allows you to select and deselect objects in an interactive
way (using the mouse). It also allows you to edit graphic objects.
For more information, see
The selection interactor.