public abstract class IlvBlinkingMultiAction extends IlvBlinkingAction
IlvBlinkingMultiAction
is an abstract action that is performed
when blinking. During blinking, it periodically increments a step counter
and calls the method
changeState(ilog.views.IlvGraphic, boolean)
, which can be overridden to modify the associated
graphic object depending on the current step.
The step counter is cyclic, that is, after the last step, it continues
with the first step.
The IlvBlinkingMultiAction
allows any number of steps.
It allows to modify arbitrary display parameter of
the graphic object. Example:
IlvMarker marker = new IlvMarker(); IlvBlinkingAction action = new IlvBlinkingMultiAction(3) { protected void changeState(IlvGraphic obj, int step) { // assume the associated object is always an IlvMarker IlvMarker marker = (IlvMarker)obj; // no applyToObject necessary because the caller does it already for us switch (step) { case 0: marker.setType(IlvMarker.IlvMarkerCircle); break; case 1: marker.setType(IlvMarker.IlvMarkerPlus); break; case 2: marker.setType(IlvMarker.IlvMarkerCross); break; } } }; 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 period duration is 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 |
---|
IlvBlinkingMultiAction(int numberOfSteps)
Allocates a new blinking multi action.
|
IlvBlinkingMultiAction(int numberOfSteps,
long period)
Allocates a new blinking multi action.
|
Modifier and Type | Method and Description |
---|---|
protected void |
changeState(IlvGraphic obj,
boolean isOn)
Calls
changeState(IlvGraphic, int) with the new state. |
protected abstract void |
changeState(IlvGraphic obj,
int step)
Implement this method to perform the actions when the state
changes.
|
int |
getNumberOfSteps()
Return the maximum number of steps of this blinking action.
|
void |
setTemporarilyDisabled(boolean flag)
Temporarily disable the blinking.
|
getOffPeriod, getOnPeriod, isOn, notifyUsed, setOn
public IlvBlinkingMultiAction(int numberOfSteps)
numberOfSteps
- The number of steps.public IlvBlinkingMultiAction(int numberOfSteps, long period)
numberOfSteps
- The number of steps.period
- Duration, in milliseconds, of each periodpublic int getNumberOfSteps()
protected void changeState(IlvGraphic obj, boolean isOn)
changeState(IlvGraphic, int)
with the new state.changeState
in class IlvBlinkingAction
obj
- The graphic object associated with this action.isOn
- The next state.protected abstract void changeState(IlvGraphic obj, int step)
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, int step) { // assume the associated object is always an IlvMarker IlvMarker marker = (IlvMarker)obj; // no applyToObject necessary because the caller does it already for us switch (step) { case 0: marker.setType(IlvMarker.IlvMarkerCircle); break; case 1: marker.setType(IlvMarker.IlvMarkerPlus); break; case 2: marker.setType(IlvMarker.IlvMarkerCross); break; } }
obj
- The graphic object associated with this action.step
- The next step, between 0 and the maximum number of steps
(excluding).public void setTemporarilyDisabled(boolean flag)
setTemporarilyDisabled
in interface IlvBlinkingDrawingResource
setTemporarilyDisabled
in class IlvBlinkingAction
flag
- true
if temporarily disabled.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.