|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.prototypes.IlvBehavior
ilog.views.prototypes.IlvSingleBehavior
ilog.views.prototypes.IlvAnimationBehavior
ilog.views.prototypes.IlvTimerBehavior
public class IlvTimerBehavior
The class IlvTimerBehavior is a subclass of IlvAnimationBehavior
that modifies a property of the prototype periodically.
While the IlvBlinkBehavior, IlvInvertBehavior and
IlvRotateBehavior classes implement predefined animation effects,
the IlvTimerBehavior class lets you define a custom animation.
You specify the name of a property of your prototype, and an expression.
Every time the animation timer ticks, the expression is evaluated, and the
property is set to the result.
For example, if you have designed a prototype that represents a meter and that
has a value property, you can add a Timer behavior that increments
the value by 10 every second as follows:
IlvTimerBehavior timer =
new IlvTimerBehavior("increment", "1000", "value", "(value+10)%100", "10");
prototype.addBehavior(timer);
...
prototype.set("increment", true); // starts the timer
The last parameter of the timer behavior lets you specify a step count that is used to synchronize an animation on different objects. In the example above, the meter successively takes the 10 values 0, 10, 20, ..., 90. Specifying a step count of 10 insures that all the instances of the prototype will take the same value at a given time, even if their timers are not started simultaneously. Moreover, when a timer is stopped, the meter is reset to its initial value.
| Constructor Summary | |
|---|---|
IlvTimerBehavior(IlvInputStream in)
Reads the behavior from an IlvInputStream stream. |
|
IlvTimerBehavior(IlvTimerBehavior source)
Creates a new behavior object by copying an existing one. |
|
IlvTimerBehavior(String name,
String period,
String target,
String source,
String count)
Creates a new IlvTimerBehavior object that
modifies a property of the prototype periodically. |
|
| Method Summary | |
|---|---|
IlvBehavior |
copy()
Returns a copy of the behavior. |
protected void |
doit()
Sets the property specified by the target parameter passed to the
constructor to the source expression. |
String |
getCount()
Gets the synchronization count. |
String |
getSource()
Gets the source expression. |
int |
getSynchronizationCount()
Implementation of the Timer interface. |
String |
getTarget()
Gets the target property. |
void |
setCount(String count)
Sets the synchronization count. |
void |
setSource(String source)
Sets the source expression. |
void |
setTarget(String target)
Sets the target property. |
String |
toString()
Returns a short text describing this behavior object. |
void |
write(IlvOutputStream out)
Writes the behavior to an IlvOutputStream. |
| Methods inherited from class ilog.views.prototypes.IlvAnimationBehavior |
|---|
attach, detach, get, getPeriod, getTimerPeriod, set, setPeriod, start, stop, timerTicked |
| Methods inherited from class ilog.views.prototypes.IlvSingleBehavior |
|---|
get, getName, getValueNames, set, setName |
| Methods inherited from class ilog.views.prototypes.IlvBehavior |
|---|
getParameter, isOutput, isReadable, isWritable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvTimerBehavior(String name,
String period,
String target,
String source,
String count)
IlvTimerBehavior object that
modifies a property of the prototype periodically.
name - the name of the property defined by this behavior, which is
a boolean value used to start or stop the animation.period - the animation period in milliseconds. This value
can be either an immediate value (for example, "100"), or the
name of another property which will be read to get the actual
period value.target - the name of the property that will be set when the timer ticks.source - the expression to which the target property will be set
every time the timer ticks. The expression is re-evaluated each time.count - the step count. This parameter lets you synchronize
different animation behaviors. If count is non-zero, all the
animation behaviors with the same period and with the same step
count will be synchronous. See the example in the general description of the class.
If count is zero, the timer is not synchronized.public IlvTimerBehavior(IlvTimerBehavior source)
source - the behavior object to be copied.
public IlvTimerBehavior(IlvInputStream in)
throws IlvReadFileException
IlvInputStream stream.
This constructor must be called by the
input constructors of subclasses.
in - The input stream.
IlvReadFileException - if the stream format is not correct.| Method Detail |
|---|
public void write(IlvOutputStream out)
throws IOException
IlvOutputStream.
write in interface IlvPersistentObjectwrite in class IlvAnimationBehaviorout - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.public IlvBehavior copy()
copy in class IlvBehaviorpublic String toString()
toString in class IlvBehavior
protected void doit()
throws IlvValueException
target parameter passed to the
constructor to the source expression.
doit in class IlvAnimationBehaviorIlvValueException - if an error occurred while setting the property.public void setTarget(String target)
public String getTarget()
public void setSource(String source)
public String getSource()
public void setCount(String count)
public String getCount()
public int getSynchronizationCount()
count parameter passed to the constructor.
getSynchronizationCount in class IlvAnimationBehavior
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||