skip to main content
Diagrammer > Programmer's documentation > Rogue Wave JViews Framework Advanced Features > Nested managers and nested graphers > Selection in nested managers
 
Selection in nested managers
The IlvManager class provides the methods that allow you to query the selection status of objects in a hierarchy of nested managers and also to listen for selection events in such a hierarchy of managers.
Selection method for a nested manager
An IlvManager object allows you to select objects that it contains. See Selection in a manager for more information about object selection. When a manager contains other managers, objects located in a nested manager can be selected using the same method of IlvManager: setSelected.
Selection methods for a hierarchy of nested managers
The following methods allow you to deal with the specific case of selections in a hierarchy of nested managers.
 
void selectAll(boolean traverse, boolean redraw)
This method selects all the objects in the manager and also all the objects in nested managers when the traverse parameter is true.
 
void deSelectAll(boolean traverse,boolean redraw)
This method deselects all the selected objects in the manager and also all the selected objects in nested managers when the traverse parameter is true.
 
IlvGraphicEnumeration getSelectedObjects(boolean traverse)
This method returns an enumeration that contains all the selected objects in this manager and in nested managers if the traverse parameter is set to true.
 
int getSelectedObjectsCount(boolean traverse)
This method returns the number of selected objects of this manager and in the nested managers if the traverse parameter is set to true.
 
void deleteSelections(boolean redraw, boolean traverse, boolean redraw)
This method removes the selected objects in the manager and also removes the selected objects in nested managers when the traverse parameter is set to true.
 
IlvSelection getSelection(IlvPoint p, IlvManagerView view, boolean traverse)
This method returns the selection object under the specified point. The method will search for selection objects in nested managers if the traverse parameter is set to true.
Selection Events
When a graphic object is selected or deselected, the manager fires a selection event. This is described in Listener for the selections in a manager.
You can register a selection listener in the manager using the method:
 
void addManagerSelectionListener(ManagerSelectionListener listener)
The listener will only receive selection events for selections and deselections that occur in the manager where the listener was registered.
To listen to selections that are taking place throughout a hierarchy of nested managers, the IlvManager class provides the following methods:
 
void addManagerTreeSelectionListener(ManagerSelectionListener listener)
 
void removeManagerTreeSelectionListener(ManagerSelectionListener listener)
When you register a selection listener using these methods, whenever an object is selected or deselected from a manager that is a submanager in the hierarchy of this manager, the listener will receive the event.
Such a listener placed on the top-level manager of a hierarchy will receive all the selection events of the hierarchy. To distinguish which submanager has sent an event, you can use the method getManager on the event; the event is an instance of the class ManagerSelectionChangedEvent and contains the method:
 
IlvManager getManager()

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.