Package org.jgraph.graph
Interface GraphSelectionModel
-
- All Known Implementing Classes:
DefaultGraphSelectionModel,JGraph.EmptySelectionModel
public interface GraphSelectionModelThis interface represents the current state of the selection for the graph component.A GraphSelectionModel can be configured to allow only one cell (
SINGLE_GRAPH_SELECTION) or a number of cells (MULTIPLE_GRAPH_SELECTION).
-
-
Field Summary
Fields Modifier and Type Field Description static intMULTIPLE_GRAPH_SELECTIONSelection can contain any number of items.static intSINGLE_GRAPH_SELECTIONSelection can only contain one cell at a time.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddGraphSelectionListener(GraphSelectionListener x)Adds x to the list of listeners that are notified each time the set of selected Objects changes.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list.voidaddSelectionCell(java.lang.Object cell)Adds cell to the current selection.voidaddSelectionCells(java.lang.Object[] cells)Adds cells to the current selection.voidclearSelection()Empties the current selection.java.lang.Object[]getSelectables()Returns the cells that are currently selectable.java.lang.ObjectgetSelectionCell()Returns the first cell in the selection.java.lang.Object[]getSelectionCells()Returns the cells in the selection.intgetSelectionCount()Returns the number of cells that are selected.intgetSelectionMode()Returns the current selection mode, eitherSINGLE_GRAPH_SELECTIONorMULTIPLE_GRAPH_SELECTION.booleanisCellSelected(java.lang.Object cell)Returns true if the cell,cell, is in the current selection.booleanisChildrenSelectable()Returns true if the selection model allows the selection of children.booleanisChildrenSelected(java.lang.Object cell)Returns true if the cell,cell, has selected children.booleanisSelectionEmpty()Returns true if the selection is currently empty.voidremoveGraphSelectionListener(GraphSelectionListener x)Removes x from the list of listeners that are notified each time the set of selected Objects changes.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list.voidremoveSelectionCell(java.lang.Object cell)Removes cell from the selection.voidremoveSelectionCells(java.lang.Object[] cells)Removes cells from the selection.voidsetChildrenSelectable(boolean flag)Sets if the selection model allows the selection of children.voidsetSelectionCell(java.lang.Object cell)Sets the selection to cell.voidsetSelectionCells(java.lang.Object[] cells)Sets the selection to cells.voidsetSelectionMode(int mode)Sets the selection model, which must be either SINGLE_GRAPH_SELECTION or MULTIPLE_GRAPH_SELECTION.
-
-
-
Field Detail
-
SINGLE_GRAPH_SELECTION
static final int SINGLE_GRAPH_SELECTION
Selection can only contain one cell at a time.- See Also:
- Constant Field Values
-
MULTIPLE_GRAPH_SELECTION
static final int MULTIPLE_GRAPH_SELECTION
Selection can contain any number of items.- See Also:
- Constant Field Values
-
-
Method Detail
-
setSelectionMode
void setSelectionMode(int mode)
Sets the selection model, which must be either SINGLE_GRAPH_SELECTION or MULTIPLE_GRAPH_SELECTION.This may change the selection if the current selection is not valid for the new mode.
-
setChildrenSelectable
void setChildrenSelectable(boolean flag)
Sets if the selection model allows the selection of children.
-
isChildrenSelectable
boolean isChildrenSelectable()
Returns true if the selection model allows the selection of children.
-
getSelectionMode
int getSelectionMode()
Returns the current selection mode, eitherSINGLE_GRAPH_SELECTIONorMULTIPLE_GRAPH_SELECTION.
-
setSelectionCell
void setSelectionCell(java.lang.Object cell)
Sets the selection to cell. If this represents a change, then the GraphSelectionListeners are notified. Ifcellis null, this has the same effect as invokingclearSelection.- Parameters:
cell- new cell to select
-
setSelectionCells
void setSelectionCells(java.lang.Object[] cells)
Sets the selection to cells. If this represents a change, then the GraphSelectionListeners are notified. Ifcellsis null, this has the same effect as invokingclearSelection.- Parameters:
cells- new selection
-
addSelectionCell
void addSelectionCell(java.lang.Object cell)
Adds cell to the current selection. If cell is not currently in the selection the GraphSelectionListeners are notified. This has no effect ifcellis null.- Parameters:
cell- the new cell to add to the current selection
-
addSelectionCells
void addSelectionCells(java.lang.Object[] cells)
Adds cells to the current selection. If any of the cells are not currently in the selection the GraphSelectionListeners are notified. This has no effect ifcellsis null.- Parameters:
cells- the new cells to add to the current selection
-
removeSelectionCell
void removeSelectionCell(java.lang.Object cell)
Removes cell from the selection. If cell is in the selection the GraphSelectionListeners are notified. This has no effect ifcellis null.- Parameters:
cell- the cell to remove from the selection
-
removeSelectionCells
void removeSelectionCells(java.lang.Object[] cells)
Removes cells from the selection. If any of the cells incellsare in the selection, the GraphSelectionListeners are notified. This method has no effect ifcellsis null.- Parameters:
cells- the cells to remove from the selection
-
getSelectables
java.lang.Object[] getSelectables()
Returns the cells that are currently selectable.
-
getSelectionCell
java.lang.Object getSelectionCell()
Returns the first cell in the selection. How first is defined is up to implementors.
-
getSelectionCells
java.lang.Object[] getSelectionCells()
Returns the cells in the selection. This will return null (or an empty array) if nothing is currently selected.
-
getSelectionCount
int getSelectionCount()
Returns the number of cells that are selected.
-
isCellSelected
boolean isCellSelected(java.lang.Object cell)
Returns true if the cell,cell, is in the current selection.
-
isChildrenSelected
boolean isChildrenSelected(java.lang.Object cell)
Returns true if the cell,cell, has selected children.
-
isSelectionEmpty
boolean isSelectionEmpty()
Returns true if the selection is currently empty.
-
clearSelection
void clearSelection()
Empties the current selection. If this represents a change in the current selection, the selection listeners are notified.
-
addPropertyChangeListener
void addPropertyChangeListener(java.beans.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
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.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
-
addGraphSelectionListener
void addGraphSelectionListener(GraphSelectionListener x)
Adds x to the list of listeners that are notified each time the set of selected Objects changes.- Parameters:
x- the new listener to be added
-
removeGraphSelectionListener
void removeGraphSelectionListener(GraphSelectionListener x)
Removes x from the list of listeners that are notified each time the set of selected Objects changes.- Parameters:
x- the listener to remove
-
-