org.simbrain.network
Class NetworkSelectionModel

java.lang.Object
  extended by org.simbrain.network.NetworkSelectionModel

final class NetworkSelectionModel
extends Object

Network selection model.


Constructor Summary
NetworkSelectionModel(NetworkPanel networkPanel)
          Create a new network selection model for the specified source of selection events.
 
Method Summary
 void add(Object element)
          Add the specified element to the selection.
 void addAll(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(Set oldSelection, Set selection)
          Fire a wholesale selection model changed event to all registered selection listeners.
 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(Object element)
          Return true if the specified element is selected.
 void remove(Object element)
          Remove the specified element from the selection.
 void removeAll(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(Collection elements)
          Set the selection to the specified collection of elements.
 int size()
          Return the size of the selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkSelectionModel

public NetworkSelectionModel(NetworkPanel networkPanel)
Create a new network selection model for the specified source of selection events.

Parameters:
networkPanel - source of selection events
Method Detail

size

public int size()
Return the size of the selection.

Returns:
the size of the selection

clear

public void clear()
Clear the selection.


isEmpty

public boolean isEmpty()
Return true if the selection is empty.

Returns:
true if the selection is empty

add

public void add(Object element)
Add the specified element to the selection.

Parameters:
element - element to add

addAll

public void addAll(Collection elements)
Add all of the specified elements to the selection.

Parameters:
elements - elements to add

remove

public void remove(Object element)
Remove the specified element from the selection.

Parameters:
element - element to remove

removeAll

public void removeAll(Collection elements)
Remove all of the specified elements from the selection.

Parameters:
elements - elements to remove

isSelected

public boolean isSelected(Object element)
Return true if the specified element is selected.

Parameters:
element - element
Returns:
true if the specified element is selected

getSelection

public Collection getSelection()
Return the selection as an unmodifiable collection of selected elements.

Returns:
the selection as an unmodifiable collection of selected elements

setSelection

public void setSelection(Collection elements)
Set the selection to the specified collection of elements.

Parameters:
elements - elements

addSelectionListener

public void addSelectionListener(NetworkSelectionListener l)
Add the specified network selection listener.

Parameters:
l - network selection listener to add

removeSelectionListener

public void removeSelectionListener(NetworkSelectionListener l)
Remove the specified network selection listener.

Parameters:
l - network selection listener to remove

isAdjusting

public boolean isAdjusting()
Return true if this model will be adjusting over a series of rapid changes.

Returns:
true if ths model will be adjusting over a series of rapid changes

setAdjusting

public void setAdjusting(boolean adjusting)
Set to true if this model will be adjusting over a series of rapid changes.

Parameters:
adjusting - true if this model will be adjusting over a series of rapid changes

fireSelectionChanged

public void fireSelectionChanged(Set oldSelection,
                                 Set selection)
Fire a wholesale selection model changed event to all registered selection listeners.

Parameters:
oldSelection - old selection
selection - selection