GraphSelectionModel (JGraph v5.12.4.2 API Specification)
Keywords: org.jgraph.graph.GraphSelectionModel interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.12.4.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jgraph.graph
Interface GraphSelectionModel

All Known Implementing Classes:
  DefaultGraphSelectionModel

public interface GraphSelectionModel

This 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
`static int` | `MULTIPLE_GRAPH_SELECTION` Selection can contain any number of items.
`static int` | `SINGLE_GRAPH_SELECTION` Selection can only contain one cell at a time.

Method Summary
`void` | `addGraphSelectionListener(GraphSelectionListener x)` Adds x to the list of listeners that are notified each time the set of selected Objects changes.
`void` | `addPropertyChangeListener(PropertyChangeListener listener)` Adds a PropertyChangeListener to the listener list.
`void` | `addSelectionCell(Object cell)` Adds cell to the current selection.
`void` | `addSelectionCells(Object[] cells)` Adds cells to the current selection.
`void` | `clearSelection()` Empties the current selection.
`Object[]` | `getSelectables()` Returns the cells that are currently selectable.
`Object` | `getSelectionCell()` Returns the first cell in the selection.
`Object[]` | `getSelectionCells()` Returns the cells in the selection.
`int` | `getSelectionCount()` Returns the number of cells that are selected.
`int` | `getSelectionMode()` Returns the current selection mode, either `SINGLE_GRAPH_SELECTION` or `MULTIPLE_GRAPH_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.
`boolean` | `isChildrenSelected(Object cell)` Returns true if the cell, `cell`, has selected children.
`boolean` | `isSelectionEmpty()` Returns true if the selection is currently empty.
`void` | `removeGraphSelectionListener(GraphSelectionListener x)` Removes x from the list of listeners that are notified each time the set of selected Objects changes.
`void` | `removePropertyChangeListener(PropertyChangeListener listener)` Removes a PropertyChangeListener from the listener list.
`void` | `removeSelectionCell(Object cell)` Removes cell from the selection.
`void` | `removeSelectionCells(Object[] cells)` Removes cells from the selection.
`void` | `setChildrenSelectable(boolean flag)` Sets if the selection model allows the selection of children.
`void` | `setSelectionCell(Object cell)` Sets the selection to cell.
`void` | `setSelectionCells(Object[] cells)` Sets the selection to cells.
`void` | `setSelectionMode(int mode)` Sets the selection model, which must be either SINGLE_GRAPH_SELECTION or MULTIPLE_GRAPH_SELECTION.

Field Detail

### SINGLE_GRAPH_SELECTION

    public static final int SINGLE_GRAPH_SELECTION

  Selection can only contain one cell at a time.

  See Also:
    Constant Field Values

### MULTIPLE_GRAPH_SELECTION

    public static final int MULTIPLE_GRAPH_SELECTION

  Selection can contain any number of items.

  See Also:
    Constant Field Values

Method Detail

### setSelectionMode

    public 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

    public void setChildrenSelectable(boolean flag)

  Sets if the selection model allows the selection of children.

### isChildrenSelectable

    public boolean isChildrenSelectable()

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

### getSelectionMode

    public int getSelectionMode()

  Returns the current selection mode, either `SINGLE_GRAPH_SELECTION` or `MULTIPLE_GRAPH_SELECTION`.

### setSelectionCell

    public void setSelectionCell(Object cell)

  Sets the selection to cell. If this represents a change, then the GraphSelectionListeners are notified. If `cell` is null, this has the same effect as invoking `clearSelection`.

  Parameters:
    `cell` - new cell to select

### setSelectionCells

    public void setSelectionCells(Object[] cells)

  Sets the selection to cells. If this represents a change, then the GraphSelectionListeners are notified. If `cells` is null, this has the same effect as invoking `clearSelection`.

  Parameters:
    `cells` - new selection

### addSelectionCell

    public void addSelectionCell(Object cell)

  Adds cell to the current selection. If cell is not currently in the selection the GraphSelectionListeners are notified. This has no effect if `cell` is null.

  Parameters:
    `cell` - the new cell to add to the current selection

### addSelectionCells

    public void addSelectionCells(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 if `cells` is null.

  Parameters:
    `cells` - the new cells to add to the current selection

### removeSelectionCell

    public void removeSelectionCell(Object cell)

  Removes cell from the selection. If cell is in the selection the GraphSelectionListeners are notified. This has no effect if `cell` is null.

  Parameters:
    `cell` - the cell to remove from the selection

### removeSelectionCells

    public void removeSelectionCells(Object[] cells)

  Removes cells from the selection. If any of the cells in `cells` are in the selection, the GraphSelectionListeners are notified. This method has no effect if `cells` is null.

  Parameters:
    `cells` - the cells to remove from the selection

### getSelectables

    public Object[] getSelectables()

  Returns the cells that are currently selectable.

### getSelectionCell

    public Object getSelectionCell()

  Returns the first cell in the selection. How first is defined is up to implementors.

### getSelectionCells

    public Object[] getSelectionCells()

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

### getSelectionCount

    public int getSelectionCount()

  Returns the number of cells that are selected.

### isCellSelected

    public boolean isCellSelected(Object cell)

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

### isChildrenSelected

    public boolean isChildrenSelected(Object cell)

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

### isSelectionEmpty

    public boolean isSelectionEmpty()

  Returns true if the selection is currently empty.

### clearSelection

    public void clearSelection()

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

### addPropertyChangeListener

    public void 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

### removePropertyChangeListener

    public void 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

### addGraphSelectionListener

    public 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

    public 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.12.4.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 2001-2008 Gaudenz Alder. All rights reserved.