fi.hut.tml.xsmiles.mlfc.smil.basic
Class Scheduler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.smil.basic.Scheduler

public class Scheduler
extends java.lang.Object

Scheduler schedules the whole SMIL presentation. It is used as a global timer. All timed elements will add themselves as listeners for time evets, which are notified according to the element request.
A centralized scheduler is used to synchronize timed elements. It also helps starting, stopping and pausing the presentation.


Field Summary
static int TIMER_ACTIVATE
          Callback methods, timed element may request one of these methods to be called when the timer triggers.
static int TIMER_DEACTIVATE
           
static int TIMER_SIMPLEDUR
           
 
Constructor Summary
Scheduler(SMILDocumentImpl doc)
          Constructor.
 
Method Summary
 void addTimeListener(ElementBasicTimeImpl elem, long time, int callbackMethod)
          Add a time listener.
 void cont()
          Continue all elements and the timer.
 void destroy()
          Destroy scheduler and the timer.
 long getDocTimeNow()
          Return the current time in document time.
 long getStartTime()
          Return the start time of the presentation
 void pause()
          Pause all elements and the timer.
 void removeTimeListener(ElementBasicTimeImpl elem, int callbackMethod)
          Remove time listener for element elem.
 void removeTimeListeners(ElementBasicTimeImpl elem)
          Remove all time listeners for element elem.
 void start()
          Start all elements and the timer.
 void stop()
          Stop all elements and the timer.
 void timeReached()
          The time has been reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMER_ACTIVATE

public static final int TIMER_ACTIVATE
Callback methods, timed element may request one of these methods to be called when the timer triggers.

See Also:
Constant Field Values

TIMER_DEACTIVATE

public static final int TIMER_DEACTIVATE
See Also:
Constant Field Values

TIMER_SIMPLEDUR

public static final int TIMER_SIMPLEDUR
See Also:
Constant Field Values
Constructor Detail

Scheduler

public Scheduler(SMILDocumentImpl doc)
Constructor.

Method Detail

getStartTime

public long getStartTime()
Return the start time of the presentation

Returns:
system clock time the presentation was started

getDocTimeNow

public long getDocTimeNow()
Return the current time in document time.


addTimeListener

public void addTimeListener(ElementBasicTimeImpl elem,
                            long time,
                            int callbackMethod)
Add a time listener. This will cause timer to be checked and restarted.

Parameters:
elem - Element to be notified after time has elapsed.
time - Time value in ms, related to body start time
callbackMethod - Method to call back when notification happens

removeTimeListeners

public void removeTimeListeners(ElementBasicTimeImpl elem)
Remove all time listeners for element elem. This will cause timer to be checked and restarted.

Parameters:
elem - Element to be removed

removeTimeListener

public void removeTimeListener(ElementBasicTimeImpl elem,
                               int callbackMethod)
Remove time listener for element elem. This will cause timer to be checked and restarted.

Parameters:
elem - Element to be removed

start

public void start()
Start all elements and the timer.


stop

public void stop()
Stop all elements and the timer.


pause

public void pause()
Pause all elements and the timer.


destroy

public void destroy()
Destroy scheduler and the timer.


cont

public void cont()
Continue all elements and the timer.


timeReached

public void timeReached()
The time has been reached.



X-Smiles 1.2