com.miginfocom.calendar.grid
Class DefaultGridDimensionLayout

java.lang.Object
  extended by com.miginfocom.calendar.grid.DefaultGridDimensionLayout
All Implemented Interfaces:
GridDimensionLayout

public class DefaultGridDimensionLayout
extends java.lang.Object
implements GridDimensionLayout

The default grid layout.

Will use the GridSegmentSpec and GridLineProvider to lay out the man grid lines and grid rows. All sub rows will evenly split the size of the main row. All sub folder rows will exactly span the size of thieir chold rows.

This layout will always leave the grid line sizes as they are. They are normally set at construction time and will not change.


Constructor Summary
DefaultGridDimensionLayout(int dimIx, GridSegmentSpec mainRowSegmentSpec, boolean toBounds)
          Constructor.
DefaultGridDimensionLayout(int dimIx, GridSegmentSpec mainRowSegmentSpec, GridRowLayout subRowLayout, boolean toBounds)
          Constructor.
DefaultGridDimensionLayout(int dimIx, GridSegmentSpec mainRowSegmentSpec, int subGridRowSize, boolean toBounds)
          Constructor.
 
Method Summary
 int getDimension()
          Return the dimension this layout is supposed to layout.
 GridSegmentSpec getMainRowSegmentSpec()
          Return The specification on how to size the main grid cells.
 java.lang.Integer getMaximumSize(Grid grid)
          Return the maximum size for the grid in the laid out dimension.
 int getMinimumSize(Grid grid)
          Return the minimum size, of any is specified.
 java.lang.Integer getPreferredSize(Grid grid)
          Return the preferred size, of any is specified.
 void layout(Grid grid)
          Lay out the grid in the dimension that this object is handling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGridDimensionLayout

public DefaultGridDimensionLayout(int dimIx,
                                  GridSegmentSpec mainRowSegmentSpec,
                                  boolean toBounds)
Constructor.

Parameters:
dimIx - The dimension to lay out. Either Grid.PRIMARY_DIMENSION or Grid.SECONDARY_DIMENSION.
mainRowSegmentSpec - The specification on how to size the grid cells.
toBounds - If the layed out size should try to sum up to the available size. See toBounds in GridUtil.getCellSizes(GridRow[], GridRowLayout, GridSegmentSpec, int, boolean)

DefaultGridDimensionLayout

public DefaultGridDimensionLayout(int dimIx,
                                  GridSegmentSpec mainRowSegmentSpec,
                                  int subGridRowSize,
                                  boolean toBounds)
Constructor.

Parameters:
dimIx - The dimension to lay out. Either Grid.PRIMARY_DIMENSION or Grid.SECONDARY_DIMENSION.
mainRowSegmentSpec - The specification on how to size the grid cells.
subGridRowSize - The size in pixels that all sub grid rows will get. See DefaultGridRowLayout
toBounds - If the layed out size should try to sum up to the available size. See toBounds in GridUtil.getCellSizes(GridRow[], GridRowLayout, GridSegmentSpec, int, boolean)

DefaultGridDimensionLayout

public DefaultGridDimensionLayout(int dimIx,
                                  GridSegmentSpec mainRowSegmentSpec,
                                  GridRowLayout subRowLayout,
                                  boolean toBounds)
Constructor.

Parameters:
dimIx - The dimension to lay out. Either Grid.PRIMARY_DIMENSION or Grid.SECONDARY_DIMENSION.
mainRowSegmentSpec - The specification on how to size the grid cells.
subRowLayout - Optional layout that lays out the sub rows of the main rows that this layout lays out. If null all sub grid rows will be given equal size.
toBounds - If the layed out size should try to sum up to the available size. See toBounds in GridUtil.getCellSizes(GridRow[], GridRowLayout, GridSegmentSpec, int, boolean)
Method Detail

layout

public void layout(Grid grid)
Description copied from interface: GridDimensionLayout
Lay out the grid in the dimension that this object is handling.

This is normally done by calling grid.getGridRows(dimIx) and grid.getGridLines(dimIx) and setting the size and position for those.

Specified by:
layout in interface GridDimensionLayout
Parameters:
grid - The grid to lay out. Not null.
See Also:
Grid.getGridRows(int)

getMinimumSize

public int getMinimumSize(Grid grid)
Description copied from interface: GridDimensionLayout
Return the minimum size, of any is specified.

Specified by:
getMinimumSize in interface GridDimensionLayout
Parameters:
grid - The grid to return the the size constraint for.
Returns:
The minimum size, of any is specified.

getPreferredSize

public java.lang.Integer getPreferredSize(Grid grid)
Description copied from interface: GridDimensionLayout
Return the preferred size, of any is specified. If the preferred size is expressed as relative (see GridSegmentSpec) this method will return null since an absolute size can't be calculated.

Specified by:
getPreferredSize in interface GridDimensionLayout
Parameters:
grid - The grid to return the the size constraint for.
Returns:
The preferred size, of any is specified.

getMaximumSize

public java.lang.Integer getMaximumSize(Grid grid)
Description copied from interface: GridDimensionLayout
Return the maximum size for the grid in the laid out dimension.

Specified by:
getMaximumSize in interface GridDimensionLayout
Parameters:
grid - The grid to return the the size constraint for.
Returns:
The maximum size, of any is specified. null if not specified.

getDimension

public int getDimension()
Description copied from interface: GridDimensionLayout
Return the dimension this layout is supposed to layout.

Specified by:
getDimension in interface GridDimensionLayout
Returns:
The dimension to lay out. Either Grid.PRIMARY_DIMENSION or Grid.SECONDARY_DIMENSION.

getMainRowSegmentSpec

public GridSegmentSpec getMainRowSegmentSpec()
Return The specification on how to size the main grid cells.

Returns:
The specification on how to size the main grid cells.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.