com.dlsc.flexgantt.policy.layer
Interface IGridPolicy<T extends IGranularity>

Type Parameters:
T - the type of granularity supported by the policy
All Superinterfaces:
IPolicy
All Known Implementing Classes:
AbstractGridPolicy, SimpleGranularityGridPolicy, TimeGranularityGridPolicy

public interface IGridPolicy<T extends IGranularity>
extends IPolicy

A policy for dealing with a virtual grid. The policy translates coordinates to new coordinates that snap to grid locations.

Since:
1.0
Author:
Dirk Lemmermann

Method Summary
 long getGridAdjustedEndTime(T granularity, long unadjustedEndTime, IDatelineModel<T> datelineModel, boolean autoGrid)
          Returns a grid adjusted time point for the given unadjusted end time.
 long getGridAdjustedStartTime(T granularity, long unadjustedStartTime, IDatelineModel<T> datelineModel, boolean autoGrid)
          Returns a grid adjusted time point for the given unadjusted start time.
 ITimeSpan getGridAdjustedTimeSpan(T granularity, ITimeSpan unadjustedTimeSpan, IDatelineModel<T> datelineModel, boolean autoGrid)
          Returns a grid adjusted time span for the given unadjusted time span.
 T[] getGridGranularities()
          Returns the granularities that will be available for the grid.
 

Method Detail

getGridGranularities

T[] getGridGranularities()
Returns the granularities that will be available for the grid.

Returns:
the grid granularities
Since:
1.0

getGridAdjustedStartTime

long getGridAdjustedStartTime(T granularity,
                              long unadjustedStartTime,
                              IDatelineModel<T> datelineModel,
                              boolean autoGrid)
Returns a grid adjusted time point for the given unadjusted start time. How the adjustment happens depends on the policy implementation.

Parameters:
granularity - the granularity for which to return an adjusted time point
unadjustedStartTime - the original time that needs adjustment
datelineModel - the model used by the dateline (needed for the auto grid feature)
autoGrid - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
Returns:
a grid adjusted start time
Since:
1.0

getGridAdjustedEndTime

long getGridAdjustedEndTime(T granularity,
                            long unadjustedEndTime,
                            IDatelineModel<T> datelineModel,
                            boolean autoGrid)
Returns a grid adjusted time point for the given unadjusted end time. How the adjustment happens depends on the policy implementation.

Parameters:
granularity - the granularity for which to return an adjusted time point
unadjustedEndTime - the original time that needs adjustment
datelineModel - the model used by the dateline (needed for the auto grid feature)
autoGrid - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
Returns:
a grid adjusted end time
Since:
1.0

getGridAdjustedTimeSpan

ITimeSpan getGridAdjustedTimeSpan(T granularity,
                                  ITimeSpan unadjustedTimeSpan,
                                  IDatelineModel<T> datelineModel,
                                  boolean autoGrid)
Returns a grid adjusted time span for the given unadjusted time span. How the adjustment happens depends on the policy implementation.

Parameters:
granularity - the granularity for which to return an adjusted time point
unadjustedTimeSpan - the original time span that needs adjustment
datelineModel - the model used by the dateline (needed for the auto grid feature)
autoGrid - if TRUE the grid calculations will be based on the minor granularity shown by the dateline
Returns:
a grid adjusted time span
Since:
1.0