|
JGraph |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jgraph.graph.DefaultGraphSelectionModel
Default implementation of GraphSelectionModel. Listeners are notified
| Nested Class Summary | |
protected class |
DefaultGraphSelectionModel.CellPlaceHolder
Holds a path and whether or not it is new. |
| Field Summary | |
protected Map |
cellStates
Maps the cells to their selection state. |
protected SwingPropertyChangeSupport |
changeSupport
Used to message registered listeners. |
protected boolean |
childrenSelectable
Boolean that indicates if the model allows stepping-into groups. |
protected JGraph |
graph
Reference to the parent graph. |
protected EventListenerList |
listenerList
Event listener list. |
static int |
SELECTED
Value that represents selected state in cellStates. |
protected Set |
selection
List that contains the selected items. |
static String |
SELECTION_MODE_PROPERTY
Property name for selectionMode. |
protected int |
selectionMode
Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. |
static Integer |
UNSELECTED
Object value that represents the unselected state in cellStates. |
| Fields inherited from interface org.jgraph.graph.GraphSelectionModel |
MULTIPLE_GRAPH_SELECTION, SINGLE_GRAPH_SELECTION |
| Constructor Summary | |
DefaultGraphSelectionModel(JGraph graph)
Constructs a DefaultGraphSelectionModel for the specified graph. |
|
| Method Summary | |
void |
addGraphSelectionListener(GraphSelectionListener x)
Adds x to the list of listeners that are notified each time the set of selected TreePaths changes. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addSelectionCell(Object cell)
Adds the specified cell to the current selection |
void |
addSelectionCells(Object[] cells)
Adds cells to the current selection. |
void |
clearSelection()
Empties the current selection. |
Object |
clone()
Returns a clone of this object with the same selection. |
protected boolean |
deselect(Object cell)
Deselects a single cell and updates all datastructures. |
protected void |
fireValueChanged(GraphSelectionEvent e)
Notifies all listeners that are registered for tree selection events on this object. |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the listeners of the given type that were added to this model. |
Object[] |
getSelectables()
Returns the cells that are currently selectable. |
protected int |
getSelectedChildCount(Object cell)
Returns the number of selected childs for cell. |
Object |
getSelectionCell()
Returns the first cell in the selection. |
Object[] |
getSelectionCells()
Returns the cells in the selection. |
int |
getSelectionCount()
Returns the number of paths that are selected. |
int |
getSelectionMode()
Returns the selection mode, one of SINGLE_TREE_SELECTION,
DISCONTIGUOUS_TREE_SELECTION or
CONTIGUOUS_TREE_SELECTION. |
boolean |
isCellSelected(Object cell)
Returns true if the cell, cell, is in the current
selection. |
boolean |
isChildrenSelectable()
Returns true if the selection model allows the selection of children. |
protected boolean |
isChildrenSelectable(Object cell)
Hook for subclassers for fine-grained control over stepping-into cells. |
boolean |
isChildrenSelected(Object cell)
Returns true if the cell, cell, has selected children. |
boolean |
isSelectionEmpty()
Returns true if the selection is currently empty. |
protected void |
notifyCellChange(Vector changedCells)
Notifies listeners of a change in path. |
void |
removeGraphSelectionListener(GraphSelectionListener x)
Removes x from the list of listeners that are notified each time the set of selected TreePaths changes. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removeSelectionCell(Object cell)
Removes the specified cell from the selection. |
void |
removeSelectionCells(Object[] cells)
Removes the specified cells from the selection. |
protected boolean |
select(Set set,
Object cell)
Selects a single cell and updates all datastructures. |
void |
setChildrenSelectable(boolean flag)
Sets if the selection model allows the selection of children. |
protected void |
setSelectedChildCount(Object cell,
int count)
Sets the number of selected childs for cell to
count. |
void |
setSelectionCell(Object cell)
Selects the specified cell. |
void |
setSelectionCells(Object[] cells)
Sets the selection to cells. |
void |
setSelectionMode(int mode)
Sets the selection mode, which must be one of SINGLE_TREE_SELECTION, |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String SELECTION_MODE_PROPERTY
public static final int SELECTED
public static final Integer UNSELECTED
protected JGraph graph
protected SwingPropertyChangeSupport changeSupport
protected EventListenerList listenerList
protected int selectionMode
protected boolean childrenSelectable
protected Map cellStates
protected Set selection
| Constructor Detail |
public DefaultGraphSelectionModel(JGraph graph)
| Method Detail |
public void setSelectionMode(int mode)
setSelectionMode in interface GraphSelectionModelpublic int getSelectionMode()
SINGLE_TREE_SELECTION,
DISCONTIGUOUS_TREE_SELECTION or
CONTIGUOUS_TREE_SELECTION.
getSelectionMode in interface GraphSelectionModelpublic void setChildrenSelectable(boolean flag)
setChildrenSelectable in interface GraphSelectionModelpublic boolean isChildrenSelectable()
isChildrenSelectable in interface GraphSelectionModelprotected boolean isChildrenSelectable(Object cell)
childrenSelectable&&
isCellSelected.
public void setSelectionCell(Object cell)
setSelectionCell in interface GraphSelectionModelcell - the cell to selectpublic void setSelectionCells(Object[] cells)
cells. If this represents a change
the GraphSelectionListeners are notified. Potentially paths will be held
by this object; in other words don't change any of the objects in the
array once passed in.
setSelectionCells in interface GraphSelectionModelcells - new selectionpublic void addSelectionCell(Object cell)
addSelectionCell in interface GraphSelectionModelcell - the cell to add to the current selectionpublic void addSelectionCells(Object[] cells)
addSelectionCells in interface GraphSelectionModelcells - the cells to be added to the current selectionpublic void removeSelectionCell(Object cell)
removeSelectionCell in interface GraphSelectionModelcell - the cell to remove from the current selectionpublic void removeSelectionCells(Object[] cells)
removeSelectionCells in interface GraphSelectionModelcells - the cells to remove from the current selectionpublic Object[] getSelectables()
getSelectables in interface GraphSelectionModelpublic Object getSelectionCell()
getSelectionCell in interface GraphSelectionModelpublic Object[] getSelectionCells()
getSelectionCells in interface GraphSelectionModelpublic int getSelectionCount()
getSelectionCount in interface GraphSelectionModelpublic boolean isCellSelected(Object cell)
cell, is in the current
selection.
isCellSelected in interface GraphSelectionModelpublic boolean isChildrenSelected(Object cell)
cell, has selected children.
isChildrenSelected in interface GraphSelectionModelpublic boolean isSelectionEmpty()
isSelectionEmpty in interface GraphSelectionModelpublic void clearSelection()
clearSelection in interface GraphSelectionModelprotected int getSelectedChildCount(Object cell)
cell.
protected void setSelectedChildCount(Object cell,
int count)
cell to
count.
protected boolean select(Set set,
Object cell)
protected boolean deselect(Object cell)
public void addGraphSelectionListener(GraphSelectionListener x)
addGraphSelectionListener in interface GraphSelectionModelx - the new listener to be addedpublic void removeGraphSelectionListener(GraphSelectionListener x)
removeGraphSelectionListener in interface GraphSelectionModelx - the listener to removeprotected void fireValueChanged(GraphSelectionEvent e)
addGraphSelectionListener(org.jgraph.event.GraphSelectionListener),
EventListenerListpublic EventListener[] getListeners(Class listenerType)
public void addPropertyChangeListener(PropertyChangeListener listener)
A PropertyChangeEvent will get fired when the selection mode changes.
addPropertyChangeListener in interface GraphSelectionModellistener - the PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface GraphSelectionModellistener - the PropertyChangeListener to be removedprotected void notifyCellChange(Vector changedCells)
changePaths should
contain instances of PathPlaceHolder.
public Object clone()
throws CloneNotSupportedException
CloneNotSupportedException - never thrown by instances of this class
|
JGraph |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||