com.miginfocom.calendar.header
Class HeaderGrid

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

public class HeaderGrid
extends AbstractGrid

A Grid that lays out its cells in one dimension after another grid. Used to keep a label grid in-sync with the layout of the tracked grid in one dimension and lays out the other (secondary) dimension itself, depending on given size and the number on label rows.

The bounds of this grid should be set so it matches the tracked one in one (primary) dimension and to the disired size in the other (secondary).

Can for instance be embedded in a DateGridHeader.


Field Summary
 
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
HeaderGrid(DateGrid trkGrid, int primDim, int rowCount, GridLineSpecification gridLineSpec)
          Constructor.
 
Method Summary
protected  void createGridLinesAndCellRows()
          Creates grid lines and cell rows after the tracked grid line.
 ImmutableDateRange getDateRange()
          Returns the date range for the grid that it is header for.
 int getLabelRowCount()
           
 int getPrimaryDimOffset()
          Returns the start offset in pixels between the tracked grid and this header's grid.
 DateGrid getTrackedGrid()
          Returns the grid that this header is header for.
 void setPrimaryDimOffset(int primDimOffset)
          Sets the start offset in pixels between the tracked grid and this header's grid.
 
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
 

Constructor Detail

HeaderGrid

public HeaderGrid(DateGrid trkGrid,
                  int primDim,
                  int rowCount,
                  GridLineSpecification gridLineSpec)
Constructor.

Parameters:
trkGrid - The grid to be a header for
primDim - The primary dimension if this header. Does NOT have to same as for trkGrid!
rowCount - The number of rows in the dimension that is not dependent on the trkCrid. Usually 1-3. This is also always the secondary dimension.
gridLineSpec - The specification for the grid lines in the primary and secondary dimensins. Not null.
Method Detail

getLabelRowCount

public int getLabelRowCount()

getDateRange

public ImmutableDateRange getDateRange()
Returns the date range for the grid that it is header for.

Returns:
The date range for the grid that it is header for.

getTrackedGrid

public DateGrid getTrackedGrid()
Returns the grid that this header is header for.

Returns:
The grid that this header is header for.

getPrimaryDimOffset

public int getPrimaryDimOffset()
Returns the start offset in pixels between the tracked grid and this header's grid. Since grids doesn't have a position (only size) this value must be provided since a header's startx/y might not equal that of the date area (or rather its grid).

For instance if the north header is expanded into the top-left corner the offset should be the width of the corner (which in turn normally will be the width of the west header).

Returns:
The start offset in pixels between the tracked grid and this header's grid.

setPrimaryDimOffset

public void setPrimaryDimOffset(int primDimOffset)
Sets the start offset in pixels between the tracked grid and this header's grid. Since grids doesn't have a position (only size) this value must be provided since a header's startx/y might not equal that of the date area (or rather its grid).

For instance if the north header is expanded into the top-left corner the offset should be the width of the corner (which in turn normally will be the width of the west header).

This value must be set or the header grid (which means the header labels or decorations) will be out of alignment, typically to the left or too high.

Parameters:
primDimOffset - The start offset in pixels between the tracked grid and this header's grid.

createGridLinesAndCellRows

protected void createGridLinesAndCellRows()
Creates grid lines and cell rows after the tracked grid line.

Specified by:
createGridLinesAndCellRows in class AbstractGrid


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.