Implements the selection model for a graph. Here is a listener that handles all removed selection cells.
graph.getSelectionModel().addListener(mxEvent.CHANGE, function(sender, evt) { var cells = evt.getProperty('added'); for (var i = 0; i < cells.length; i++) { // Handle cells[i]... } });
mxGraphSelectionModel | Implements the selection model for a graph. |
Events | |
mxEvent.UNDO | Fires after the selection was changed in changeSelection. |
mxEvent. | Fires after the selection changes by executing an mxSelectionChange. |
Functions | |
mxGraphSelectionModel | Constructs a new graph selection model for the given mxGraph. |
Variables | |
doneResource | Specifies the resource key for the status message after a long operation. |
updatingSelectionResource | Specifies the resource key for the status message while the selection is being updated. |
graph | Reference to the enclosing mxGraph. |
singleSelection | Specifies if only one selected item at a time is allowed. |
Functions | |
isSingleSelection | Returns singleSelection as a boolean. |
setSingleSelection | Sets the singleSelection flag. |
isSelected | Returns true if the given mxCell is selected. |
isEmpty | Returns true if no cells are currently selected. |
clear | Clears the selection and fires a <change> event if the selection was not empty. |
setCell | Selects the specified mxCell using setCells. |
setCells | Selects the given array of mxCells and fires a <change> event. |
getFirstSelectableCell | Returns the first selectable cell in the given array of cells. |
addCell | Adds the given mxCell to the selection and fires a <select> event. |
addCells | Adds the given array of mxCells to the selection and fires a <select> event. |
removeCell | Removes the specified mxCell from the selection and fires a <select> event for the remaining cells. |
removeCells | |
changeSelection | Adds/removes the specified arrays of mxCell to/from the selection. |
cellAdded | Inner callback to add the specified mxCell to the selection. |
cellRemoved | Inner callback to remove the specified mxCell from the selection. |
mxSelectionChange | Action to change the current root in a view. |
Functions | |
mxCurrentRootChange | Constructs a change of the current root in the given view. |
execute | Changes the current root of the view. |
Fires after the selection was changed in changeSelection. The <code>edit</code> property contains the mxUndoableEdit which contains the mxSelectionChange.
Fires after the selection changes by executing an mxSelectionChange. The <code>added</code> and <code>removed</code> properties contain arrays of cells that have been added to or removed from the selection, respectively. The names are inverted due to historic reasons. This cannot be changed.
mxGraphSelectionModel.prototype.graph
Reference to the enclosing mxGraph.
mxGraphSelectionModel.prototype.isSingleSelection = function()
Returns singleSelection as a boolean.
mxGraphSelectionModel.prototype.setSingleSelection = function( singleSelection )
Sets the singleSelection flag.
singleSelection | Boolean that specifies the new value for singleSelection. |
mxGraphSelectionModel.prototype.isSelected = function( cell )
Returns true if the given mxCell is selected.
Action to change the current root in a view.
Functions | |
mxCurrentRootChange | Constructs a change of the current root in the given view. |
execute | Changes the current root of the view. |
Adds/removes the specified arrays of mxCell to/from the selection.
mxGraphSelectionModel.prototype.changeSelection = function( added, removed )
Constructs a new graph selection model for the given mxGraph.
function mxGraphSelectionModel( graph )
Specifies the resource key for the status message after a long operation.
mxGraphSelectionModel.prototype.doneResource
Specifies the resource key for the status message while the selection is being updated.
mxGraphSelectionModel.prototype.updatingSelectionResource
Reference to the enclosing mxGraph.
mxGraphSelectionModel.prototype.graph
Specifies if only one selected item at a time is allowed.
mxGraphSelectionModel.prototype.singleSelection
Returns singleSelection as a boolean.
mxGraphSelectionModel.prototype.isSingleSelection = function()
Sets the singleSelection flag.
mxGraphSelectionModel.prototype.setSingleSelection = function( singleSelection )
Returns true if the given mxCell is selected.
mxGraphSelectionModel.prototype.isSelected = function( cell )
Returns true if no cells are currently selected.
mxGraphSelectionModel.prototype.isEmpty = function()
Clears the selection and fires a change event if the selection was not empty.
mxGraphSelectionModel.prototype.clear = function()
Selects the specified mxCell using setCells.
mxGraphSelectionModel.prototype.setCell = function( cell )
Selects the given array of mxCells and fires a change event.
mxGraphSelectionModel.prototype.setCells = function( cells )
Returns the first selectable cell in the given array of cells.
mxGraphSelectionModel.prototype.getFirstSelectableCell = function( cells )
Adds the given mxCell to the selection and fires a select event.
mxGraphSelectionModel.prototype.addCell = function( cell )
Adds the given array of mxCells to the selection and fires a select event.
mxGraphSelectionModel.prototype.addCells = function( cells )
Removes the specified mxCell from the selection and fires a select event for the remaining cells.
mxGraphSelectionModel.prototype.removeCell = function( cell )
mxGraphSelectionModel.prototype.removeCells = function( cells )
Inner callback to add the specified mxCell to the selection.
mxGraphSelectionModel.prototype.cellAdded = function( cell )
Inner callback to remove the specified mxCell from the selection.
mxGraphSelectionModel.prototype.cellRemoved = function( cell )
Changes the current root of the view.
mxSelectionChange.prototype.execute = function()