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 (normally ChronoUnit or SimpleUnit.
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 Details

  • Constructor Details

    • DatelineModel

      protected DatelineModel()
      Constructs a new model and populates the list of available zone IDs.
      Since:
      1.0
  • Method Details

    • addZoneId

      public final void addZoneId​(String zoneId)
      Adds a ZoneId to the model.
      Parameters:
      zoneId - the zone ID to add
      Since:
      1.0
    • addResolution

      public final void addResolution​(Resolution<T> resolution)
      Adds a resolution to the model.
      Parameters:
      resolution - the resolution to add
      Since:
      1.0
    • removeResolution

      public final void removeResolution​(Resolution<? extends T> resolution)
      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

      public final void clearResolutions​(T temporalUnit)
      Removes all resolutions for the given temporal unit.
      Parameters:
      temporalUnit - the temporal unit for which to remove all resolutions
      Since:
      1.0
    • getTemporalUnits

      public final ObservableList<T> 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

      public final IntegerProperty 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 of scaleCountProperty().
      Returns:
      the scale count
      Since:
      1.0
    • setScaleCount

      public final void setScaleCount​(int count)
      Sets the value of scaleCountProperty().
      Parameters:
      count - the new scale count
      Since:
      1.0
    • maxScaleCountProperty

      public final IntegerProperty 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 of maxScaleCountProperty().
      Parameters:
      count - the new maximum scale count
      Since:
      1.0
    • minScaleCountProperty

      public final IntegerProperty 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 of minScaleCountProperty().
      Returns:
      the minimum scale count
      Since:
      1.0
    • setMinScaleCount

      public final void setMinScaleCount​(int count)
      Sets the value of minScaleCountProperty().
      Parameters:
      count - the new minimum scale count
      Since:
      1.0
    • getAvailableZoneIds

      public final ObservableSet<String> getAvailableZoneIds()
      Returns all ZoneId instances that are available for the user to switch to.
      Returns:
      the available zone IDs
      Since:
      1.0
    • getResolutions

      public final ObservableList<Resolution<? extends T>> getResolutions()
      Returns all resolutions that are defined for / supported by this model.
      Returns:
      the dateline resolutions
      Since:
      1.0
    • getResolutions

      public final Iterator<? extends Resolution<? extends T>> getResolutions​(T temporalUnit)
      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

      public abstract T nextTemporalUnit​(T unit)
      Returns the next larger temporal unit for the given temporal unit, e.g. when passing ChronoUnit.HOURS this method might return ChronoUnit.DAYS.
      Parameters:
      unit - the unit for which to return the next higher unit
      Returns:
      the next higher temporal unit
      Since:
      1.0