public final class LabelingModelEvent extends EventObject
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.
LabelingModelListener
,
IlvLabelingModel
,
Serialized FormModifier and Type | Field and Description |
---|---|
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.
|
source
Constructor and Description |
---|
LabelingModelEvent(IlvLabelingModel model)
Creates the event.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getSource, toString
public static final int STRUCTURE_CHANGED
public static final int GEOMETRY_CHANGED
public static final int LABEL_ADDED
STRUCTURE_CHANGED
.
public static final int LABEL_REMOVED
STRUCTURE_CHANGED
.
public static final int OBSTACLE_ADDED
STRUCTURE_CHANGED
.
public static final int OBSTACLE_REMOVED
STRUCTURE_CHANGED
.
public static final int LABEL_GEOMETRY_CHANGED
GEOMETRY_CHANGED
.
public static final int OBSTACLE_GEOMETRY_CHANGED
GEOMETRY_CHANGED
.
public LabelingModelEvent(IlvLabelingModel model)
model
- The labeling model responsible for generating the event.public IlvLabelingModel getLabelingModel()
public void setObstacleOrLabel(Object obj)
obj
- The object.public Object getObstacleOrLabel()
null
if the event was not caused by a specific object
(for instance, a geometry event caused by changing the coordinates
mode).IlvLabelLayout.setCoordinatesMode(int)
public final int getType()
STRUCTURE_CHANGED
GEOMETRY_CHANGED
LABEL_ADDED
LABEL_REMOVED
OBSTACLE_ADDED
OBSTACLE_REMOVED
LABEL_GEOMETRY_CHANGED
OBSTACLE_GEOMETRY_CHANGED
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) { ... }
public void setType(int type)
public final void setAdjusting(boolean flag)
IlvLabelingModel
).public final void setAdjustmentEnd(boolean flag)
IlvLabelingModel
).public final boolean isAdjusting()
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
.
setAdjusting(boolean)
,
isAdjustmentEnd()
public final boolean isAdjustmentEnd()
true
if this event is the end of a series of
modifications.
setAdjustmentEnd(boolean)
,
isAdjusting()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.