ilog.views.graphlayout.labellayout
Class LabelingModelEvent

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

public final class LabelingModelEvent
extends EventObject

Encapsulates information describing changes to a labeling model.

A LabelingModelEvent event is delivered to the "labeling model-content-changed" listeners, that is, listeners of modifications to the contents of a labeling model (IlvLabelingModel). The event corresponds to several operations, such as the addition and removal of a label or obstacle, or the modification of the geometry of the labels or obstacles.

In some situations it is inefficient to perform an action after each modification in the labeling model. That is why this event has a method (isAdjusting) that indicates that a series of modifications occurred (for example, all the obstacles are removed). The end of a series is notified by a new event that has the adjustment end flag (isAdjustmentEnd) set.

Since:
JViews 5.0
See Also:
LabelingModelListener, IlvLabelingModel, Serialized Form

Field Summary
static int GEOMETRY_CHANGED
          The bit mask of the type of the event when the geometry (position or size) of one or several labels or obstacles has changed.
static int LABEL_ADDED
          The bit mask of the type of the event when a label has been added.
static int LABEL_GEOMETRY_CHANGED
          The bit mask of the type of the event when a label has been moved or resized.
static int LABEL_REMOVED
          The bit mask of the type of the event when a label has been removed.
static int OBSTACLE_ADDED
          The bit mask of the type of the event when an obstacle has been added.
static int OBSTACLE_GEOMETRY_CHANGED
          The bit mask of the type of the event when an obstacle has been moved or resized.
static int OBSTACLE_REMOVED
          The bit mask of the type of the event when an obstacle has been removed.
static int STRUCTURE_CHANGED
          The bit mask of the type of the event when one or several labels or obstacles have been added or removed.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
LabelingModelEvent(IlvLabelingModel labelingModel)
          Creates the event.
 
Method Summary
 IlvLabelingModel getLabelingModel()
          Returns the labeling model source of the event.
 Object getObstacleOrLabel()
          Returns the obstacle or label that causes the event.
 int getType()
          Returns the type of the content modification.
 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 setObstacleOrLabel(Object obj)
          Sets the obstacle or label 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 labels or obstacles 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 labels or obstacles has changed.

See Also:
Constant Field Values

LABEL_ADDED

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

Since:
JViews 5.5
See Also:
Constant Field Values

LABEL_REMOVED

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

Since:
JViews 5.5
See Also:
Constant Field Values

OBSTACLE_ADDED

public static final int OBSTACLE_ADDED
The bit mask of the type of the event when an obstacle has been added. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

OBSTACLE_REMOVED

public static final int OBSTACLE_REMOVED
The bit mask of the type of the event when an obstacle has been removed. This bit mask is usually combined with the bit mask STRUCTURE_CHANGED.

Since:
JViews 5.5
See Also:
Constant Field Values

LABEL_GEOMETRY_CHANGED

public static final int LABEL_GEOMETRY_CHANGED
The bit mask of the type of the event when a label 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

OBSTACLE_GEOMETRY_CHANGED

public static final int OBSTACLE_GEOMETRY_CHANGED
The bit mask of the type of the event when an obstacle 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
Constructor Detail

LabelingModelEvent

public LabelingModelEvent(IlvLabelingModel labelingModel)
Creates the event.

Parameters:
labelingModel - The labeling model responsible for generating the event.
Method Detail

getLabelingModel

public IlvLabelingModel getLabelingModel()
Returns the labeling model source of the event.


setObstacleOrLabel

public void setObstacleOrLabel(Object obj)
Sets the obstacle or label that causes the event.

Parameters:
obj - The object.

getObstacleOrLabel

public Object getObstacleOrLabel()
Returns the obstacle or label 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).

See Also:
IlvLabelLayout.setCoordinatesMode(int)

getType

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

To detect a certain type, you should query the corresponding bit with the bit mask, for instance:

 if ((event.getType() & LabelingModelEvent.STRUCTURE_CHANGED) != 0) {
   ...
 }
 if ((event.getType() & LabelingModelEvent.GEOMETRY_CHANGED) != 0) {
   ...
 }
 


setType

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


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 labeling model (subclass of IlvLabelingModel).


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 labeling model (subclass of IlvLabelingModel).


isAdjusting

public final boolean isAdjusting()
Returns true if this event is part of a series of modifications. Note that this method always returns false for events that have the adjustment end flag set. The method will return true if the event is fired by the labeling model while the labeling model is in adjustment mode. If the method returns true, then another event with the adjustment end flag will be fired by the labeling model. Thus, if you only want to perform an action for each modification of the labeling model, but not on every individual object addition or removal, you can skip the events that have the adjusting flag set and perform the action only when this method returns false.

See Also:
setAdjusting(boolean), isAdjustmentEnd()

isAdjustmentEnd

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

See Also:
setAdjustmentEnd(boolean), isAdjusting()


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