freemarker.template
Class UpdateTimer
java.lang.Object
|
+--freemarker.template.UpdateTimer
- All Implemented Interfaces:
- java.lang.Runnable
- public class UpdateTimer
- extends java.lang.Object
- implements java.lang.Runnable
A timer for objects that implement Updatable.
Creates a new thread, in which it periodically calls the
Updatable's update() method.
|
Method Summary |
void |
run()
|
void |
setDelay(long delay)
Sets the update interval |
void |
setTarget(Updatable target)
Sets the target to be updated |
void |
startTiming()
Begins periodic automatic updates of the target. |
void |
stopTiming()
Stops automatically updating the target. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UpdateTimer
public UpdateTimer()
UpdateTimer
public UpdateTimer(Updatable target,
long delay)
- Constructs the timer with the update target and update interval
- Parameters:
target - the object to be updated.delay - the number of milliseconds between updates.
setTarget
public void setTarget(Updatable target)
- Sets the target to be updated
- Parameters:
target - the object to be updated.
setDelay
public void setDelay(long delay)
- Sets the update interval
- Parameters:
delay - the number of milliseconds between updates.
startTiming
public void startTiming()
- Begins periodic automatic updates of the target.
Since it can't be determined if an existing thread is
Runnable or not, create and start a new thread
stopTiming
public void stopTiming()
- Stops automatically updating the target.
run
public void run()
- Specified by:
run in interface java.lang.Runnable