Package diva.canvas.interactor
Interface SelectionModel
-
- All Known Implementing Classes:
BasicSelectionModel
public interface SelectionModel
A model for graph selections. Listeners can add themselves to the model and are notified by SelectionEvents when the model is modified.- Version:
- $Id$
- Author:
- Michael Shilman
-
-
Field Summary
Fields Modifier and Type Field Description static int
MULTIPLE_SELECTION
Allow multiple screen objects to be selected at once.static int
SINGLE_SELECTION
Allow only one screen object to be selected at a time.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addSelection(java.lang.Object sel)
Add an object to the selection.void
addSelectionListener(SelectionListener l)
Add a selection listener to this model.void
addSelections(java.lang.Object[] sel)
Add an array of objects to the selection.void
clearSelection()
Clear the selection.boolean
containsSelection(java.lang.Object sel)
Test if the selection contains the given objectjava.lang.Object
getFirstSelection()
Return the first selection in the list.java.lang.Object
getLastSelection()
Return the last selection in the list.java.util.Iterator
getSelection()
Return an iterator over the selected objects.java.lang.Object[]
getSelectionAsArray()
Return the contents of the selection as an array.int
getSelectionCount()
Return the number of selected objects.int
getSelectionMode()
Return the mode of the selection, either SINGLE_SELECTION or MULTIPLE_SELECTION.void
removeSelection(java.lang.Object sel)
Remove an object from the selection.void
removeSelectionListener(SelectionListener l)
Remove a listener from the list of listeners.void
setSelectionMode(int mode)
Set the selection mode, either SINGLE_SELECTION or MULTIPLE_SELECTION.
-
-
-
Field Detail
-
SINGLE_SELECTION
static final int SINGLE_SELECTION
Allow only one screen object to be selected at a time.- See Also:
- Constant Field Values
-
MULTIPLE_SELECTION
static final int MULTIPLE_SELECTION
Allow multiple screen objects to be selected at once.- See Also:
- Constant Field Values
-
-
Method Detail
-
addSelectionListener
void addSelectionListener(SelectionListener l)
Add a selection listener to this model.
-
addSelection
void addSelection(java.lang.Object sel)
Add an object to the selection. The model should highlight the selection.
-
addSelections
void addSelections(java.lang.Object[] sel)
Add an array of objects to the selection. the model should highlight the selected objects.
-
clearSelection
void clearSelection()
Clear the selection. The model should remove highlighting from the previously selected objects.
-
containsSelection
boolean containsSelection(java.lang.Object sel)
Test if the selection contains the given object
-
getFirstSelection
java.lang.Object getFirstSelection()
Return the first selection in the list.
-
getLastSelection
java.lang.Object getLastSelection()
Return the last selection in the list.
-
getSelection
java.util.Iterator getSelection()
Return an iterator over the selected objects.
-
getSelectionAsArray
java.lang.Object[] getSelectionAsArray()
Return the contents of the selection as an array. This method is typically used by clients that need to pass the selection contents to another object that does not know about selection models, and which needs to traverse the selection contents multiple times.
-
getSelectionCount
int getSelectionCount()
Return the number of selected objects.
-
getSelectionMode
int getSelectionMode()
Return the mode of the selection, either SINGLE_SELECTION or MULTIPLE_SELECTION.
-
removeSelectionListener
void removeSelectionListener(SelectionListener l)
Remove a listener from the list of listeners.
-
removeSelection
void removeSelection(java.lang.Object sel)
Remove an object from the selection. The model should also remove highlighting from the objects.
-
setSelectionMode
void setSelectionMode(int mode)
Set the selection mode, either SINGLE_SELECTION or MULTIPLE_SELECTION.
-
-