Package org.jgraph.event
Class GraphSelectionEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.jgraph.event.GraphSelectionEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class GraphSelectionEvent extends java.util.EventObject
An event that characterizes a change in the current selection. The change is based on any number of cells. GraphSelectionListeners will generally query the source of the event for the new selected status of each potentially changed cell.- See Also:
GraphSelectionListener
,GraphSelectionModel
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GraphSelectionEvent(java.lang.Object source, java.lang.Object[] cells, boolean[] areNew)
Represents a change in the selection of a GraphSelectionModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
cloneWithSource(java.lang.Object newSource)
Returns a copy of the receiver, but with the source being newSource.java.lang.Object
getCell()
Returns the first cell.java.lang.Object[]
getCells()
Returns the cells that have been added or removed from the selection.boolean
isAddedCell()
Returns true if the first cell has been added to the selection, a return value of false means the first cell has been removed from the selection.boolean
isAddedCell(int index)
Returns true if the cell identified byindex
was added to the selection.boolean
isAddedCell(java.lang.Object cell)
Returns true if the cell identified by cell was added to the selection.
-
-
-
Constructor Detail
-
GraphSelectionEvent
public GraphSelectionEvent(java.lang.Object source, java.lang.Object[] cells, boolean[] areNew)
Represents a change in the selection of a GraphSelectionModel.cells
identifies the cells that have been either added or removed from the selection.- Parameters:
source
- source of eventcells
- the paths that have changed in the selectionareNew
- for each cell, defines whether or not that cell is newly selected
-
-
Method Detail
-
getCells
public java.lang.Object[] getCells()
Returns the cells that have been added or removed from the selection.- Returns:
- added or removed cells
-
getCell
public java.lang.Object getCell()
Returns the first cell.- Returns:
- the first selected cell
-
isAddedCell
public boolean isAddedCell()
Returns true if the first cell has been added to the selection, a return value of false means the first cell has been removed from the selection.- Returns:
- whether or not the first cell has been added or removed
-
isAddedCell
public boolean isAddedCell(java.lang.Object cell)
Returns true if the cell identified by cell was added to the selection. A return value of false means the cell was in the selection but is no longer in the selection. This will raise if cell is not one of the cells identified by this event.- Parameters:
cell
- the cell that is to be indicated as newly selected or not- Returns:
true
if the specified cell is newly selected
-
isAddedCell
public boolean isAddedCell(int index)
Returns true if the cell identified byindex
was added to the selection. A return value of false means the cell was in the selection but is no longer in the selection. This will raise an exception if index < 0 || >=getPaths
.length.- Parameters:
index
- the index ofareNew
of the cell that is to be indicated as newly selected or not- Returns:
- whether or not the cell is newly selected or not
-
cloneWithSource
public java.lang.Object cloneWithSource(java.lang.Object newSource)
Returns a copy of the receiver, but with the source being newSource.- Parameters:
newSource
- the new event source- Returns:
- the cloned event with the specified source
-
-