public abstract class IlvAnimationBehavior extends IlvSingleBehavior
IlvAnimationBehavior
is the base class for all the behavior objects
used
to produce animation effects. These objects handle a Boolean property.
When this property is set to true
, the behavior object repeatedly calls
the doit
method at a specified time interval. Animation stops when the
value is set to false
.
By default, animation behaviors do not tick in real time. For example, an animation behavior with a period of one second will:
doit
method,
doit
method,
doit
method.
If your application relies on animation behaviors ticking in real time,
use the IlvClockValueSource#setRealTimeMode
method.Constructor and Description |
---|
IlvAnimationBehavior(IlvAnimationBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvAnimationBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvAnimationBehavior(String name,
String period)
Creates a new animation behavior.
|
Modifier and Type | Method and Description |
---|---|
protected void |
attach(IlvGroup group)
Called when this behavior object is added to the
specified group.
|
protected void |
detach(IlvGroup group)
Called when this behavior object is removed from
the specified group.
|
protected abstract void |
doit()
Called at the time interval specified by the
period parameter
passed to the constructor
when the value handled by the behavior object is set to true . |
protected Object |
get(IlvGroup group,
String name)
Returns the current animation state of the behavior.
|
String |
getPeriod()
Gets the
period parameter. |
int |
getSynchronizationCount()
This method is defined in this class so
that existing subclasses developed with Rogue Wave JViews 2.0
will still work.
|
long |
getTimerPeriod()
Returns
getPeriodValue() . |
protected void |
set(IlvGroup group,
String name,
Object value)
If
value can be converted to the boolean value
true , the animation starts. |
void |
setPeriod(String period)
Sets the
period parameter. |
static void |
start()
Starts or restarts the thread that triggers all animations.
|
static void |
stop()
Stops the thread that triggers all animations.
|
void |
timerTicked()
Calls
doit() . |
void |
write(IlvOutputStream out)
Writes the behavior to an
IlvOutputStream . |
get, getName, getValueNames, set, setName
copy, getParameter, isOutput, isReadable, isWritable, toString
public IlvAnimationBehavior(String name, String period)
name
- the name of the behavior, which is the name of the
boolean value used to start or stop the animation.period
- the animation period in milliseconds. This value
can be either a direct value (for example, 100
), the
name of another property, or an expression.public IlvAnimationBehavior(IlvAnimationBehavior source)
source
- the behavior object to be copied.public IlvAnimationBehavior(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.protected abstract void doit() throws IlvValueException
period
parameter
passed to the constructor
when the value handled by the behavior object is set to true
.IlvValueException
- indicates a value error.public void write(IlvOutputStream out) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
write
in class IlvSingleBehavior
out
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.protected void set(IlvGroup group, String name, Object value) throws IlvValueException
value
can be converted to the boolean value
true
, the animation starts. Otherwise, it stops.set
in class IlvSingleBehavior
group
- the group to which the behavior is attached.name
- the name of the property (which is also the name of the behavior).value
- the value to which the property handled by the behavior object should be set.IlvValueException
- if the value caused an error.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup, java.lang.String[], java.lang.Object[], boolean[])
protected Object get(IlvGroup group, String name) throws IlvValueException
get
in class IlvSingleBehavior
group
- the group to which this behavior object is attached.name
- the name of the property to be read.true
if animation is running and false
otherwise.IlvValueException
- if the value caused an error.IlvSingleBehavior.get(ilog.views.prototypes.IlvGroup, java.lang.String[], java.lang.Object[], boolean[])
protected void attach(IlvGroup group)
attach
in class IlvBehavior
group
- the group to which this behavior object is attached.IlvGroup.addBehavior(ilog.views.prototypes.IlvBehavior)
protected void detach(IlvGroup group)
detach
in class IlvBehavior
group
- the group to which this behavior object is attached.IlvGroup.removeBehavior(ilog.views.prototypes.IlvBehavior)
public void setPeriod(String period)
period
parameter.public String getPeriod()
period
parameter.public long getTimerPeriod()
getPeriodValue()
.public void timerTicked()
doit()
.public int getSynchronizationCount()
public static void start()
If you use animated prototypes in an applet, you must call
this method in the applet's start()
method to
make sure that the thread is restarted when you re-enter the
applet's page.
public static void stop()
If you use animated prototypes in an applet, you must call
this method in the applet's stop()
method to
make sure the thread is stopped when you leave the
applet's page.
© Copyright Rogue Wave Software, Inc. 1997, 2015. All Rights Reserved.