dyntable
Class DefaultCellAttribute

java.lang.Object
  |
  +--dyntable.DefaultCellAttribute
All Implemented Interfaces:
CellAttribute, CellFont, CellSpan, ColoredCell

public class DefaultCellAttribute
extends java.lang.Object
implements CellAttribute, CellSpan, ColoredCell, CellFont

$Id: DefaultCellAttribute.java,v 1.0 2005/09/25 jDynTable@gmx.de $
The DefaultCellAttribute implements different interfaces and is used in AttributiveCellTableModel class to create the TableModel. This class provides many methods for the adaption of different table cell attributes (e. g. fonts) and also implements the combine / split feature.
CAUTION: variable values like rowSize etc. must be synchronized to Table data

Version:
$Revision: 1.0 $
Author:
$Author: jdyntable@gmx.de $

Field Summary
 
Fields inherited from interface dyntable.CellSpan
COLUMN, ROW
 
Constructor Summary
DefaultCellAttribute()
          Construchts a new DefaultCellAttribute.
DefaultCellAttribute(int numRows, int numColumns)
          Construchts a new DefaultCellAttribute with numRows rows and numColumns columns.
 
Method Summary
 void addColumn()
          Adds column to table.
 void addRow()
          Adds column to table.
 void combine(int[] rows, int[] columns)
          Combines cells
 java.awt.Color getBackground(int row, int column)
           
 java.awt.Font getFont(int row, int column)
          Returns font object characterizing font in the cell row/column
 java.awt.Color getForeground(int row, int column)
           
 java.awt.Dimension getSize()
          Getter method
 int[] getSpan(int row, int column)
          Returns cell span at position row/column.
 void insertRow(int row)
          Adds column to table at a certain position.
 boolean isEditable(int row, int column)
          Returns editability of a cell
 boolean isVisible(int row, int column)
          A cell may be not visible if its neighbor cell is combined with it
 void setBackground(java.awt.Color color, int[] rows, int[] columns)
           
 void setBackground(java.awt.Color color, int row, int column)
           
 void setFont(java.awt.Font font, int[] rows, int[] columns)
          Sets new font in the cell area defined by row/column
 void setFont(java.awt.Font font, int row, int column)
          Sets new font in the cell row/column
 void setForeground(java.awt.Color color, int[] rows, int[] columns)
           
 void setForeground(java.awt.Color color, int row, int column)
           
 void setNotEditable(int row, int column)
          Set cell uneditable.
 void setSize(java.awt.Dimension size)
          Setter method
 void setSpan(int[] span, int row, int column)
          Sets cell span at position row/column
 void split(int row, int column)
          The opposite of combine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCellAttribute

public DefaultCellAttribute()
Construchts a new DefaultCellAttribute. Default Contructor. Calls DefaultCellAttribute(1,1)


DefaultCellAttribute

public DefaultCellAttribute(int numRows,
                            int numColumns)
Construchts a new DefaultCellAttribute with numRows rows and numColumns columns.

Method Detail

getSpan

public int[] getSpan(int row,
                     int column)
Description copied from interface: CellSpan
Returns cell span at position row/column. The cell span provides information about if and how a cell is combined.

Specified by:
getSpan in interface CellSpan
Parameters:
row - integer with Row
column - integer with Column
Returns:
array of two elements containing cell span at given position

setSpan

public void setSpan(int[] span,
                    int row,
                    int column)
Description copied from interface: CellSpan
Sets cell span at position row/column

Specified by:
setSpan in interface CellSpan
Parameters:
row - integer with Row
column - integer with Column
span - span of the cell

isVisible

public boolean isVisible(int row,
                         int column)
Description copied from interface: CellSpan
A cell may be not visible if its neighbor cell is combined with it

Specified by:
isVisible in interface CellSpan
Parameters:
row - integer with Row
column - integer with Column
Returns:
true if visible, otherwise false

combine

public void combine(int[] rows,
                    int[] columns)
Description copied from interface: CellAttribute
Combines cells

Specified by:
combine in interface CellAttribute
Parameters:
rows - Array of integers with Rows that are to be combined
columns - Array of integers with Columns that are to be combined

split

public void split(int row,
                  int column)
Description copied from interface: CellAttribute
The opposite of combine. Both parameters together define a cell that is to be split.

Specified by:
split in interface CellAttribute
Parameters:
row - integer with Row
column - integer with Column

getForeground

public java.awt.Color getForeground(int row,
                                    int column)
Specified by:
getForeground in interface ColoredCell

setForeground

public void setForeground(java.awt.Color color,
                          int row,
                          int column)
Specified by:
setForeground in interface ColoredCell

setForeground

public void setForeground(java.awt.Color color,
                          int[] rows,
                          int[] columns)
Specified by:
setForeground in interface ColoredCell

getBackground

public java.awt.Color getBackground(int row,
                                    int column)
Specified by:
getBackground in interface ColoredCell

setBackground

public void setBackground(java.awt.Color color,
                          int row,
                          int column)
Specified by:
setBackground in interface ColoredCell

setBackground

public void setBackground(java.awt.Color color,
                          int[] rows,
                          int[] columns)
Specified by:
setBackground in interface ColoredCell

setNotEditable

public void setNotEditable(int row,
                           int column)
Description copied from interface: CellAttribute
Set cell uneditable. Both parameters together define the cell that is not editable.

Specified by:
setNotEditable in interface CellAttribute
Parameters:
row - integer with Row
column - integer with Column

isEditable

public boolean isEditable(int row,
                          int column)
Description copied from interface: CellAttribute
Returns editability of a cell

Specified by:
isEditable in interface CellAttribute
Parameters:
row - integer with Row
column - integer with Column
Returns:
true if cell is editable

getFont

public java.awt.Font getFont(int row,
                             int column)
Description copied from interface: CellFont
Returns font object characterizing font in the cell row/column

Specified by:
getFont in interface CellFont
Parameters:
row - integer with Row
column - integer with Column
Returns:
font object corresponding to font in the cell

setFont

public void setFont(java.awt.Font font,
                    int row,
                    int column)
Description copied from interface: CellFont
Sets new font in the cell row/column

Specified by:
setFont in interface CellFont
Parameters:
font - new font for the cell
row - integer with Row
column - integer with Column

setFont

public void setFont(java.awt.Font font,
                    int[] rows,
                    int[] columns)
Description copied from interface: CellFont
Sets new font in the cell area defined by row/column

Specified by:
setFont in interface CellFont
Parameters:
font - new font for the cells
rows - Array of integers with Rows
columns - Array of integers with Columns

addColumn

public void addColumn()
Description copied from interface: CellAttribute
Adds column to table.
Attention: Changing things in CellAttribute must always be synchronized to Table data

Specified by:
addColumn in interface CellAttribute

addRow

public void addRow()
Description copied from interface: CellAttribute
Adds column to table.
Attention: Changing things in CellAttribute must always be synchronized to Table data

Specified by:
addRow in interface CellAttribute

insertRow

public void insertRow(int row)
Description copied from interface: CellAttribute
Adds column to table at a certain position.
Attention: Changing things in CellAttribute must always be synchronized to Table data

Specified by:
insertRow in interface CellAttribute
Parameters:
row - Row where new row is to be inserted at.

getSize

public java.awt.Dimension getSize()
Description copied from interface: CellAttribute
Getter method

Specified by:
getSize in interface CellAttribute
Returns:
Dimension of the table (column size & row size)

setSize

public void setSize(java.awt.Dimension size)
Description copied from interface: CellAttribute
Setter method

Specified by:
setSize in interface CellAttribute
Parameters:
size - new Dimension of the table (column size & row size)