com.mxgraph.view
Class mxGraphSelectionModel
- java.lang.Object
-
- com.mxgraph.util.mxEventSource
-
- com.mxgraph.view.mxGraphSelectionModel
-
public class mxGraphSelectionModel extends mxEventSource
Implements the selection model for a graph. This class fires the following events: mxEvent.UNDO fires after the selection was changed in changeSelection. Theeditproperty contains the mxUndoableEdit which contains the mxSelectionChange. mxEvent.CHANGE fires after the selection changes by executing an mxSelectionChange. Theaddedandremovedproperties contain Collections of cells that have been added to or removed from the selection, respectively. NOTE: Due to a historic bug that cannot be changed at this point the names of the properties are "reversed". To add a change listener to the graph selection model:addListener( mxEvent.CHANGE, new mxIEventListener() { public void invoke(Object sender, mxEventObject evt) { mxGraphSelectionModel model = (mxSelectionModel) sender; Collection added = (Collection) evt.getProperty("added"); Collection removed = (Collection) evt.getProperty("removed"); selectionChanged(model, added, removed); } });
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classmxGraphSelectionModel.mxSelectionChange-
Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
mxEventSource.mxIEventListener
-
-
Constructor Summary
Constructors Constructor and Description mxGraphSelectionModel(mxGraph graph)Constructs a new selection model for the specified graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddCell(java.lang.Object cell)Adds the given cell to the selection.voidaddCells(java.lang.Object[] cells)voidclear()Clears the selection.java.lang.ObjectgetCell()Returns the first selected cell.java.lang.Object[]getCells()Returns the selection cells.booleanisEmpty()Returns true if no cells are selected.booleanisSelected(java.lang.Object cell)Returns true if the given cell is selected.booleanisSingleSelection()voidremoveCell(java.lang.Object cell)Removes the given cell from the selection.voidremoveCells(java.lang.Object[] cells)voidsetCell(java.lang.Object cell)Clears the selection and adds the given cell to the selection.voidsetCells(java.lang.Object[] cells)Clears the selection and adds the given cells.voidsetSingleSelection(boolean singleSelection)intsize()Returns the number of selected cells.-
Methods inherited from class com.mxgraph.util.mxEventSource
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
-
-
-
-
Constructor Detail
-
mxGraphSelectionModel
public mxGraphSelectionModel(mxGraph graph)
Constructs a new selection model for the specified graph.- Parameters:
graph-
-
-
Method Detail
-
isSingleSelection
public boolean isSingleSelection()
- Returns:
- the singleSelection
-
setSingleSelection
public void setSingleSelection(boolean singleSelection)
- Parameters:
singleSelection- the singleSelection to set
-
isSelected
public boolean isSelected(java.lang.Object cell)
Returns true if the given cell is selected.- Parameters:
cell-- Returns:
- Returns true if the given cell is selected.
-
isEmpty
public boolean isEmpty()
Returns true if no cells are selected.
-
size
public int size()
Returns the number of selected cells.
-
clear
public void clear()
Clears the selection.
-
getCell
public java.lang.Object getCell()
Returns the first selected cell.
-
getCells
public java.lang.Object[] getCells()
Returns the selection cells.
-
setCell
public void setCell(java.lang.Object cell)
Clears the selection and adds the given cell to the selection.
-
setCells
public void setCells(java.lang.Object[] cells)
Clears the selection and adds the given cells.
-
addCell
public void addCell(java.lang.Object cell)
Adds the given cell to the selection.
-
addCells
public void addCells(java.lang.Object[] cells)
-
removeCell
public void removeCell(java.lang.Object cell)
Removes the given cell from the selection.
-
removeCells
public void removeCells(java.lang.Object[] cells)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG