com.miginfocom.calendar.grid
Class SubRowGridLineProvider

java.lang.Object
  extended by com.miginfocom.calendar.grid.SubRowGridLineProvider
All Implemented Interfaces:
GridLineProvider

public class SubRowGridLineProvider
extends java.lang.Object
implements GridLineProvider

A class that holds sizes (widths) and other properties of grid lines in one dimension in a very flexible way. The class is immutable and does some caching of the values.


Constructor Summary
SubRowGridLineProvider(boolean showFirst, boolean showLast, GridLine spec, boolean removeFirstLeafGridLine)
          Constructor.
SubRowGridLineProvider(int size, java.awt.Paint paint, boolean removeFirstLeafGridLine)
          Constructor.
 
Method Summary
 int configureGridLines(GridRow[] rows, GridLine[] gridLines)
          Configures the grid lines.
 GridLine[] createGridLines(GridRow[] rows)
          Returns the grid lines between and around the rows.
 int getGridLinesSize(GridRow[] rows)
          Returns the total size of the grid lines for the given rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubRowGridLineProvider

public SubRowGridLineProvider(int size,
                              java.awt.Paint paint,
                              boolean removeFirstLeafGridLine)
Constructor.

Parameters:
size - The size of the grid lines in pixels. Normally 0 or 1.
paint - The paint used o draw the grid lines. Normally a Color.
removeFirstLeafGridLine - If the grid line before the first sub row leaf in a sub row tree hierarchy should be removed to avoid duplicate grid lines.

SubRowGridLineProvider

public SubRowGridLineProvider(boolean showFirst,
                              boolean showLast,
                              GridLine spec,
                              boolean removeFirstLeafGridLine)
Constructor.

Parameters:
showFirst - If the first grid line should be visible.
showLast - If the last grid line should be visible.
spec - An example gridl line that will be used as the templated when creating new grid lines. See GridLine.cloneGridLine().
removeFirstLeafGridLine - If the grid line before the first sub row leaf in a sub row tree hierarchy should be removed to avoid duplicate grid lines.
Method Detail

createGridLines

public GridLine[] createGridLines(GridRow[] rows)
Description copied from interface: GridLineProvider
Returns the grid lines between and around the rows.

Specified by:
createGridLines in interface GridLineProvider
Parameters:
rows - The rows to have the grid lines around.
Returns:
The grid lines for decorating around the grid rows. Always one more that the row count.

configureGridLines

public int configureGridLines(GridRow[] rows,
                              GridLine[] gridLines)
Description copied from interface: GridLineProvider
Configures the grid lines.

Specified by:
configureGridLines in interface GridLineProvider
Parameters:
rows - Some rows for which grid lines has previously been created with this provider.
gridLines - The grid lines to configure.
Returns:
The size of the grid lines.

getGridLinesSize

public int getGridLinesSize(GridRow[] rows)
Description copied from interface: GridLineProvider
Returns the total size of the grid lines for the given rows.

If the same rows are passed into GridLineProvider.createGridLines(GridRow[]) those's size must be the same as the returned size from this method.

Specified by:
getGridLinesSize in interface GridLineProvider
Parameters:
rows - The rows.
Returns:
The total size of the grid lines.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.