SalesPoint v3.3 API

sale
Class AutoTimer

java.lang.Object
  extended by sale.StepTimer
      extended by sale.AutoTimer
All Implemented Interfaces:
Serializable, Timer

public class AutoTimer
extends StepTimer

A timer that has the functionality of the StepTimer and additionally can increase the time automatically.

Since:
v2.0
Author:
Stephan Gambke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class sale.StepTimer
m_lhListeners, m_tTime
 
Constructor Summary
AutoTimer()
          Create a new AutoTimer with a Step as time object and a delay of 10 seconds.
AutoTimer(Time tTime)
          Create a new AutoTimer with the given time object and a delay of 10 seconds.
AutoTimer(Time tTime, long lDelay)
          Create a new AutoTimer with the given time object and delay.
 
Method Summary
 long getDelay()
          Get the current delay between timer ticks in milliseconds.
 void goAhead()
          Increase the time by the current interval.
 void setDelay(long lMilliSecs)
          Set the delay between timer ticks.
 void start()
          Set the timer running.
 void stop()
          Stop the timer.
 
Methods inherited from class sale.StepTimer
addTimerListener, fireGoneAhead, fireIntervalSet, fireTimeSet, getInterval, getTime, getTimeObject, getTimeStamp, removeTimerListener, setInterval, setTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoTimer

public AutoTimer()
Create a new AutoTimer with a Step as time object and a delay of 10 seconds. The timer is initially not running.


AutoTimer

public AutoTimer(Time tTime)
Create a new AutoTimer with the given time object and a delay of 10 seconds. The timer is initially not running.

Parameters:
tTime - the time object to be used

AutoTimer

public AutoTimer(Time tTime,
                 long lDelay)
Create a new AutoTimer with the given time object and delay. The timer is initially not running.

Parameters:
tTime - the time object to use
lDelay - the delay in milliseconds between the increasing steps
Method Detail

goAhead

public void goAhead()
             throws IllegalArgumentException
Increase the time by the current interval.

If no interval has yet been set, the interval given by the Time.getDefaultInterval() method of the time object is used.

If the AutoTimer is running, the time is increased and the delay restartet.

Specified by:
goAhead in interface Timer
Overrides:
goAhead in class StepTimer
Throws:
IllegalArgumentException - if the interval does not meet the time object's class or format requirements.
See Also:
TimerListener.onGoneAhead(sale.events.TimerEvent)
Override:
Never

start

public void start()
           throws IllegalArgumentException
Set the timer running. If the timer is already running, nothing happens.

The first timer tick occurs at once.

Throws:
IllegalArgumentException
Override:
Never

stop

public void stop()
Stop the timer.

Override:
Never

setDelay

public void setDelay(long lMilliSecs)
Set the delay between timer ticks.

If the AutoTimer is currently running, the new delay takes effect after the next tick.

Parameters:
lMilliSecs - the delay in milliseconds. Must be > 0.
Override:
Never

getDelay

public long getDelay()
Get the current delay between timer ticks in milliseconds.

Returns:
a long value representing the delay

SalesPoint v3.3 API