public final class GraphModelEvent extends EventObject
A GraphModelEvent
event is delivered to
the GraphModelListener
listeners, that is, listeners of
modifications to the contents of a graph model
(IlvGraphModel
). The event corresponds to several
operations such as the addition and removal of a node or a link, or
the modification of the geometry of the nodes or links.
In some situations it is not efficient to perform an action after each
modification in the graph model. That is why this event has a method
(isAdjusting
) that indicates that a series of
modification occurred (for example, all the links are removed). The
end of a series is notified by a new event of type ADJUSTMENT_END
).
GraphModelListener
,
IlvGraphModel
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ADJUSTMENT_END
The type of the event when a series of modifications is finished.
|
static int |
GEOMETRY_CHANGED
The bit mask of the type of the event when the geometry (position or
size) of one or several nodes or links has changed.
|
static int |
LINK_ADDED
The bit mask of the type of the event when a link has been added.
|
static int |
LINK_GEOMETRY_CHANGED
The bit mask of the type of the event when a link has been reshaped.
|
static int |
LINK_REMOVED
The bit mask of the type of the event when a link has been removed.
|
static int |
NODE_ADDED
The bit mask of the type of the event when a node has been added.
|
static int |
NODE_GEOMETRY_CHANGED
The bit mask of the type of the event when a node has been moved or
resized.
|
static int |
NODE_REMOVED
The bit mask of the type of the event when a node has been removed.
|
static int |
STRUCTURE_CHANGED
The bit mask of the type of the event when one or several nodes or
links have been added or removed.
|
source
Constructor and Description |
---|
GraphModelEvent(IlvGraphModel graphModel)
Creates the event.
|
Modifier and Type | Method and Description |
---|---|
IlvGraphModel |
getGraphModel()
Returns the graph model source of the event.
|
Object |
getNodeOrLink()
Returns the node or link that causes the event.
|
int |
getType()
Returns the type of the content modifications.
|
boolean |
isAdjusting()
Returns
true if this event is part of a series of
modifications. |
boolean |
isAdjustmentEnd()
Returns
true if this event is the end of a series of
modifications. |
void |
setAdjusting(boolean flag)
Changes the adjustment flag of the event.
|
void |
setAdjustmentEnd(boolean flag)
Changes the adjustment end flag of the event.
|
void |
setNodeOrLink(Object nodeOrLink)
Sets the node or link that causes the event.
|
void |
setType(int type)
Sets the of the event.
|
getSource, toString
public static final int STRUCTURE_CHANGED
public static final int GEOMETRY_CHANGED
public static final int NODE_ADDED
STRUCTURE_CHANGED
.
public static final int NODE_REMOVED
STRUCTURE_CHANGED
.
public static final int LINK_ADDED
STRUCTURE_CHANGED
.
public static final int LINK_REMOVED
STRUCTURE_CHANGED
.
public static final int NODE_GEOMETRY_CHANGED
GEOMETRY_CHANGED
.
public static final int LINK_GEOMETRY_CHANGED
GEOMETRY_CHANGED
.
public static final int ADJUSTMENT_END
isAdjusting
returns
false
.isAdjusting()
,
Constant Field Valuespublic GraphModelEvent(IlvGraphModel graphModel)
graphModel
- The graph model responsible for generating the event.public IlvGraphModel getGraphModel()
public void setNodeOrLink(Object nodeOrLink)
nodeOrLink
- The node or link.public Object getNodeOrLink()
null
if the event was not caused by a specific object
(for instance, a geometry event caused by changing the coordinates
mode).IlvGraphLayout.setCoordinatesMode(int)
public final int getType()
STRUCTURE_CHANGED
GEOMETRY_CHANGED
NODE_ADDED
NODE_REMOVED
LINK_ADDED
LINK_REMOVED
NODE_GEOMETRY_CHANGED
LINK_GEOMETRY_CHANGED
To detect a certain type, you should query the corresponding bit with the bit mask, for instance:
if ((event.getType() & GraphModelEvent.STRUCTURE_CHANGED) != 0) { ... } if ((event.getType() & GraphModelEvent.GEOMETRY_CHANGED) != 0) { ... }
public void setType(int type)
public final void setAdjusting(boolean flag)
IlvGraphModel
.public final boolean isAdjusting()
true
if this event is part of a series of
modifications.
Note that if the type of the event is ADJUSTMENT_END
,
this method always returns false
.
The method returns true
if the event is fired by the
graph model while the graph model is in adjustment mode. If the
method returns true
, then another event of type
ADJUSTMENT_END
will be fired by the graph model. Thus,
if you only want to perform an action for each modification of the
graph model, but not on every individual object addition or removal,
you can perform the action when this method returns
false
.
public final void setAdjustmentEnd(boolean flag)
IlvGraphModel
.public final boolean isAdjustmentEnd()
true
if this event is the end of a series of
modifications.setAdjustmentEnd(boolean)
,
isAdjusting()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.