com.miginfocom.calendar.header
Class DateHeaderGrid

java.lang.Object
  extended by com.miginfocom.calendar.grid.AbstractGrid
      extended by com.miginfocom.calendar.header.HeaderGrid
          extended by com.miginfocom.calendar.header.DateHeaderGrid
All Implemented Interfaces:
Grid, java.beans.PropertyChangeListener, java.util.EventListener

public class DateHeaderGrid
extends HeaderGrid

A header grid designed for labels that are based upon dates and date ranges.


Field Summary
protected  int[] rangeTypes
           
 
Fields inherited from interface com.miginfocom.calendar.grid.Grid
OUTLINE_SHAPE_MODE_EXACT, OUTLINE_SHAPE_MODE_EXACT_CLIPPED, OUTLINE_SHAPE_MODE_POLYGON, OUTLINE_SHAPE_MODE_RECTANGLE, PRIMARY_DIMENSION, SECONDARY_DIMENSION, SIZE_MODE_INSIDE, SIZE_MODE_MIDDLE, SIZE_MODE_OUTSIDE, SIZE_MODE_UPPER_LEFT
 
Constructor Summary
DateHeaderGrid(DateGrid trkGrid, int primDim, int[] rangeTypes, GridLineSpecification gridLineSpec)
          Constructor.
 
Method Summary
 ImmutableDateRange getCellDateRange(DateCellRange cellRange, boolean includeTemp, boolean useSt)
          Returns the date range for the cell range.
 DateCellRange getMergeRange(int r, int c, boolean useStartDate)
          Should return a range that is in some way interconnected.
 
Methods inherited from class com.miginfocom.calendar.header.HeaderGrid
createGridLinesAndCellRows, getDateRange, getLabelRowCount, getPrimaryDimOffset, getTrackedGrid, setPrimaryDimOffset
 
Methods inherited from class com.miginfocom.calendar.grid.AbstractGrid
addPropertyListener, addPropertyListener, assertSize, firePropertyChangeEvent, getAbsolutePreferredHeight, getAbsolutePreferredWidth, getBoundingBox, getBoundsOfCell, getCell, getCellCount, getCellNumber, getCellsOutline, getColumnCount, getColumnDimIx, getColumnForX, getColumnGridLines, getColumns, getGridLines, getGridLineSpecification, getGridRows, getHeight, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOrientationForDimIx, getPercentInsideColumn, getPercentInsideRow, getPrimaryDimension, getPrimaryDimensionLayout, getRelPos, getRowAt, getRowAt, getRowCount, getRowDimIx, getRowForY, getRowGridLines, getRowIndexForPos, getRows, getSecondaryDimensionLayout, getSize, getSize, getWidth, getX, getY, isIgnorePropertyEvents, layout, propertyChange, removePropertyListener, setCellRows, setGridLines, setIgnorePropertyEvents, setPrimaryDimensionLayout, setSecondaryDimensionLayout, setSize, toPos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rangeTypes

protected int[] rangeTypes
Constructor Detail

DateHeaderGrid

public DateHeaderGrid(DateGrid trkGrid,
                      int primDim,
                      int[] rangeTypes,
                      GridLineSpecification gridLineSpec)
Constructor.

Parameters:
trkGrid - The grid to be a header for
primDim - The primary dimension if this header. Does NOT have to be same as for trkGrid!
rangeTypes - The different date ranges (E.g. DateRangeI.RANGE_TYPE_DAY for the label rows. One range type for every row. Number of rows will be rangeTypes.length. See MutableDateRange.roundExpand(int).
gridLineSpec - The specification for the grid lines in the primary and secondary dimensins. Not null.
Method Detail

getMergeRange

public DateCellRange getMergeRange(int r,
                                   int c,
                                   boolean useStartDate)
Should return a range that is in some way interconnected. This can be compared to merging cells to pose as one.

The returned DateCellRange will have a userObject that is a ImmutableDateRange and that represents the date range of the returned DateCellRange.

Note that the returned range can in the horizontal OR vertical dimension, but not both. This means that cells can only be merged in one dimension.

Parameters:
r - The row
c - The column
useStartDate - If the start or end date of the cell row should be used. AtStart dates when left or top and end dates when lower or right of the tracked grid.
Returns:
The range of merged cells that c and r hits. The range can be just one cell. Not null.

getCellDateRange

public ImmutableDateRange getCellDateRange(DateCellRange cellRange,
                                           boolean includeTemp,
                                           boolean useSt)
Returns the date range for the cell range.

Parameters:
cellRange - The cell range. Not null.
includeTemp - If the temporary union in cellRange should be included.
useSt - If the start or end date of the cell row shoule be used. start dates when left/top and end dates when lower/right of the tracked grid.
Returns:
The date range for the cell range.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.