|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.AbstractListModel
javax.swing.DefaultComboBoxModel
org.ceryle.util.SetModel
org.ceryle.graph.SelectionManager
public class SelectionManager
Extends the utility class SetModel to serve as a manager/container for the graph selection. This is normally a single node, but multiple selection requires a more complex solution than provided by TouchGraph. This class also provides methods to characterize the state of the contents of the selection, and because SetModel implements the ListDataListener API, it's possible to add listeners for changes to the selection.
The choice of backing storage being a SetModel is so that the contents of the selection can be included in GUI selection lists without being converted or transferred into another container. SetModel is backed by a Vector, which is synchronized.
| Field Summary | |
|---|---|
static int |
ANODES
An int indicating that the selection is composed solely of ANodes. |
static int |
EMPTY
An int indicating no selection. |
static int |
MIXED
An int indicating a mixed type selection. |
static int |
ONODES
An int indicating that the selection is composed solely of ONodes. |
static int |
RNODES
An int indicating that the selection is composed solely of RNodes. |
static int |
SNODES
An int indicating that the selection is composed solely of SNodes. |
static int |
TNODES
An int indicating that the selection is composed solely of TNodes. |
| Fields inherited from class org.ceryle.util.SetModel |
|---|
EMPTY_SET, modCount |
| Fields inherited from class javax.swing.AbstractListModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
SelectionManager(GraphPanel graphpanel)
Constructs an empty SelectionManager object. |
|
SelectionManager(GraphPanel graphpanel,
Object[] items)
Constructs a SelectionManager object initialized with an array of objects. |
|
SelectionManager(GraphPanel graphpanel,
Vector vector)
Constructs a SelectionManager object initialized with a Vector. |
|
| Method Summary | |
|---|---|
boolean |
addToSelection(GraphNode node)
Adds the GraphNode node to the selection, if it is not already part of the Set. |
void |
clearSelection()
Clears the selection. |
int |
count()
Return the number of selected GraphNodes. |
int |
getComposition()
Returns the composition of the selection. |
Iterator |
getMultiSelected()
Returns a Iterator over the Set containing all selected GraphNodes. |
GraphNode |
getSelected()
Return the selected GraphNode, null if there is no selection. |
boolean |
isSelected(GraphNode node)
Returns true if the GraphNode node is part of the current selection. |
void |
removeFromSelection(GraphNode node)
Removes the GraphNode node from the selection. |
void |
setSelected(GraphNode node)
Sets the selection to the GraphNode node, clearing any previous selection, unless this is already the selected node. |
void |
setSelected(Set nodes)
Sets the selection to the Set of GraphNode nodes, clearing any previous selection. |
| Methods inherited from class org.ceryle.util.SetModel |
|---|
add, add, addAll, addAll, addAll, addElement, addElements, changedElementAt, clear, contains, containsAll, get, getFirstElement, getLastElement, getSelectedItem, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, moveToBeginning, remove, remove, removeAll, retainAll, set, setSelectedItem, size, sort, subList, toArray, toArray |
| Methods inherited from class javax.swing.DefaultComboBoxModel |
|---|
getElementAt, getIndexOf, getSize, insertElementAt, removeAllElements, removeElement, removeElementAt |
| Methods inherited from class javax.swing.AbstractListModel |
|---|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
equals, hashCode |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Methods inherited from interface javax.swing.MutableComboBoxModel |
|---|
insertElementAt, removeElement, removeElementAt |
| Field Detail |
|---|
public static final int EMPTY
public static final int MIXED
public static final int TNODES
public static final int ANODES
public static final int SNODES
public static final int ONODES
public static final int RNODES
| Constructor Detail |
|---|
public SelectionManager(GraphPanel graphpanel)
graphpanel - the GraphPanel whose selection is being managed
public SelectionManager(GraphPanel graphpanel,
Object[] items)
graphpanel - the GraphPanel whose selection is being manageditems - an array of Object objects
public SelectionManager(GraphPanel graphpanel,
Vector vector)
graphpanel - the GraphPanel whose selection is being managedvector - the Vector object| Method Detail |
|---|
public void clearSelection()
public int getComposition()
EMPTY: the selection is empty.MIXED: the selection is mixed.TNODES: the selection is composed solely of TNodes.ANODES: the selection is composed solely of ANodes.SNODES: the selection is composed solely of SNodes.ONODES: the selection is composed solely of ONodes.RNODES: the selection is composed solely of RNodes.MIXED.
public void setSelected(GraphNode node)
public void setSelected(Set nodes)
public boolean addToSelection(GraphNode node)
public void removeFromSelection(GraphNode node)
public GraphNode getSelected()
public boolean isSelected(GraphNode node)
public int count()
public Iterator getMultiSelected()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||