com.miginfocom.calendar.grid
Class GridLineSpecification

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

public class GridLineSpecification
extends java.lang.Object
implements GridLineProvider

A specification on how the grid lines will look like and the size of them.

This class holds the GridLineProvider for primary and secondary dimension as well as an arbitrary number of sub dimensions.

Any provider set to null will get this as the provider, whcih creates 0-size grid lines with the paint set to null.


Constructor Summary
GridLineSpecification(GridLineProvider primProv, GridLineProvider secProv)
          Constructor for no sub specs.
GridLineSpecification(GridLineProvider primProv, GridLineProvider secProv, GridLineProvider subProv)
          Constructor for only one sub spec.
GridLineSpecification(int size, java.awt.Paint paint)
          Convenience 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.
 GridLineProvider getPrimaryDimensionProvider()
          Returns the provider for the primary dimension.
 GridLineProvider getProvider(int dimIx)
          Returns the primary or secondary provider.
 GridLineProvider getSecondaryDimensionProvider()
          Returns the provider for the secondary dimension.
 GridLineProvider getSubDimensionProvider()
          Returns the provider for the sub rows, which can only exist in the secondary dimension dimension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridLineSpecification

public GridLineSpecification(int size,
                             java.awt.Paint paint)
Convenience constructor. No sub row grid lines.

Parameters:
size - The grid line size for buth primary and secondary dimension.
paint - The paint that is hinted to be used to draw the grid lines.

GridLineSpecification

public GridLineSpecification(GridLineProvider primProv,
                             GridLineProvider secProv)
Constructor for no sub specs.

Parameters:
primProv - The grid line provider for the primary dimension. Can be null which set this as the provider, providing 0-size, null-paint grid lines.
secProv - The grid line provider for the secondary dimension. Can be null which set this as the provider, providing 0-size, null-paint grid lines.

GridLineSpecification

public GridLineSpecification(GridLineProvider primProv,
                             GridLineProvider secProv,
                             GridLineProvider subProv)
Constructor for only one sub spec.

Parameters:
primProv - The grid line provider for the primary dimension. Can be null which set this as the provider, providing 0-size, null-paint grid lines.
secProv - The grid line provider for the secondary dimension. Can be null which set this as the provider, providing 0-size, null-paint grid lines.
subProv - The grid line provider for all sub specs. Can be null which set this as the provider, providing 0-size, null-paint grid lines.
Method Detail

getProvider

public GridLineProvider getProvider(int dimIx)
Returns the primary or secondary provider.

Parameters:
dimIx - The dimension. E.g. Grid.PRIMARY_DIMENSION.
Returns:
The primary or secondary provider. Never null but can be this.

getPrimaryDimensionProvider

public GridLineProvider getPrimaryDimensionProvider()
Returns the provider for the primary dimension.

Returns:
The provider for the primary dimension. Never null but can be this.

getSecondaryDimensionProvider

public GridLineProvider getSecondaryDimensionProvider()
Returns the provider for the secondary dimension.

Returns:
The provider for the secondary dimension. Never null but can be this.

getSubDimensionProvider

public GridLineProvider getSubDimensionProvider()
Returns the provider for the sub rows, which can only exist in the secondary dimension dimension.

Returns:
The provider for the sub rows. Never null but can be this.

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.