final class NetworkSelectionModel
extends java.lang.Object
Constructor and Description |
---|
NetworkSelectionModel(NetworkPanel networkPanel)
Create a new network selection model for the specified source of
selection events.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.Object element)
Add the specified element to the selection.
|
void |
addAll(java.util.Collection elements)
Add all of the specified elements to the selection.
|
void |
addSelectionListener(NetworkSelectionListener l)
Add the specified network selection listener.
|
void |
clear()
Clear the selection.
|
void |
fireSelectionChanged()
A hack to broadcast a selection changed event.
|
void |
fireSelectionChanged(java.util.Set oldSelection,
java.util.Set selection)
Fire a wholesale selection model changed event to all registered
selection listeners.
|
java.util.Collection |
getSelection()
Return the selection as an unmodifiable collection of selected elements.
|
boolean |
isAdjusting()
Return true if this model will be adjusting over a series of rapid
changes.
|
boolean |
isEmpty()
Return true if the selection is empty.
|
boolean |
isSelected(java.lang.Object element)
Return true if the specified element is selected.
|
void |
remove(java.lang.Object element)
Remove the specified element from the selection.
|
void |
removeAll(java.util.Collection elements)
Remove all of the specified elements from the selection.
|
void |
removeSelectionListener(NetworkSelectionListener l)
Remove the specified network selection listener.
|
void |
setAdjusting(boolean adjusting)
Set to true if this model will be adjusting over a series of rapid
changes.
|
void |
setSelection(java.util.Collection elements)
Set the selection to the specified collection of elements.
|
int |
size()
Return the size of the selection.
|
public NetworkSelectionModel(NetworkPanel networkPanel)
networkPanel
- source of selection eventspublic int size()
public void clear()
public boolean isEmpty()
public void add(java.lang.Object element)
element
- element to addpublic void addAll(java.util.Collection elements)
elements
- elements to addpublic void remove(java.lang.Object element)
element
- element to removepublic void removeAll(java.util.Collection elements)
elements
- elements to removepublic boolean isSelected(java.lang.Object element)
element
- elementpublic java.util.Collection getSelection()
public void setSelection(java.util.Collection elements)
elements
- elementspublic void addSelectionListener(NetworkSelectionListener l)
l
- network selection listener to addpublic void removeSelectionListener(NetworkSelectionListener l)
l
- network selection listener to removepublic boolean isAdjusting()
public void setAdjusting(boolean adjusting)
adjusting
- true if this model will be adjusting over a series of
rapid changespublic void fireSelectionChanged(java.util.Set oldSelection, java.util.Set selection)
oldSelection
- old selectionselection
- selectionpublic void fireSelectionChanged()