CoffeeTable.Grid
Class GridAttributes

java.lang.Object
  |
  +--CoffeeTable.Grid.GridAttributes

public class GridAttributes
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

GridAttributes is a class that encapsulates the drawing attributes for a grid's cells, row, columns and header. It contains a Font, text Color, background Color and justification information that will be used by the GridPanel while drawing.

Version:
2.1.3 of October 1, 1999 Copyright © 1996-1999 3Magic
See Also:
Serialized Form

Constructor Summary
GridAttributes(java.awt.Component itsComponent, java.awt.Font aFont, java.awt.Color textColor, java.awt.Color backColor, int justification)
          Constructs and creates a new GridAttributes Object using the passed in parameters.
GridAttributes(java.awt.Component itsComponent, java.awt.Font aFont, java.awt.Color textColor, java.awt.Color backColor, int justification, int cellType)
          Constructs and creates a new GridAttributes Object using the passed in parameters.
GridAttributes(java.awt.Component itsComponent, java.awt.Font aFont, java.awt.Color textColor, java.awt.Color backColor, int justification, int cellType, java.lang.String[] items)
           
 
Method Summary
 void beginDrawing(java.awt.Graphics g)
          Saves the Graphics objects drawing state (Font and Color).
 java.lang.Object clone()
          Clones the GridAttributes object.
 void endDrawing(java.awt.Graphics g)
          Restores the Graphics objects drawing state (Font and Color).
protected  void finalize()
           
 int getAscent()
          Get the Font ascent.
 java.awt.Color getBackColor()
          Get the cell background color.
 int getCellType()
          Get the cell type.
 int getDescent()
          Get the Font descent.
 java.awt.Font getFont()
          Get the Font.
 java.awt.FontMetrics getFontMetrics()
          Get the FontMetrics.
 int getHeight()
          Get the Font height.
 java.lang.String[] getItems()
          Return the list of item strings for the choice list.
 int getJustification()
          Get the Justification style.
 int getLeading()
          Get the Font leading.
 java.awt.Color getTextColor()
          Get the cell text color.
 void setBackColor(java.awt.Color backColor)
          Set the cell background color.
 void setCellType(int cellType)
          Set the cell type.
 void setFont(java.awt.Font aFont)
          Set the Font.
 void setItems(java.lang.String[] items)
          Set the list of item strings for the choice list.
 void setJustification(int justification)
          Set the Justification style.
 void setTextColor(java.awt.Color textColor)
          Set the cell text color.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridAttributes

public GridAttributes(java.awt.Component itsComponent,
                      java.awt.Font aFont,
                      java.awt.Color textColor,
                      java.awt.Color backColor,
                      int justification)
Constructs and creates a new GridAttributes Object using the passed in parameters. If a Font is specified it gets the FontMetrics for that font as well.
Parameters:
itsComponent - a component used to get the font metrics, can pass a reference to the Applet
aFont - the Font
textColor - the text Color
backColor - the background Color
justification - the justification style (GridPanelInterface.JUST_LEFT, GridPanelInterface.JUST_CENTER, GridPanelInterface.JUST_RIGHT), you can specify word wrapping by doing a bitwise OR with GridPanelInterface.WORD_WRAP or truncate (with ellipsis) by by doing a bitwise OR with GridPanelInterface.TRUNC_STRING
See Also:
GridPanelInterface.JUST_LEFT, GridPanelInterface.JUST_CENTER, GridPanelInterface.JUST_RIGHT, GridPanelInterface.WORD_WRAP, GridPanelInterface.TRUNC_STRING

GridAttributes

public GridAttributes(java.awt.Component itsComponent,
                      java.awt.Font aFont,
                      java.awt.Color textColor,
                      java.awt.Color backColor,
                      int justification,
                      int cellType)
Constructs and creates a new GridAttributes Object using the passed in parameters. If a Font is specified it gets the FontMetrics for that font as well.
Parameters:
itsComponent - a component used to get the font metrics, can pass a reference to the Applet
aFont - the Font
textColor - the text Color
backColor - the background Color
justification - the justification style (GridPanelInterface.JUST_LEFT, GridPanelInterface.JUST_CENTER, GridPanelInterface.JUST_RIGHT), you can specify word wrapping by doing a bitwise OR with GridPanelInterface.WORD_WRAP or truncate (with ellipsis) by by doing a bitwise OR with GridPanelInterface.TRUNC_STRING
cellType - the cell type (GridPanelInterface.TEXT, GridPanelInterface.EDIT_TEXT, GridPanelInterface.URL, GridPanelInterface.MAIL)
See Also:
GridPanelInterface.JUST_LEFT, GridPanelInterface.JUST_CENTER, GridPanelInterface.JUST_RIGHT, GridPanelInterface.WORD_WRAP, GridPanelInterface.TRUNC_STRING, GridPanelInterface.TEXT, GridPanelInterface.EDIT_TEXT, GridPanelInterface.URL, GridPanelInterface.MAIL

GridAttributes

public GridAttributes(java.awt.Component itsComponent,
                      java.awt.Font aFont,
                      java.awt.Color textColor,
                      java.awt.Color backColor,
                      int justification,
                      int cellType,
                      java.lang.String[] items)
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

clone

public java.lang.Object clone()
Clones the GridAttributes object.
Overrides:
clone in class java.lang.Object

getHeight

public final int getHeight()
Get the Font height.
Returns:
the Font height, based on the FontMetrics

getAscent

public final int getAscent()
Get the Font ascent.
Returns:
the Font ascent, based on the FontMetrics

getDescent

public final int getDescent()
Get the Font descent.
Returns:
the Font descent, based on the FontMetrics

getLeading

public final int getLeading()
Get the Font leading.
Returns:
the Font leading, based on the FontMetrics

getFont

public final java.awt.Font getFont()
Get the Font.
Returns:
the Font

setFont

public final void setFont(java.awt.Font aFont)
Set the Font.
Parameters:
aFont - the Font

getFontMetrics

public final java.awt.FontMetrics getFontMetrics()
Get the FontMetrics.
Returns:
the FontMetrics

getJustification

public final int getJustification()
Get the Justification style.
Returns:
the Justification style

setJustification

public final void setJustification(int justification)
Set the Justification style.
Parameters:
justification - the Justification style

getCellType

public final int getCellType()
Get the cell type.
Returns:
the cell type

setCellType

public final void setCellType(int cellType)
Set the cell type.
Parameters:
cellType - the cell type

getBackColor

public final java.awt.Color getBackColor()
Get the cell background color.
Returns:
the background color

setBackColor

public final void setBackColor(java.awt.Color backColor)
Set the cell background color.
Parameters:
backColor - the background color

getTextColor

public final java.awt.Color getTextColor()
Get the cell text color.
Returns:
the text color

setTextColor

public final void setTextColor(java.awt.Color textColor)
Set the cell text color.
Parameters:
textColor - the text color

setItems

public final void setItems(java.lang.String[] items)
Set the list of item strings for the choice list. Cells with this attribute will display a Choice list with the specified Strings as the items in the list.
Parameters:
items - array of item strings

getItems

public final java.lang.String[] getItems()
Return the list of item strings for the choice list.
Returns:
array of item strings

beginDrawing

public final void beginDrawing(java.awt.Graphics g)
Saves the Graphics objects drawing state (Font and Color). This is used by the GridPanel drawing methods before changing any setting for drawing. You should call endDrawing after finishing all drawing.
Parameters:
g - the Graphics object
See Also:
endDrawing(java.awt.Graphics)

endDrawing

public final void endDrawing(java.awt.Graphics g)
Restores the Graphics objects drawing state (Font and Color). This is used by the GridPanel drawing methods after finishing the drawing. You should call this method after finishing all drawing.
See Also:
beginDrawing(java.awt.Graphics)