public abstract class IlvBlinkingAction extends Object implements IlvBlinkingDrawingResource
IlvBlinkingAction is an abstract action that is performed
when blinking. During blinking, it periodically calls the method
changeState(ilog.views.IlvGraphic, boolean), which can be overridden to modify the associated
graphic object depending on the "on" state or "off" state.
It allows to modify arbitrary display parameter of
the graphic object. Example:
IlvMarker marker = new IlvMarker();
IlvBlinkingAction action = new IlvBlinkingAction() {
protected void changeState(IlvGraphic obj, boolean isOn) {
// no applyToObject necessary because the caller does it already for us
IlvMarker marker = (IlvMarker)obj;
if (isOn) {
marker.setType(IlvMarker.IlvMarkerCircle);
} else {
marker.setType(IlvMarker.IlvMarkerPlus);
}
}
};
marker.setBlinkingAction(action);
Blinking actions can be shared among graphic objects, that is, you can
set the same blinking action to different graphic objects.
Limitation: For technical reasons, the "on" and "off" durations are limited from 1 to max integer (not max long). It is recommended to use the same durations whenever possible for all objects, and to choose the durations not too small (e.g. not smaller than 100 ms), because otherwise the performance of the system will degrade dramatically.
| Constructor and Description |
|---|
IlvBlinkingAction()
Allocates a new blinking action.
|
IlvBlinkingAction(long onPeriod,
long offPeriod)
Allocates a new blinking action.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
changeState(IlvGraphic obj,
boolean isOn)
Implement this method to perform the actions when the state
toggles between on and off.
|
long |
getOffPeriod()
Returns the duration, in milliseconds, of the "off" period.
|
long |
getOnPeriod()
Returns the duration, in milliseconds, of the "on" period.
|
boolean |
isOn()
Returns
true if this drawing resource displays like the
"on" state,
and false if it displays like the "off" state. |
void |
notifyUsed(IlvBlinkingObject obj,
boolean used)
Called by
IlvGraphic if this drawing resource is used. |
void |
setOn(boolean flag)
Sets whether this drawing resource displays like the "on" or "off" state.
|
void |
setTemporarilyDisabled(boolean flag)
Temporarily disable the blinking.
|
public IlvBlinkingAction()
public IlvBlinkingAction(long onPeriod,
long offPeriod)
onPeriod - The "on" duration, in milliseconds.offPeriod - The "off" duration, in milliseconds.public long getOnPeriod()
getOnPeriod in interface IlvBlinkingDrawingResourcepublic long getOffPeriod()
getOffPeriod in interface IlvBlinkingDrawingResourcepublic void setOn(boolean flag)
setOn in interface IlvBlinkingDrawingResourceflag - true means it displays like the "on" state.protected abstract void changeState(IlvGraphic obj, boolean isOn)
applyToObject session of the input graphic object,
hence it is possible to modify graphic properties of the object
directly. It is always called from the AWT event thread.
Here is an example implementation:
protected void changeState(IlvGraphic obj, boolean isOn) {
// assume the associated object is always an IlvMarker
IlvMarker marker = (IlvMarker)obj;
// no applyToObject necessary because the caller does it already for us
if (isOn) {
marker.setType(IlvMarker.IlvMarkerCircle);
} else {
marker.setType(IlvMarker.IlvMarkerPlus);
}
}
obj - The graphic object associated with this action.isOn - The next state.public boolean isOn()
true if this drawing resource displays like the
"on" state,
and false if it displays like the "off" state.isOn in interface IlvBlinkingDrawingResourcepublic void setTemporarilyDisabled(boolean flag)
setTemporarilyDisabled in interface IlvBlinkingDrawingResourceflag - true if temporarily disabled.public void notifyUsed(IlvBlinkingObject obj, boolean used)
IlvGraphic if this drawing resource is used.
You should not call this method.notifyUsed in interface IlvBlinkingDrawingResourceobj - The blinking object.used - Whether the color is used.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.