java.lang.Object
java.lang.Thread
com.flexganttfx.view.timeline.TimeTracker
- All Implemented Interfaces:
Runnable
A time tracker can be used to update the property
TimelineModel.nowProperty()
. In most cases the time "now" will be
equivalent to the system time but in simulations this might not be the case.
The time tracker can be used in combination with the TimelineModel
by
binding the TimelineModel.nowProperty()
to the
timeProperty()
.- Since:
- 1.0
-
Property Summary
Properties -
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal long
getDelay()
Returns the delay in milliseconds between updates ofTimelineModel.nowProperty()
.protected Instant
getNow()
Override to return the instant that will be set as "now" on the timeline model.final Instant
getTime()
Gets the value of thetime
property.void
run()
final void
setDelay
(long millis) Sets the delay between updates ofTimelineModel.nowProperty()
.final void
Starts the tracking of the time.final void
Stops the tracking of the time.final ReadOnlyObjectProperty<Instant>
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Property Details
-
time
- See Also:
-
-
Constructor Details
-
TimeTracker
public TimeTracker()Constructs a new tracker.- Since:
- 1.0
-
-
Method Details
-
timeProperty
- Returns:
- the
time
property - See Also:
-
getTime
Gets the value of thetime
property.- Property description:
- Returns:
- the value of the
time
property - See Also:
-
getDelay
public final long getDelay()Returns the delay in milliseconds between updates ofTimelineModel.nowProperty()
. The default is 1000 millis.- Returns:
- the default delay between update calls
- Since:
- 1.0
-
setDelay
public final void setDelay(long millis) Sets the delay between updates ofTimelineModel.nowProperty()
. The default is 1000 millis.- Parameters:
millis
- the new delay- Throws:
IllegalArgumentException
- if the delay is zero or smaller- Since:
- 1.0
-
startTracking
public final void startTracking()Starts the tracking of the time.- Since:
- 1.0
-
run
public void run() -
stopTracking
public final void stopTracking()Stops the tracking of the time.- Since:
- 1.0
-
getNow
Override to return the instant that will be set as "now" on the timeline model. The default implementation usesInstant.now()
.- Returns:
- the "now" instant
- See Also:
-