com.miginfocom.calendar.header
Class CellDecorationRow

java.lang.Object
  extended by com.miginfocom.calendar.header.CellDecorationRow
All Implemented Interfaces:
java.io.Serializable

public class CellDecorationRow
extends java.lang.Object
implements java.io.Serializable

A simple data holder class for the specification of ONE ROW to a HeaderAShapeGridDecorator. Even though the elements of the fields can be changed they should not.

The class is to be considered immutal.

See Also:
Serialized Form

Field Summary
static int MOUSE_OVER
          Index in the arrays.
static int NORMAL
          Index in the arrays.
static int PRESSED
          Index in the arrays.
 
Constructor Summary
CellDecorationRow(int mergeBoundaryType, DateFormatList dateFormats, AtRefNumber size, java.awt.Font font)
          Constructor when there in no underline and centered labels.
CellDecorationRow(int mergeBoundaryType, DateFormatList dateFormats, AtRefNumber size, PlaceRect cellLabelBounds, java.awt.Paint[] cellBg, java.awt.Paint[] labelFg, DefaultRepetition labelRep, java.awt.Font[] font, java.lang.Integer[] ulWidth, AtRefRangeNumber alignX, AtRefRangeNumber alignY)
          Constructor.
CellDecorationRow(int mergeBoundaryType, DateFormatList dateFormats, AtRefNumber size, PlaceRect cellLabelBounds, java.awt.Paint cellBg, java.awt.Paint labelFg, DefaultRepetition labelRep, java.awt.Font font)
          Constructor when there in no underline and centered labels.
CellDecorationRow(int mergeBoundaryType, DateFormatList dateFormats, AtRefNumber size, PlaceRect cellLabelBounds, java.awt.Paint cellBg, java.awt.Paint labelFg, DefaultRepetition labelRep, java.awt.Font font, java.lang.Integer underlineWidth, AtRefRangeNumber alignX, AtRefRangeNumber alignY)
          Constructor when there in no difference for normal/mouseOver/Pressed.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 AtRefRangeNumber getAlignX()
          Returns the horizontal alignment (docking).
 AtRefRangeNumber getAlignY()
          Returns the vertical alignment (docking).
 java.awt.Paint[] getCellBackground()
          Returns the backgrounds for the cell.
 PlaceRect getCellLabelBounds()
          How much of every cell that should be available for the label.
 DateFormatList getDateFormats()
          Returns the date formats.
 java.awt.Font[] getFont()
          Returns the fonts for the label.
 java.awt.Paint[] getLabelForeground()
          Returns forgrounds for the label.
 DefaultRepetition getLabelRepetition()
          Returns the specification for the repetition constraint for painting the labels.
 int getMergeBoundaryType()
          Returns at what date boundary (E.g.
 AtRefNumber getSize()
          The size for this row.
 java.lang.Integer[] getUnderlineWidth()
          Returns the underlines width or null for no underline.
 boolean hasMouseEffects()
          Returns if this row should have a different appearence be possible depending on mouse over/press.
 boolean isPaintLabel(int n, int count)
          Returns if the label at this row applies to the suggested index with count size.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORMAL

public static final int NORMAL
Index in the arrays.

See Also:
Constant Field Values

MOUSE_OVER

public static final int MOUSE_OVER
Index in the arrays.

See Also:
Constant Field Values

PRESSED

public static final int PRESSED
Index in the arrays.

See Also:
Constant Field Values
Constructor Detail

CellDecorationRow

public CellDecorationRow(int mergeBoundaryType,
                         DateFormatList dateFormats,
                         AtRefNumber size,
                         java.awt.Font font)
Constructor when there in no underline and centered labels.

Parameters:
mergeBoundaryType - At what date boundary (E.g. DateRangeI.RANGE_TYPE_WEEK cells in this row should be merged.
dateFormats - The dateformats to use. From longer to shorter versions. dateFormats[longer to shorter representations].
The index is iterated from 0 and upwards until a (formatted) string is found that fit the label bounds. Since this "testing" of string lengths can be computationally expensive the sizes to use the different dateFormats can be hard coded with dfBoundaries. Not null.
size - The size for this row.
font - The format for the labels. Indexed by [normal, mouseOver, pressed]. Can be null.
See Also:
AtStart, AtEnd, AtFraction

CellDecorationRow

public CellDecorationRow(int mergeBoundaryType,
                         DateFormatList dateFormats,
                         AtRefNumber size,
                         PlaceRect cellLabelBounds,
                         java.awt.Paint cellBg,
                         java.awt.Paint labelFg,
                         DefaultRepetition labelRep,
                         java.awt.Font font)
Constructor when there in no underline and centered labels.

Parameters:
mergeBoundaryType - At what date boundary (E.g. DateRangeI.RANGE_TYPE_WEEK cells in this row should be merged.
dateFormats - The dateformats to use. From longer to shorter versions. dateFormats[longer to shorter representations].
The index is iterated from 0 and upwards until a (formatted) string is found that fit the label bounds. Since this "testing" of string lengths can be computationally expensive the sizes to use the different dateFormats can be hard coded with dfBoundaries. Not null.
size - The size for this row.
cellLabelBounds - How much of every cell that should be available for the label. Can be used for very advanced placing and margin handling. If null AbsRect.FILL will be used.
cellBg - The backgrounds for the individual cells, it is beeing painted over the row background. Setting elements to null will make the rowBg shine through. Note though that merged cells will not look merged if null since it is the cellBg paint that is used to paint over the grid lines that shoule be hidden when cells are merged. Indexed by [normal, mouseOver, pressed].
labelFg - The paint to paint the labels with. Indexed by [normal, mouseOver, pressed].
labelRep - Optional repetition spec for label paints. If null all rows are considered a "hit".
font - The format for the labels. Indexed by [normal, mouseOver, pressed]. Can be null.
See Also:
AtStart, AtEnd, AtFraction

CellDecorationRow

public CellDecorationRow(int mergeBoundaryType,
                         DateFormatList dateFormats,
                         AtRefNumber size,
                         PlaceRect cellLabelBounds,
                         java.awt.Paint cellBg,
                         java.awt.Paint labelFg,
                         DefaultRepetition labelRep,
                         java.awt.Font font,
                         java.lang.Integer underlineWidth,
                         AtRefRangeNumber alignX,
                         AtRefRangeNumber alignY)
Constructor when there in no difference for normal/mouseOver/Pressed.

Parameters:
mergeBoundaryType - At what date boundary (E.g. DateRangeI.RANGE_TYPE_WEEK cells in this row should be merged.
dateFormats - The dateformats to use. From longer to shorter versions. dateFormats[longer to shorter representations].
The index is iterated from 0 and upwards until a (formatted) string is found that fit the label bounds. Since this "testing" of string lengths can be computationally expensive the sizes to use the different dateFormats can be hard coded with dfBoundaries. Not null.
size - The size for this row.
cellLabelBounds - How much of every cell that should be available for the label. Can be used for very advanced placing and margin handling. If null AbsRect.FILL will be used.
cellBg - The backgrounds for the individual cells, it is beeing painted over the row background. Setting elements to null will make the rowBg shine through. Note though that merged cells will not look merged if null since it is the cellBg paint that is used to paint over the grid lines that shoule be hidden when cells are merged. Indexed by [normal, mouseOver, pressed].
labelFg - The paint to paint the labels with. Indexed by [normal, mouseOver, pressed].
labelRep - Optional repetition spec for label paints. If null all rows are considered a "hit".
font - The format for the labels. Indexed by [normal, mouseOver, pressed]. Can be null.
underlineWidth - The width of the underlines. If null no underline is used. Indexed by [normal, mouseOver, pressed].
alignX - The horizontal alignment within the cell. Can be absolute or relative and anchored to left or right edge.
alignY - The vertical alignment within the cell. Can be absolute or relative and anchored to top or bottom edge.
See Also:
AtStart, AtEnd, AtFraction

CellDecorationRow

public CellDecorationRow(int mergeBoundaryType,
                         DateFormatList dateFormats,
                         AtRefNumber size,
                         PlaceRect cellLabelBounds,
                         java.awt.Paint[] cellBg,
                         java.awt.Paint[] labelFg,
                         DefaultRepetition labelRep,
                         java.awt.Font[] font,
                         java.lang.Integer[] ulWidth,
                         AtRefRangeNumber alignX,
                         AtRefRangeNumber alignY)
Constructor.

Parameters:
mergeBoundaryType - At what date boundary (E.g. DateRangeI.RANGE_TYPE_WEEK cells in this row should be merged. DateRangeI.RANGE_TYPE_CUSTOM means that there will be no merge and the date/time is typically taken from the middle of the date area.
dateFormats - The dateformats to use. From longer to shorter versions. dateFormats[longer to shorter representations].

The index is iterated from 0 and upwards until a (formatted) string is found that fit the label bounds. Since this "testing" of string lengths can be computationally expensive the sizes to use the different dateFormats can be hard coded with dfBoundaries. Not null.

size - The size for this row.
cellLabelBounds - How much of every cell that should be available for the label. Can be used for very advanced placing and margin handling. If null AbsRect.FILL will be used.
cellBg - The backgrounds for the individual cells, it is beeing painted over the row background. Setting elements to null will make the rowBg shine through. Note though that merged cells will not look merged if null since it is the cellBg paint that is used to paint over the grid lines that shoule be hidden when cells are merged. Indexed by [normal, mouseOver, pressed]. Can be null or of length 0. May be of lesser length indicating that the missing effect is not applicable.
labelFg - The paint to paint the labels with. Indexed by [normal, mouseOver, pressed]. Can be null or of length 0. May be of lesser length indicating that the missing effect is not applicable.
labelRep - Optional repetition spec for label paints. If null all rows are considered a "hit".
font - The formt for the labels. Indexed by [normal, mouseOver, pressed]. Can be null or of length 0. May be of lesser length indicating that the missing effect is not applicable.
ulWidth - The width of the underlines. If null no underline is used. Indexed by [normal, mouseOver, pressed]. Can be null or of length 0. May be of lesser length indicating that the missing effect is not applicable.
alignX - The horizontal alignment within the cell. Can be absolute or relative and anchored to left or right edge.
alignY - The vertical alignment within the cell. Can be absolute or relative and anchored to top or bottom edge.
See Also:
AtStart, AtEnd, AtFraction
Method Detail

isPaintLabel

public boolean isPaintLabel(int n,
                            int count)
Returns if the label at this row applies to the suggested index with count size.

Parameters:
n - The index of this row/label.
count - The total number of rows. Used for knowing when the "last" row is asked for.
Returns:
If this row applies to the suggested index with count size.
See Also:
DefaultRepetition.INTERVAL_ONCE, DefaultRepetition.OFFSET_LAST

getMergeBoundaryType

public int getMergeBoundaryType()
Returns at what date boundary (E.g. DateRangeI.RANGE_TYPE_WEEK cells in this row should be merged.

Returns:
At what date boundary cells in this row should be merged. Use DateRangeI.RANGE_TYPE_CUSTOM to turn off merging.

getDateFormats

public DateFormatList getDateFormats()
Returns the date formats. Higher index should produce shorter labels and used when the longer doesn't fit.

Returns:
The date formats. Not null.

getSize

public AtRefNumber getSize()
The size for this row. Float for relative (0..1) or Integer for absolute.

Returns:
The size for this row.

getCellLabelBounds

public PlaceRect getCellLabelBounds()
How much of every cell that should be available for the label.

Returns:
How much of every cell that should be available for the label. Not null.

getCellBackground

public java.awt.Paint[] getCellBackground()
Returns the backgrounds for the cell. Indexed by [Normal, MouseOver, Pressed] but may be of lesser length indicating that the missing effect is not applicable.

Returns:
The background for the cell. Can be null but not of length 0.

getLabelForeground

public java.awt.Paint[] getLabelForeground()
Returns forgrounds for the label. Indexed by [Normal, MouseOver, Pressed] but may be of lesser length indicating that the missing effect is not applicable.

Returns:
Forground for the label. Can be null but not of length 0.

getLabelRepetition

public DefaultRepetition getLabelRepetition()
Returns the specification for the repetition constraint for painting the labels. May be null and all labels should be painted if so.

Returns:
The specification for the repetition constraint for painting the labels.
See Also:
isPaintLabel(int, int)

getFont

public java.awt.Font[] getFont()
Returns the fonts for the label. Indexed by [Normal, MouseOver, Pressed] but may be of lesser length indicating that the missing effect is not applicable.

Returns:
The font for the label. Can be null but not of length 0.

getUnderlineWidth

public java.lang.Integer[] getUnderlineWidth()
Returns the underlines width or null for no underline. Indexed by [Normal, MouseOver, Pressed] but may be of lesser length indicating that the missing effect is not applicable.

Returns:
The underlines width or null for no underline. Not of length 0.

getAlignX

public AtRefRangeNumber getAlignX()
Returns the horizontal alignment (docking).

Returns:
The horizontal alignment (docking).
See Also:
AtRefRangeNumber, AtStart, AtEnd, AtFraction

getAlignY

public AtRefRangeNumber getAlignY()
Returns the vertical alignment (docking).

Returns:
The vertical alignment (docking).
See Also:
AtStart, AtEnd, AtFraction

hasMouseEffects

public boolean hasMouseEffects()
Returns if this row should have a different appearence be possible depending on mouse over/press. Currently checks index 1 and 2 of the cellBg, labelFg and font for != null.

Returns:
true if mouse effects exists.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.