Module com.flexganttfx.model
Package com.flexganttfx.model.dateline
Class DatelineModel<T extends TemporalUnit>
java.lang.Object
com.flexganttfx.model.dateline.DatelineModel<T>
- Type Parameters:
T- the type of the temporal unit for which the model is defined (normallyChronoUnitorSimpleUnit.
- Direct Known Subclasses:
ChronoUnitDatelineModel,SimpleUnitDatelineModel
public abstract class DatelineModel<T extends TemporalUnit> extends Object
The dateline model provides the dateline control with various pieces of
information so that it can layout itself correctly.
- Scale Resolutions - a scale resolution defines which temporal unit to show (e.g. HOURS) and how to format it. It also contains the information whether it can be shown in a top, bottom, or middle scale. Each model usually defines a long list of such resolutions. The more resolutions are defined the more flexible the dateline control becomes.
- Time Zones - The dateline control allows the user to switch between different time zones. The model defines which zones are available.
- Scale Count - The dateline control is composed of a set of dateline scales (top, bottom, several middle scales). The model can be used to define the currently visible, the minimum and the maximum number of scales that the user can choose to see.
- Temporal Units - The dateline control calls back onto the model to lookup the "next" temporal unit after it has either failed or succeeded to create a scale for the current unit.
- Since:
- 1.0
-
Property Summary
Properties Type Property Description IntegerPropertymaxScaleCountReturns the property used to store the maximum scale count.IntegerPropertyminScaleCountReturns the property used to store the minimum scale count.IntegerPropertyscaleCountThe property used to store the number of currently visible scales. -
Constructor Summary
Constructors Modifier Constructor Description protectedDatelineModel()Constructs a new model and populates the list of available zone IDs. -
Method Summary
Modifier and Type Method Description voidaddResolution(Resolution<T> resolution)Adds a resolution to the model.voidaddZoneId(String zoneId)Adds aZoneIdto the model.voidclearResolutions()Removes all resolutions from the model.voidclearResolutions(T temporalUnit)Removes all resolutions for the given temporal unit.ObservableSet<String>getAvailableZoneIds()Returns allZoneIdinstances that are available for the user to switch to.intgetMaxScaleCount()Returns the value of the maximum scale count property.intgetMinScaleCount()Returns the value ofminScaleCountProperty().ObservableList<Resolution<? extends T>>getResolutions()Returns all resolutions that are defined for / supported by this model.Iterator<? extends Resolution<? extends T>>getResolutions(T temporalUnit)Returns all resolutions that are available for the given temporal unit.intgetScaleCount()Returns the value ofscaleCountProperty().ObservableList<T>getTemporalUnits()Returns all temporal units that are being used by the model.IntegerPropertymaxScaleCountProperty()Returns the property used to store the maximum scale count.IntegerPropertyminScaleCountProperty()Returns the property used to store the minimum scale count.abstract TnextTemporalUnit(T unit)Returns the next larger temporal unit for the given temporal unit, e.g.voidremoveResolution(Resolution<? extends T> resolution)Removes a resolution from the model.IntegerPropertyscaleCountProperty()The property used to store the number of currently visible scales.voidsetMaxScaleCount(int count)Sets the value ofmaxScaleCountProperty().voidsetMinScaleCount(int count)Sets the value ofminScaleCountProperty().voidsetScaleCount(int count)Sets the value ofscaleCountProperty().
-
Property Details
-
scaleCount
The property used to store the number of currently visible scales.- Since:
- 1.0
- See Also:
getScaleCount(),setScaleCount(int)
-
maxScaleCount
Returns the property used to store the maximum scale count.- Since:
- 1.0
- See Also:
getMaxScaleCount(),setMaxScaleCount(int)
-
minScaleCount
Returns the property used to store the minimum scale count.- Since:
- 1.0
- See Also:
getMinScaleCount(),setMinScaleCount(int)
-
-
Constructor Details
-
DatelineModel
protected DatelineModel()Constructs a new model and populates the list of available zone IDs.- Since:
- 1.0
-
-
Method Details
-
addZoneId
Adds aZoneIdto the model.- Parameters:
zoneId- the zone ID to add- Since:
- 1.0
-
addResolution
Adds a resolution to the model.- Parameters:
resolution- the resolution to add- Since:
- 1.0
-
removeResolution
Removes a resolution from the model.- Parameters:
resolution- the resolution that will be removed- Since:
- 1.0
-
clearResolutions
public final void clearResolutions()Removes all resolutions from the model.- Since:
- 1.0
-
clearResolutions
Removes all resolutions for the given temporal unit.- Parameters:
temporalUnit- the temporal unit for which to remove all resolutions- Since:
- 1.0
-
getTemporalUnits
Returns all temporal units that are being used by the model.- Returns:
- the list of temporal units used by the model
- Since:
- 1.0
-
scaleCountProperty
The property used to store the number of currently visible scales.- Since:
- 1.0
- See Also:
getScaleCount(),setScaleCount(int)
-
getScaleCount
public final int getScaleCount()Returns the value ofscaleCountProperty().- Returns:
- the scale count
- Since:
- 1.0
-
setScaleCount
public final void setScaleCount(int count)Sets the value ofscaleCountProperty().- Parameters:
count- the new scale count- Since:
- 1.0
-
maxScaleCountProperty
Returns the property used to store the maximum scale count.- Since:
- 1.0
- See Also:
getMaxScaleCount(),setMaxScaleCount(int)
-
getMaxScaleCount
public final int getMaxScaleCount()Returns the value of the maximum scale count property.- Returns:
- the maximum scale count
- Since:
- 1.0
-
setMaxScaleCount
public final void setMaxScaleCount(int count)Sets the value ofmaxScaleCountProperty().- Parameters:
count- the new maximum scale count- Since:
- 1.0
-
minScaleCountProperty
Returns the property used to store the minimum scale count.- Since:
- 1.0
- See Also:
getMinScaleCount(),setMinScaleCount(int)
-
getMinScaleCount
public final int getMinScaleCount()Returns the value ofminScaleCountProperty().- Returns:
- the minimum scale count
- Since:
- 1.0
-
setMinScaleCount
public final void setMinScaleCount(int count)Sets the value ofminScaleCountProperty().- Parameters:
count- the new minimum scale count- Since:
- 1.0
-
getAvailableZoneIds
Returns allZoneIdinstances that are available for the user to switch to.- Returns:
- the available zone IDs
- Since:
- 1.0
-
getResolutions
Returns all resolutions that are defined for / supported by this model.- Returns:
- the dateline resolutions
- Since:
- 1.0
-
getResolutions
Returns all resolutions that are available for the given temporal unit.- Parameters:
temporalUnit- the temporal unit for which resolutions are looked up- Returns:
- the available resolutions for the given temporal unit
- Since:
- 1.0
-
nextTemporalUnit
Returns the next larger temporal unit for the given temporal unit, e.g. when passingChronoUnit.HOURSthis method might returnChronoUnit.DAYS.- Parameters:
unit- the unit for which to return the next higher unit- Returns:
- the next higher temporal unit
- Since:
- 1.0
-