Class SoSystemTimer
java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.inventor.sensors.SoSystemTimer
- All Implemented Interfaces:
SafeDisposable
Common interface to expose system dependent timers.
The timer implementation usually depends on the window toolkit used (Qt, Awt, Swt...). The purpose of this class is to expose a common interface for system dependent timers. When the timer is triggered, it must call the run() method of its
SoSystemTimerTask
(given by the setTask method).
SoSensorHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Method Summary
Modifier and TypeMethodDescriptionboolean
dispose()
Explicitly call this method to force object to dispose its unmanaged resources.boolean
Returns a boolean flag which indicates if it is safe to callSafeDisposable.dispose()
on the object.boolean
Return true if the timer is running.void
setDelay
(int time) Set the timer's timeout in milliseconds.void
setRepeat
(boolean flag) If set to true, the timer will be triggered periodically at the rate defined by setDelay.void
setTask
(SoSystemTimerTask task) Sets the task executed when the timer is triggered.void
start()
Start the timer.void
stop()
Stop the timer.Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Method Details
-
isDisposable
public boolean isDisposable()Description copied from interface:SafeDisposable
Returns a boolean flag which indicates if it is safe to callSafeDisposable.dispose()
on the object.- Specified by:
isDisposable
in interfaceSafeDisposable
- Returns:
true
if the object can be disposed in a safe manner
-
dispose
public boolean dispose()Description copied from class:Inventor
Explicitly call this method to force object to dispose its unmanaged resources. The object may not be reused in the application code after this call.- Specified by:
dispose
in interfaceSafeDisposable
- Overrides:
dispose
in classInventor
- Returns:
true
if this object native resources were successfully disposed;false
if it was already disposed or no native resources has been registered for this object.
-
stop
public void stop()Stop the timer. -
start
public void start()Start the timer. If it is already started, stop it and restart -
setRepeat
public void setRepeat(boolean flag) If set to true, the timer will be triggered periodically at the rate defined by setDelay. -
setTask
Sets the task executed when the timer is triggered. When the timer is is triggered, it calls the run() method of task. -
isPending
public boolean isPending()Return true if the timer is running. -
setDelay
public void setDelay(int time) Set the timer's timeout in milliseconds.
-