org.jgraph.graph.DefaultGraphSelectionModel Class Reference

Inheritance diagram for org.jgraph.graph.DefaultGraphSelectionModel:

org.jgraph.graph.GraphSelectionModel org.jgraph.JGraph.EmptySelectionModel List of all members.

Public Member Functions

 DefaultGraphSelectionModel (JGraph graph)
void setSelectionMode (int mode)
int getSelectionMode ()
void setChildrenSelectable (boolean flag)
boolean isChildrenSelectable ()
void setSelectionCell (Object cell)
void setSelectionCells (Object[] cells)
void addSelectionCell (Object cell)
void addSelectionCells (Object[] cells)
void removeSelectionCell (Object cell)
void removeSelectionCells (Object[] cells)
Object[] getSelectables ()
Object getSelectionCell ()
Object[] getSelectionCells ()
int getSelectionCount ()
boolean isCellSelected (Object cell)
boolean isChildrenSelected (Object cell)
boolean isSelectionEmpty ()
void clearSelection ()
void addGraphSelectionListener (GraphSelectionListener x)
void removeGraphSelectionListener (GraphSelectionListener x)
EventListener[] getListeners (Class listenerType)
synchronized void addPropertyChangeListener (PropertyChangeListener listener)
synchronized void removePropertyChangeListener (PropertyChangeListener listener)
Object clone () throws CloneNotSupportedException

Static Public Attributes

static final String SELECTION_MODE_PROPERTY = "selectionMode"
static final int SELECTED = -1
static final Integer UNSELECTED = new Integer(0)

Protected Member Functions

boolean isChildrenSelectable (Object cell)
int getSelectedChildCount (Object cell)
void setSelectedChildCount (Object cell, int count)
boolean select (List list, Object cell)
boolean deselect (Object cell)
void fireValueChanged (GraphSelectionEvent e)
void notifyCellChange (Vector changedCells)

Protected Attributes

JGraph graph
SwingPropertyChangeSupport changeSupport
EventListenerList listenerList = new EventListenerList()
int selectionMode
boolean childrenSelectable = true
Map cellStates = new Hashtable()
List selection = new ArrayList()

Classes

class  CellPlaceHolder

Detailed Description

Default implementation of GraphSelectionModel. Listeners are notified

Version:
1.0 1/1/02
Author:
Gaudenz Alder


Constructor & Destructor Documentation

org.jgraph.graph.DefaultGraphSelectionModel.DefaultGraphSelectionModel JGraph  graph  ) 
 

Constructs a DefaultGraphSelectionModel for the specified graph.


Member Function Documentation

void org.jgraph.graph.DefaultGraphSelectionModel.addGraphSelectionListener GraphSelectionListener  x  ) 
 

Adds x to the list of listeners that are notified each time the set of selected TreePaths changes.

Parameters:
x the new listener to be added

Implements org.jgraph.graph.GraphSelectionModel.

synchronized void org.jgraph.graph.DefaultGraphSelectionModel.addPropertyChangeListener PropertyChangeListener  listener  ) 
 

Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired when the selection mode changes.

Parameters:
listener the PropertyChangeListener to be added

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.addSelectionCell Object  cell  ) 
 

Adds the specified cell to the current selection

Parameters:
cell the cell to add to the current selection

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.addSelectionCells Object[]  cells  ) 
 

Adds cells to the current selection.

Parameters:
cells the cells to be added to the current selection

Implements org.jgraph.graph.GraphSelectionModel.

Reimplemented in org.jgraph.JGraph.EmptySelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.clearSelection  ) 
 

Empties the current selection. If this represents a change in the current selection, the selection listeners are notified.

Implements org.jgraph.graph.GraphSelectionModel.

Object org.jgraph.graph.DefaultGraphSelectionModel.clone  )  throws CloneNotSupportedException
 

Returns a clone of this object with the same selection. This method does not duplicate selection listeners and property listeners.

Exceptions:
CloneNotSupportedException never thrown by instances of this class

boolean org.jgraph.graph.DefaultGraphSelectionModel.deselect Object  cell  )  [protected]
 

Deselects a single cell and updates all datastructures. No listeners are notified.

void org.jgraph.graph.DefaultGraphSelectionModel.fireValueChanged GraphSelectionEvent  e  )  [protected]
 

Notifies all listeners that are registered for tree selection events on this object.

See also:
addGraphSelectionListener

EventListenerList

EventListener [] org.jgraph.graph.DefaultGraphSelectionModel.getListeners Class  listenerType  ) 
 

Returns an array of all the listeners of the given type that were added to this model.

Returns:
all of the objects receiving listenerType notifications from this model
Since:
1.3

Object [] org.jgraph.graph.DefaultGraphSelectionModel.getSelectables  ) 
 

Returns the cells that are currently selectable. The array is ordered so that the top-most cell appears first.

Implements org.jgraph.graph.GraphSelectionModel.

int org.jgraph.graph.DefaultGraphSelectionModel.getSelectedChildCount Object  cell  )  [protected]
 

Returns the number of selected childs for cell.

Object org.jgraph.graph.DefaultGraphSelectionModel.getSelectionCell  ) 
 

Returns the first cell in the selection. This is useful if there if only one item currently selected.

Implements org.jgraph.graph.GraphSelectionModel.

Object [] org.jgraph.graph.DefaultGraphSelectionModel.getSelectionCells  ) 
 

Returns the cells in the selection. This will return null (or an empty array) if nothing is currently selected.

Implements org.jgraph.graph.GraphSelectionModel.

int org.jgraph.graph.DefaultGraphSelectionModel.getSelectionCount  ) 
 

Returns the number of paths that are selected.

Implements org.jgraph.graph.GraphSelectionModel.

int org.jgraph.graph.DefaultGraphSelectionModel.getSelectionMode  ) 
 

Returns the selection mode, one of SINGLE_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION or CONTIGUOUS_TREE_SELECTION.

Implements org.jgraph.graph.GraphSelectionModel.

boolean org.jgraph.graph.DefaultGraphSelectionModel.isCellSelected Object  cell  ) 
 

Returns true if the cell, cell, is in the current selection.

Implements org.jgraph.graph.GraphSelectionModel.

boolean org.jgraph.graph.DefaultGraphSelectionModel.isChildrenSelectable Object  cell  )  [protected]
 

Hook for subclassers for fine-grained control over stepping-into cells. This implementation returns childrenSelectable&& isCellSelected.

boolean org.jgraph.graph.DefaultGraphSelectionModel.isChildrenSelectable  ) 
 

Returns true if the selection model allows the selection of children.

Implements org.jgraph.graph.GraphSelectionModel.

boolean org.jgraph.graph.DefaultGraphSelectionModel.isChildrenSelected Object  cell  ) 
 

Returns true if the cell, cell, has selected children.

Implements org.jgraph.graph.GraphSelectionModel.

boolean org.jgraph.graph.DefaultGraphSelectionModel.isSelectionEmpty  ) 
 

Returns true if the selection is currently empty.

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.notifyCellChange Vector  changedCells  )  [protected]
 

Notifies listeners of a change in path. changePaths should contain instances of PathPlaceHolder.

void org.jgraph.graph.DefaultGraphSelectionModel.removeGraphSelectionListener GraphSelectionListener  x  ) 
 

Removes x from the list of listeners that are notified each time the set of selected TreePaths changes.

Parameters:
x the listener to remove

Implements org.jgraph.graph.GraphSelectionModel.

synchronized void org.jgraph.graph.DefaultGraphSelectionModel.removePropertyChangeListener PropertyChangeListener  listener  ) 
 

Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener the PropertyChangeListener to be removed

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.removeSelectionCell Object  cell  ) 
 

Removes the specified cell from the selection.

Parameters:
cell the cell to remove from the current selection

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.removeSelectionCells Object[]  cells  ) 
 

Removes the specified cells from the selection.

Parameters:
cells the cells to remove from the current selection

Implements org.jgraph.graph.GraphSelectionModel.

Reimplemented in org.jgraph.JGraph.EmptySelectionModel.

boolean org.jgraph.graph.DefaultGraphSelectionModel.select List  list,
Object  cell
[protected]
 

Selects a single cell and updates all datastructures. No listeners are notified. Override this method to control individual cell selection.

void org.jgraph.graph.DefaultGraphSelectionModel.setChildrenSelectable boolean  flag  ) 
 

Sets if the selection model allows the selection of children.

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.setSelectedChildCount Object  cell,
int  count
[protected]
 

Sets the number of selected childs for cell to count.

void org.jgraph.graph.DefaultGraphSelectionModel.setSelectionCell Object  cell  ) 
 

Selects the specified cell.

Parameters:
cell the cell to select

Implements org.jgraph.graph.GraphSelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.setSelectionCells Object[]  cells  ) 
 

Sets the selection to 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.

Parameters:
cells new selection

Implements org.jgraph.graph.GraphSelectionModel.

Reimplemented in org.jgraph.JGraph.EmptySelectionModel.

void org.jgraph.graph.DefaultGraphSelectionModel.setSelectionMode int  mode  ) 
 

Sets the selection mode, which must be one of SINGLE_TREE_SELECTION,

Implements org.jgraph.graph.GraphSelectionModel.


Member Data Documentation

Map org.jgraph.graph.DefaultGraphSelectionModel.cellStates = new Hashtable() [protected]
 

Maps the cells to their selection state.

SwingPropertyChangeSupport org.jgraph.graph.DefaultGraphSelectionModel.changeSupport [protected]
 

Used to message registered listeners.

boolean org.jgraph.graph.DefaultGraphSelectionModel.childrenSelectable = true [protected]
 

Boolean that indicates if the model allows stepping-into groups.

JGraph org.jgraph.graph.DefaultGraphSelectionModel.graph [protected]
 

Reference to the parent graph. Used to find parents and childs.

EventListenerList org.jgraph.graph.DefaultGraphSelectionModel.listenerList = new EventListenerList() [protected]
 

Event listener list.

final int org.jgraph.graph.DefaultGraphSelectionModel.SELECTED = -1 [static]
 

Value that represents selected state in cellStates.

List org.jgraph.graph.DefaultGraphSelectionModel.selection = new ArrayList() [protected]
 

List that contains the selected items.

final String org.jgraph.graph.DefaultGraphSelectionModel.SELECTION_MODE_PROPERTY = "selectionMode" [static]
 

Property name for selectionMode.

int org.jgraph.graph.DefaultGraphSelectionModel.selectionMode [protected]
 

Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.

final Integer org.jgraph.graph.DefaultGraphSelectionModel.UNSELECTED = new Integer(0) [static]
 

Object value that represents the unselected state in cellStates.


The documentation for this class was generated from the following file:
Generated on Sun May 28 19:13:14 2006 for Digimod by  doxygen 1.4.6-NO