Module com.flexganttfx.model
Package com.flexganttfx.model.timeline
Class TimelineModel<T extends TemporalUnit>
java.lang.Object
com.flexganttfx.model.timeline.TimelineModel<T>
- Type Parameters:
T
- the temporal unit supported by the model (e.g. ChronoUnit).
- Direct Known Subclasses:
ChronoUnitTimelineModel
,SimpleUnitTimelineModel
The timeline model stores the most important properties related to navigating
within time (move forward and backward in time, zoom in and out).
- Now - the "current" time (e.g. system time).
- Start time - the first time point that will be visible to the user.
- Millis per pixel - how much time is represented by a single pixel (important for zooming).
- Horizon - the earliest and latest point in time to which the user can scroll.
- Lowest temporal unit - the lowest unit that the user will be able to see (e.g. MINUTES).
- Highest temporal unit - the highest unit that the user will be able to see (e.g. MONTHS).
-
Property Summary
PropertiesTypePropertyDescriptionfinal ObjectProperty<Instant>
Returns the object property used for storing the end time of the horizon.final ObjectProperty<Instant>
Returns the object property used for storing the start time of the horizon.final DoubleProperty
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.final DoubleProperty
Returns the property used to store the millis per pixel value.final DoubleProperty
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.final ReadOnlyDoubleProperty
Stores the location of the "now" time.final ObjectProperty<Instant>
Returns the property used to store "now", the current time, e.g.final DoubleProperty
final ReadOnlyObjectProperty<T>
Stores the smallest temporal unit supported by the control.final ObjectProperty<Instant>
Returns the property used to store the first visible time point. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal double
Returns the pixel location of the given time.final Instant
calculateTimeForLocation
(double location) Returns the time for the given location.final Instant
Returns the value ofhorizonEndTimeProperty()
.final Instant
Returns the value ofhorizonStartTimeProperty()
.final double
Returns the value ofmaximumMillisPerPixelProperty()
.final double
Returns the value ofmillisPerPixelProperty()
.final double
Returns the value ofminimumMillisPerPixelProperty()
.final Instant
getNow()
Returns the value ofnowProperty()
.final double
Returns the value ofnowLocationProperty()
.final double
Gets the value of theoffset
property.final T
Returns the value ofsmallestTemporalUnitProperty()
.final Instant
Returns the value ofstartTimeProperty()
.final ObjectProperty<Instant>
Returns the object property used for storing the end time of the horizon.final ObjectProperty<Instant>
Returns the object property used for storing the start time of the horizon.final DoubleProperty
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.final DoubleProperty
Returns the property used to store the millis per pixel value.final DoubleProperty
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.final ReadOnlyDoubleProperty
Stores the location of the "now" time.final ObjectProperty<Instant>
Returns the property used to store "now", the current time, e.g.final DoubleProperty
final void
setHorizonEndTime
(Instant time) Sets the value ofhorizonEndTimeProperty()
.final void
setHorizonStartTime
(Instant time) Sets the value ofhorizonStartTimeProperty()
.final void
setMaximumMillisPerPixel
(double max) Sets the value ofmaximumMillisPerPixelProperty()
.final void
setMillisPerPixel
(double millis) Sets the value of themillisPerPixelProperty()
.final void
setMinimumMillisPerPixel
(double min) Sets the value ofminimumMillisPerPixelProperty()
.final void
Sets the value ofnowProperty()
.final void
setOffset
(double offset) Sets the value of theoffset
property.final void
setStartTime
(Instant time) Sets the value ofstartTimeProperty()
.final void
setZoomRange
(T smallestUnit, int smallestUnitCount, double smallestUnitWidth, T largestUnit, int largestUnitCount, double largestUnitWidth) Sets the range in which the user can zoom in and out of the timeline.final ReadOnlyObjectProperty<T>
Stores the smallest temporal unit supported by the control.final ObjectProperty<Instant>
Returns the property used to store the first visible time point.
-
Property Details
-
offset
- See Also:
-
horizonStartTime
Returns the object property used for storing the start time of the horizon. -
horizonEndTime
Returns the object property used for storing the end time of the horizon. -
millisPerPixel
Returns the property used to store the millis per pixel value. This value determines how much time is represented by a single pixel in the user interface. Changing the value of this property will cause the control to show more or less time within the visible timeline area, meaning zooming can be controlled by this property. -
minimumMillisPerPixel
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen. Zoom-In operations will be limited by this value.- Since:
- 1.4
- See Also:
-
maximumMillisPerPixel
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen. Zoom-Out operations will be limited by this value.- Since:
- 1.4
- See Also:
-
startTime
Returns the property used to store the first visible time point. -
now
Returns the property used to store "now", the current time, e.g. the current system time.- See Also:
-
nowLocation
Stores the location of the "now" time. The location can be computed based on the millis per pixel and the start time value.- See Also:
-
smallestTemporalUnit
Stores the smallest temporal unit supported by the control.
-
-
Constructor Details
-
TimelineModel
protected TimelineModel()Constructs a new timeline model.
-
-
Method Details
-
getOffset
public final double getOffset()Gets the value of theoffset
property.- Property description:
- Returns:
- the value of the
offset
property - See Also:
-
offsetProperty
- Returns:
- the
offset
property - See Also:
-
setOffset
public final void setOffset(double offset) Sets the value of theoffset
property.- Property description:
- Parameters:
offset
- the value for theoffset
property- See Also:
-
horizonStartTimeProperty
Returns the object property used for storing the start time of the horizon.- Returns:
- the horizon start time
- See Also:
-
getHorizonStartTime
Returns the value ofhorizonStartTimeProperty()
.- Returns:
- the horizon start time
-
setHorizonStartTime
Sets the value ofhorizonStartTimeProperty()
.- Parameters:
time
- the horizon start time
-
horizonEndTimeProperty
Returns the object property used for storing the end time of the horizon.- Returns:
- the horizon end time
- See Also:
-
getHorizonEndTime
Returns the value ofhorizonEndTimeProperty()
.- Returns:
- the horizon end time
-
setHorizonEndTime
Sets the value ofhorizonEndTimeProperty()
.- Parameters:
time
- the horizon end time
-
millisPerPixelProperty
Returns the property used to store the millis per pixel value. This value determines how much time is represented by a single pixel in the user interface. Changing the value of this property will cause the control to show more or less time within the visible timeline area, meaning zooming can be controlled by this property.- Returns:
- the millis per pixel property
- See Also:
-
setMillisPerPixel
public final void setMillisPerPixel(double millis) Sets the value of themillisPerPixelProperty()
.- Parameters:
millis
- the millis represented by a pixel
-
getMillisPerPixel
public final double getMillisPerPixel()Returns the value ofmillisPerPixelProperty()
.- Returns:
- the millis represented by a pixel
-
minimumMillisPerPixelProperty
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen. Zoom-In operations will be limited by this value.- Returns:
- the minimum MPP value
- Since:
- 1.4
- See Also:
-
setMinimumMillisPerPixel
public final void setMinimumMillisPerPixel(double min) Sets the value ofminimumMillisPerPixelProperty()
.- Parameters:
min
- the minimum MPP value- Since:
- 1.4
- See Also:
-
getMinimumMillisPerPixel
public final double getMinimumMillisPerPixel()Returns the value ofminimumMillisPerPixelProperty()
.- Returns:
- the minimum MPP value
- Since:
- 1.4
- See Also:
-
maximumMillisPerPixelProperty
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen. Zoom-Out operations will be limited by this value.- Returns:
- the maximum MPP value
- Since:
- 1.4
- See Also:
-
setMaximumMillisPerPixel
public final void setMaximumMillisPerPixel(double max) Sets the value ofmaximumMillisPerPixelProperty()
.- Parameters:
max
- the maximum MPP value- Since:
- 1.4
- See Also:
-
getMaximumMillisPerPixel
public final double getMaximumMillisPerPixel()Returns the value ofmaximumMillisPerPixelProperty()
.- Returns:
- the maximum MPP value
- Since:
- 1.4
- See Also:
-
setZoomRange
public final void setZoomRange(T smallestUnit, int smallestUnitCount, double smallestUnitWidth, T largestUnit, int largestUnitCount, double largestUnitWidth) Sets the range in which the user can zoom in and out of the timeline.- Parameters:
smallestUnit
- the smallest unit to which the user can zoom (e.g. "MINUTES")smallestUnitCount
- the number of smallest units (e.g. "5" MINUTES)smallestUnitWidth
- the width of the unit in pixels, must be larger than 10 (e.g. "30")largestUnit
- the largest unit to which the user can zoom (e.g. "YEARS")largestUnitCount
- the number of largest units (e.g. "1" YEAR)largestUnitWidth
- the width of the unit in pixels, must be larger than 10 (e.g. "30")- Since:
- 1.4
- See Also:
-
startTimeProperty
Returns the property used to store the first visible time point.- Returns:
- the start time property
- See Also:
-
setStartTime
Sets the value ofstartTimeProperty()
.- Parameters:
time
- the start time
-
getStartTime
Returns the value ofstartTimeProperty()
.- Returns:
- the start time
-
nowProperty
Returns the property used to store "now", the current time, e.g. the current system time.- Returns:
- the "now" time
- See Also:
-
setNow
Sets the value ofnowProperty()
.- Parameters:
now
- the "now" time
-
getNow
Returns the value ofnowProperty()
.- Returns:
- the "now" time
-
nowLocationProperty
Stores the location of the "now" time. The location can be computed based on the millis per pixel and the start time value.- Returns:
- the pixel location of "now"
- See Also:
-
getNowLocation
public final double getNowLocation()Returns the value ofnowLocationProperty()
.- Returns:
- the pixel location of "now"
-
smallestTemporalUnitProperty
Stores the smallest temporal unit supported by the control.- Returns:
- the smallest temporal unit supported (e.g. "MINUTES").
- See Also:
-
getSmallestTemporalUnit
Returns the value ofsmallestTemporalUnitProperty()
.- Returns:
- the smallest temporal unit
-
calculateLocationForTime
Returns the pixel location of the given time.- Parameters:
time
- the time for which to return the pixel location- Returns:
- the location of the given time
-
calculateTimeForLocation
Returns the time for the given location.- Parameters:
location
- the location in pixels- Returns:
- the location time
-