com.miginfocom.calendar.grid
Interface GridDimensionLayout

All Known Implementing Classes:
DefaultGridDimensionLayout, TrackingGridDimensionLayout

public interface GridDimensionLayout

A layout that lays out a grid in one dimension.

It should set the size and positions of grid lines as well as the grid rows (aka cell rows, or the cells between the grid lines).

Note that a grid row can itself contain other grid lines and grid rows. This should be handeled for the layout to be complete and be able to layout any type of Grid. If not sub grid rows/lines are handeled the layout should throw an exception if it finds such rows. This check can be made with GridRow.isLeaf().

It is important that the layout only lay out the grid in one dimension, normally set in the constructor.

See Also:
DefaultGridDimensionLayout

Method Summary
 int getDimension()
          Return the dimension this layout is supposed to layout.
 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.
 

Method Detail

layout

void layout(Grid grid)
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.

Parameters:
grid - The grid to lay out. Not null.
See Also:
Grid.getGridRows(int)

getDimension

int getDimension()
Return the dimension this layout is supposed to layout.

Returns:
The dimension to lay out. Either Grid.PRIMARY_DIMENSION or Grid.SECONDARY_DIMENSION.

getMinimumSize

int getMinimumSize(Grid grid)
Return the minimum size, of any is specified.

Parameters:
grid - The grid to return the the size constraint for.
Returns:
The minimum size, of any is specified.

getPreferredSize

java.lang.Integer getPreferredSize(Grid grid)
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.

Parameters:
grid - The grid to return the the size constraint for.
Returns:
The preferred size, of any is specified.

getMaximumSize

java.lang.Integer getMaximumSize(Grid grid)
Return the maximum size for the grid in the laid out dimension.

Parameters:
grid - The grid to return the the size constraint for.
Returns:
The maximum size, of any is specified. null if not specified.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.