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>horizonEndTimeReturns the object property used for storing the end time of the horizon.ObjectProperty<Instant>horizonStartTimeReturns the object property used for storing the start time of the horizon.DoublePropertymaximumMillisPerPixelA property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.DoublePropertymillisPerPixelReturns the property used to store the millis per pixel value.DoublePropertyminimumMillisPerPixelA property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.ReadOnlyDoublePropertynowLocationStores the location of the "now" time.ObjectProperty<Instant>nowReturns the property used to store "now", the current time, e.g.DoublePropertyoffsetReadOnlyObjectProperty<T>smallestTemporalUnitStores the smallest temporal unit supported by the control.ObjectProperty<Instant>startTimeReturns the property used to store the first visible time point. -
Constructor Summary
Constructors Modifier Constructor Description protectedTimelineModel()Constructs a new timeline model. -
Method Summary
Modifier and Type Method Description doublecalculateLocationForTime(Instant time)Returns the pixel location of the given time.InstantcalculateTimeForLocation(double location)Returns the time for the given location.InstantgetHorizonEndTime()Returns the value ofhorizonEndTimeProperty().InstantgetHorizonStartTime()Returns the value ofhorizonStartTimeProperty().doublegetMaximumMillisPerPixel()Returns the value ofmaximumMillisPerPixelProperty().doublegetMillisPerPixel()Returns the value ofmillisPerPixelProperty().doublegetMinimumMillisPerPixel()Returns the value ofminimumMillisPerPixelProperty().InstantgetNow()Returns the value ofnowProperty().doublegetNowLocation()Returns the value ofnowLocationProperty().doublegetOffset()Gets the value of the property offset.TgetSmallestTemporalUnit()Returns the value ofsmallestTemporalUnitProperty().InstantgetStartTime()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.DoublePropertymaximumMillisPerPixelProperty()A property used to store the maximum number of milliseconds that will be represented by a single pixel on the screen.DoublePropertymillisPerPixelProperty()Returns the property used to store the millis per pixel value.DoublePropertyminimumMillisPerPixelProperty()A property used to store the minimum number of milliseconds that will be represented by a single pixel on the screen.ReadOnlyDoublePropertynowLocationProperty()Stores the location of the "now" time.ObjectProperty<Instant>nowProperty()Returns the property used to store "now", the current time, e.g.DoublePropertyoffsetProperty()voidsetHorizonEndTime(Instant time)Sets the value ofhorizonEndTimeProperty().voidsetHorizonStartTime(Instant time)Sets the value ofhorizonStartTimeProperty().voidsetMaximumMillisPerPixel(double max)Sets the value ofmaximumMillisPerPixelProperty().voidsetMillisPerPixel(double millis)Sets the value of themillisPerPixelProperty().voidsetMinimumMillisPerPixel(double min)Sets the value ofminimumMillisPerPixelProperty().voidsetNow(Instant now)Sets the value ofnowProperty().voidsetOffset(double offset)Sets the value of the property offset.voidsetStartTime(Instant time)Sets the value ofstartTimeProperty().voidsetZoomRange(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
-