JIDE 3.5.15

com.jidesoft.scale
Interface ScaleModel<T>

Type Parameters:
T - The type of the bases unit of the scale, for example Date or Integer.
All Known Implementing Classes:
AbstractScaleModel, DateScaleModel, NumberScaleModel

public interface ScaleModel<T>

A ScaleModel holds the different scales which the ScaleArea of a GanttChart can show. The model provides functions to map an instant in the base unit to a position on a long scale.


Method Summary
 T getDefaultEnd()
           
 T getDefaultStart()
           
 T getInstantAt(long position)
          Maps the position to a instant on the scale.
 List<T> getPeriodBoundaries(Period period, T startInstant, T endInstant)
          Calculates the periods start/end instants which completely include the specified start and end instant.
 T getPeriodEnd(Period period, T instant)
          This method returns the end of period in which the instant falls, which is the start instant of the next period.
 List<Period> getPeriods()
          The returned list should contain at least one Period.
 T getPeriodStart(Period period, T instant)
           
 long getPosition(T instant)
          Maps the unit to a long so it can be gives a position in the UI.
 

Method Detail

getDefaultStart

T getDefaultStart()
Returns:
a reasonable start instant when showing an empty gantt chart.

getDefaultEnd

T getDefaultEnd()
Returns:
a reasonable end instant when showing an empty gantt chart.

getPosition

long getPosition(T instant)
Maps the unit to a long so it can be gives a position in the UI.

Parameters:
instant - The instant to get the position for.
Returns:
the position of the instant on the scale.

getInstantAt

T getInstantAt(long position)
Maps the position to a instant on the scale.

Parameters:
position - The position to get the instant for.
Returns:
the instant at the specified position on the scale.

getPeriodStart

T getPeriodStart(Period period,
                 T instant)
Parameters:
period - A period which was returned from getPeriods().
instant - The instant to get the period start for.
Returns:
the instant on or before the specified instant which marks a start of the specified period type.

getPeriodEnd

T getPeriodEnd(Period period,
               T instant)
This method returns the end of period in which the instant falls, which is the start instant of the next period. This means that calling getPeriodStart on a periodEnd should return the same instant.
T periodEnd = getPeriodsEnd(period, instant);
 assertTrue(periodEnd == getPeriodStart(period, periodEnd));

Parameters:
period - A period which was returned from getPeriods().
instant - The instant to get the period end for.
Returns:
the instant on or after the specified instant which marks a end of the specified period type.

getPeriodBoundaries

List<T> getPeriodBoundaries(Period period,
                            T startInstant,
                            T endInstant)
Calculates the periods start/end instants which completely include the specified start and end instant. This means the first and last instant in the returned list are smaller or equal respectively greater or equal to the given start and end instant.

Parameters:
period - The period for when the start and end instants should be calculated.
startInstant - The start instant.
endInstant - The end instant.
Returns:
the instants where a periods start and the previous period ended.

getPeriods

List<Period> getPeriods()
The returned list should contain at least one Period. The list should be ordered from smaller to larger Periods.

Returns:
the different scales of this model.

JIDE 3.5.15