ilog.views.graphlayout
Class GraphModelEvent

java.lang.Object
  extended by java.util.EventObject
      extended by ilog.views.graphlayout.GraphModelEvent
All Implemented Interfaces:
Serializable

public final class GraphModelEvent
extends EventObject

Encapsulates information describing changes to a graph model.

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.

See Also:
GraphModelListener, IlvGraphModel, Serialized Form

Field Summary
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.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
GraphModelEvent(IlvGraphModel graphModel)
          Creates the event.
 
Method Summary
 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 type of the event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRUCTURE_CHANGED

public static final int STRUCTURE_CHANGED
The bit mask of the type of the event when one or several nodes or links have been added or removed.

See Also:
Constant Field Values

GEOMETRY_CHANGED

public static final 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.

See Also:
Constant Field Values

NODE_ADDED

public static final int NODE_ADDED
The bit mask of the type of the event when a node has been added. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

NODE_REMOVED

public static final int NODE_REMOVED
The bit mask of the type of the event when a node has been removed. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

LINK_ADDED

public static final int LINK_ADDED
The bit mask of the type of the event when a link has been added. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

LINK_REMOVED

public static final int LINK_REMOVED
The bit mask of the type of the event when a link has been removed. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

NODE_GEOMETRY_CHANGED

public static final int NODE_GEOMETRY_CHANGED
The bit mask of the type of the event when a node has been moved or resized. This bit mask is usually combined with the bit mask GEOMETRY_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

LINK_GEOMETRY_CHANGED

public static final int LINK_GEOMETRY_CHANGED
The bit mask of the type of the event when a link has been reshaped. This bit mask is usually combined with the bit mask GEOMETRY_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

ADJUSTMENT_END

public static final int ADJUSTMENT_END
The type of the event when a series of modifications is finished. For this type of event, the method isAdjusting returns false.

See Also:
isAdjusting(), Constant Field Values
Constructor Detail

GraphModelEvent

public GraphModelEvent(IlvGraphModel graphModel)
Creates the event.

Parameters:
graphModel - The graph model responsible for generating the event.
Method Detail

getGraphModel

public IlvGraphModel getGraphModel()
Returns the graph model source of the event.


setNodeOrLink

public void setNodeOrLink(Object nodeOrLink)
Sets the node or link that causes the event.

Parameters:
nodeOrLink - The node or link.
Since:
JViews 5.5

getNodeOrLink

public Object getNodeOrLink()
Returns the node or link that causes the event. It returns null if the event was not caused by a specific object (for instance, a geometry event caused by changing the coordinates mode).

Since:
JViews 5.5
See Also:
IlvGraphLayout.setCoordinatesMode(int)

getType

public final int getType()
Returns the type of the content modifications. The type can be:

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) {
   ...
 }
 


setType

public void setType(int type)
Sets the type of the event. You should not call this method directly.

Since:
JViews 3.0

setAdjusting

public final void setAdjusting(boolean flag)
Changes the adjustment flag of the event. You should not call this method, except if you implement a graph model (subclass of IlvGraphModel.


isAdjusting

public final boolean isAdjusting()
Returns 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.


setAdjustmentEnd

public final void setAdjustmentEnd(boolean flag)
Changes the adjustment end flag of the event. You should not call this method, except if you implement a graph model (subclass of IlvGraphModel.

Since:
JViews 5.5

isAdjustmentEnd

public final boolean isAdjustmentEnd()
Returns true if this event is the end of a series of modifications.

Since:
JViews 5.5
See Also:
setAdjustmentEnd(boolean), isAdjusting()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.