com.eliad.model
Class AbstractGridContext

java.lang.Object
  |
  +--com.eliad.model.AbstractGridContext

public abstract class AbstractGridContext
extends java.lang.Object
implements GridContext

This abstract class provides default implementations for some of the methods in the GridContext.

Version:
1.0 00/05/12
Author:
Stephan Szymkowicz

Constructor Summary
AbstractGridContext(java.awt.Component c, int row, int column)
          Constructs an AbstractGridContext suitable for a non-spanned cell.
AbstractGridContext(java.awt.Component c, int row, int column, int rCount, int cCount)
          Constructs an AbstractGridContext suitable for any kind of cell.
 
Method Summary
 java.awt.Color getBackgroundColor()
          Returns the background color for the cell, taken from the component.
abstract  javax.swing.border.Border getBorder()
          Returns the default border for cells.
 int getColumn()
          Returns the column of the cell where rendering or editing will take place.
 int getColumnCount()
          Returns the column count of the cell where rendering or editing will take place.
 int getColumnTab(int column)
          Returns the appropriate column position for a column that is inside the current cell or span.
 java.awt.Component getComponent()
          Returns the component behind this GridContext.
 StyleContextModel getDefaultStyleContext()
          Returns the default style context model which was defined in the grid component as default cell attributes.
abstract  java.awt.Color getFocusBackgroundColor()
          Returns the background color for cells that have the focus.
abstract  java.awt.Color getFocusForegroundColor()
          Returns the foreground color for cells that have the focus.
abstract  javax.swing.border.Border getFocusHighlightBorder()
          Returns the highlight border for cells that have the focus.
 java.awt.Font getFont()
          Returns the font for the cell, taken from the component.
 java.awt.Color getForegroundColor()
          Returns the foreground color for the cell, taken from the component.
 java.lang.Object getIdentifier()
          Returns the identifier object attached to the cell that this GridContext refers to.
 int getRow()
          Returns the row of the cell where rendering or editing will take place.
 int getRowCount()
          Returns the row count of the cell where rendering or editing will take place.
 int getRowTab(int row)
          Returns the row position for a row that is inside the current cell or span.
abstract  java.awt.Color getSelectionBackgroundColor()
          Returns the background color for selected cells.
abstract  javax.swing.border.Border getSelectionCellBorder()
          Returns the border for cells that have been selected.
abstract  java.awt.Color getSelectionForegroundColor()
          Returns the foreground color for selected cells.
 StyleModel getStyleModel()
          Returns the style model which was used to obtain the renderer or editor which will use this GridContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGridContext

public AbstractGridContext(java.awt.Component c,
                           int row,
                           int column)
Constructs an AbstractGridContext suitable for a non-spanned cell.

AbstractGridContext

public AbstractGridContext(java.awt.Component c,
                           int row,
                           int column,
                           int rCount,
                           int cCount)
Constructs an AbstractGridContext suitable for any kind of cell.
Method Detail

getComponent

public java.awt.Component getComponent()
Returns the component behind this GridContext. This will normally be a container.
Specified by:
getComponent in interface GridContext
Returns:
the Component which is using the current GridContext.

getStyleModel

public StyleModel getStyleModel()
Returns the style model which was used to obtain the renderer or editor which will use this GridContext. May be null.
Specified by:
getStyleModel in interface GridContext
Returns:
the StyleModel which is using the current GridContext.

getColumn

public int getColumn()
Returns the column of the cell where rendering or editing will take place.
Specified by:
getColumn in interface GridContext
Returns:
the column of the cell or left column of the span where rendering will take place.

getRow

public int getRow()
Returns the row of the cell where rendering or editing will take place.
Specified by:
getRow in interface GridContext
Returns:
the row of the cell or top row of the span where rendering will take place.

getColumnCount

public int getColumnCount()
Returns the column count of the cell where rendering or editing will take place.
Specified by:
getColumnCount in interface GridContext
Returns:
the column count of the cell or span.

getRowCount

public int getRowCount()
Returns the row count of the cell where rendering or editing will take place.
Specified by:
getRowCount in interface GridContext
Returns:
the row count of the cell or span.

getIdentifier

public java.lang.Object getIdentifier()
Returns the identifier object attached to the cell that this GridContext refers to.
Specified by:
getIdentifier in interface GridContext

getColumnTab

public int getColumnTab(int column)
Returns the appropriate column position for a column that is inside the current cell or span.
Specified by:
getColumnTab in interface GridContext
Returns:
0, which will be appropriate when columnCount == 1

getRowTab

public int getRowTab(int row)
Returns the row position for a row that is inside the current cell or span.
Specified by:
getRowTab in interface GridContext
Returns:
0, which will be appropriate when rowCount == 1

getFont

public java.awt.Font getFont()
Returns the font for the cell, taken from the component.

getForegroundColor

public java.awt.Color getForegroundColor()
Returns the foreground color for the cell, taken from the component.

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the background color for the cell, taken from the component.
Returns:
the Color object for the background property

getBorder

public abstract javax.swing.border.Border getBorder()
Returns the default border for cells.
Returns:
the Border object used for cells.

getFocusForegroundColor

public abstract java.awt.Color getFocusForegroundColor()
Returns the foreground color for cells that have the focus.

getFocusBackgroundColor

public abstract java.awt.Color getFocusBackgroundColor()
Returns the background color for cells that have the focus.
Returns:
the Color object for the background property

getFocusHighlightBorder

public abstract javax.swing.border.Border getFocusHighlightBorder()
Returns the highlight border for cells that have the focus.
Returns:
the Border object used for focused cells

getSelectionCellBorder

public abstract javax.swing.border.Border getSelectionCellBorder()
Returns the border for cells that have been selected.
Returns:
the Border object used for selected cells

getSelectionForegroundColor

public abstract java.awt.Color getSelectionForegroundColor()
Returns the foreground color for selected cells.
Returns:
the Color object for the foreground property

getSelectionBackgroundColor

public abstract java.awt.Color getSelectionBackgroundColor()
Returns the background color for selected cells.
Returns:
the Color used for the background of selected list items

getDefaultStyleContext

public StyleContextModel getDefaultStyleContext()
Returns the default style context model which was defined in the grid component as default cell attributes. If the current GridContext wasn't defined from a grid component, may be null.
Specified by:
getDefaultStyleContext in interface GridContext
Returns:
The StyleContextModel which defined the default attributes of a cell.