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
public abstract class TimelineModel<T extends TemporalUnit> extends Object
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
Properties Type Property Description ObjectProperty<Instant>
horizonEndTime
Returns the object property used for storing the end time of the horizon.ObjectProperty<Instant>
horizonStartTime
Returns the object property used for storing the start time of the horizon.DoubleProperty
maximumMillisPerPixel
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.DoubleProperty
millisPerPixel
Returns the property used to store the millis per pixel value.DoubleProperty
minimumMillisPerPixel
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.ReadOnlyDoubleProperty
nowLocation
Stores the location of the "now" time.ObjectProperty<Instant>
now
Returns the property used to store "now", the current time, e.g.DoubleProperty
offset
ReadOnlyObjectProperty<T>
smallestTemporalUnit
Stores the smallest temporal unit supported by the control.ObjectProperty<Instant>
startTime
Returns the property used to store the first visible time point. -
Constructor Summary
Constructors Modifier Constructor Description protected
TimelineModel()
Constructs a new timeline model. -
Method Summary
Modifier and Type Method Description double
calculateLocationForTime(Instant time)
Returns the pixel location of the given time.Instant
calculateTimeForLocation(double location)
Returns the time for the given location.Instant
getHorizonEndTime()
Returns the value ofhorizonEndTimeProperty()
.Instant
getHorizonStartTime()
Returns the value ofhorizonStartTimeProperty()
.double
getMaximumMillisPerPixel()
Returns the value ofmaximumMillisPerPixelProperty()
.double
getMillisPerPixel()
Returns the value ofmillisPerPixelProperty()
.double
getMinimumMillisPerPixel()
Returns the value ofminimumMillisPerPixelProperty()
.Instant
getNow()
Returns the value ofnowProperty()
.double
getNowLocation()
Returns the value ofnowLocationProperty()
.double
getOffset()
Gets the value of the property offset.T
getSmallestTemporalUnit()
Returns the value ofsmallestTemporalUnitProperty()
.Instant
getStartTime()
Returns the value ofstartTimeProperty()
.ObjectProperty<Instant>
horizonEndTimeProperty()
Returns the object property used for storing the end time of the horizon.ObjectProperty<Instant>
horizonStartTimeProperty()
Returns the object property used for storing the start time of the horizon.DoubleProperty
maximumMillisPerPixelProperty()
A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.DoubleProperty
millisPerPixelProperty()
Returns the property used to store the millis per pixel value.DoubleProperty
minimumMillisPerPixelProperty()
A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.ReadOnlyDoubleProperty
nowLocationProperty()
Stores the location of the "now" time.ObjectProperty<Instant>
nowProperty()
Returns the property used to store "now", the current time, e.g.DoubleProperty
offsetProperty()
void
setHorizonEndTime(Instant time)
Sets the value ofhorizonEndTimeProperty()
.void
setHorizonStartTime(Instant time)
Sets the value ofhorizonStartTimeProperty()
.void
setMaximumMillisPerPixel(double max)
Sets the value ofmaximumMillisPerPixelProperty()
.void
setMillisPerPixel(double millis)
Sets the value of themillisPerPixelProperty()
.void
setMinimumMillisPerPixel(double min)
Sets the value ofminimumMillisPerPixelProperty()
.void
setNow(Instant now)
Sets the value ofnowProperty()
.void
setOffset(double offset)
Sets the value of the property offset.void
setStartTime(Instant time)
Sets the value ofstartTimeProperty()
.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.ReadOnlyObjectProperty<T>
smallestTemporalUnitProperty()
Stores the smallest temporal unit supported by the control.ObjectProperty<Instant>
startTimeProperty()
Returns the property used to store the first visible time point.
-
Property Details
-
offset
- See Also:
getOffset()
,setOffset(double)
-
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.- See Also:
getHorizonEndTime()
,setHorizonEndTime(Instant)
-
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.- See Also:
getMillisPerPixel()
,setMillisPerPixel(double)
-
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:
getMinimumMillisPerPixel()
,setMinimumMillisPerPixel(double)
-
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:
getMaximumMillisPerPixel()
,setMaximumMillisPerPixel(double)
-
startTime
Returns the property used to store the first visible time point.- See Also:
getStartTime()
,setStartTime(Instant)
-
now
Returns the property used to store "now", the current time, e.g. the current system time.- See Also:
getNow()
,setNow(Instant)
-
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:
getNowLocation()
-
smallestTemporalUnit
Stores the smallest temporal unit supported by the control.- See Also:
getSmallestTemporalUnit()
-
-
Constructor Details
-
TimelineModel
protected TimelineModel()Constructs a new timeline model.
-
-
Method Details
-
getOffset
public final double getOffset()Gets the value of the property offset.- Property description:
-
offsetProperty
- See Also:
getOffset()
,setOffset(double)
-
setOffset
public final void setOffset(double offset)Sets the value of the property offset.- Property description:
-
horizonStartTimeProperty
Returns the object property used for storing the start time of the horizon. -
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.- See Also:
getHorizonEndTime()
,setHorizonEndTime(Instant)
-
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.- See Also:
getMillisPerPixel()
,setMillisPerPixel(double)
-
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.- Since:
- 1.4
- See Also:
getMinimumMillisPerPixel()
,setMinimumMillisPerPixel(double)
-
setMinimumMillisPerPixel
public final void setMinimumMillisPerPixel(double min)Sets the value ofminimumMillisPerPixelProperty()
.- Parameters:
min
- the minimum MPP value- Since:
- 1.4
- See Also:
setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)
-
getMinimumMillisPerPixel
public final double getMinimumMillisPerPixel()Returns the value ofminimumMillisPerPixelProperty()
.- Returns:
- the minimum MPP value
- Since:
- 1.4
- See Also:
setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)
-
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.- Since:
- 1.4
- See Also:
getMaximumMillisPerPixel()
,setMaximumMillisPerPixel(double)
-
setMaximumMillisPerPixel
public final void setMaximumMillisPerPixel(double max)Sets the value ofmaximumMillisPerPixelProperty()
.- Parameters:
max
- the maximum MPP value- Since:
- 1.4
- See Also:
setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)
-
getMaximumMillisPerPixel
public final double getMaximumMillisPerPixel()Returns the value ofmaximumMillisPerPixelProperty()
.- Returns:
- the maximum MPP value
- Since:
- 1.4
- See Also:
setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)
-
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:
setMinimumMillisPerPixel(double)
,setMaximumMillisPerPixel(double)
-
startTimeProperty
Returns the property used to store the first visible time point.- See Also:
getStartTime()
,setStartTime(Instant)
-
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.- See Also:
getNow()
,setNow(Instant)
-
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.- See Also:
getNowLocation()
-
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.- See Also:
getSmallestTemporalUnit()
-
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
-