nextapp.echo.table
Class TableColumn

java.lang.Object
  extended by nextapp.echo.table.TableColumn
All Implemented Interfaces:
java.io.Serializable

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

Describes a single table column.

See Also:
Serialized Form

Field Summary
static int BOTTOM
          A constant value to indicate alignment/positioning toward the bottom.
static java.lang.String CELL_RENDERER_CHANGED_PROPERTY
           
static int CENTER
          A constant value to indicate centered alignment/positioning.
static java.lang.String HEADER_RENDERER_CHANGED_PROPERTY
           
static java.lang.String HEADER_VALUE_CHANGED_PROPERTY
           
static java.lang.String IDENTIFIER_CHANGED_PROPERTY
           
static int LEFT
          A constant value to indicate alignment/positioning toward the left.
static java.lang.String MODEL_INDEX_CHANGED_PROPERTY
           
static int RIGHT
          A constant value to indicate alignment/positioning toward the right.
static int TOP
          A constant value to indicate alignment/positioning toward the top.
static java.lang.String WIDTH_CHANGED_PROPERTY
           
static java.lang.String WIDTHUNITS_CHANGED_PROPERTY
           
 
Constructor Summary
TableColumn()
          This constructor is necessary for serialization and should otherwise not be used.
TableColumn(int modelIndex)
          Creates a TableColumn with the specified model index, undefined width, and undefined cell and header renderers.
TableColumn(int modelIndex, int width)
          Creates a TableColumn with the specified model index and width, and undefined cell and header renderers.
TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellRenderer headerRenderer)
          Creates a TableColumn with the specified model index, width, and cell and header renderers.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a property change listener to the column.
 int getBottomPadding(int column, int row, java.lang.Object component)
          Gets the bottom padding value for a given cell
 TableCellRenderer getCellRenderer()
          Returns the cell renderer for this column.
 int getColumnHorizontalAlignment()
          Gets the horizontal alignment of a column.
 int getColumnVerticalAlignment()
          Gets the vertical alignment of a column.
 TableCellRenderer getHeaderRenderer()
          Returns the header cell renderer for this column.
 java.lang.Object getHeaderValue()
          Returns the header value for this column.
 java.lang.Object getIdentifier()
          Returns the identifier for this column.
 int getLeftPadding(int column, int row, java.lang.Object component)
          Gets the right padding value for a given cell
 int getModelIndex()
          Returns the index of this column in the model.
 AbstractPaddingController getPaddingController()
          Gets the padding controller used by this column.
 int getRightPadding(int column, int row, java.lang.Object component)
          Gets the left padding value for a given cell
 int getTopPadding(int column, int row, java.lang.Object component)
          Gets the top padding value for a given cell
 int getWidth()
          Returns the width of this column, in pixels.
 int getWidthUnits()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a property change listener from the column.
 void setCellRenderer(TableCellRenderer newValue)
          Sets the cell renderer for this column.
 void setColumnHorizontalAlignment(int alignment)
          Sets the horizontal alignment of a column.
 void setColumnVerticalAlignment(int alignment)
          Sets the vertical alignment of a column.
 void setHeaderRenderer(TableCellRenderer newValue)
          Sets the header cell renderer for this column.
 void setHeaderValue(java.lang.Object newValue)
          Sets the header value for this column.
 void setIdentifer(java.lang.Object newValue)
          Sets the identifier for this column.
 void setModelIndex(int newValue)
          Sets the index of the column in the TableModel which this TableColumn object represents.
 void setPaddingController(AbstractPaddingController paddingController)
          Sets the padding controller used by this column.
 void setWidth(int newValue)
          Sets the width of the column.
 void setWidthUnits(int widthUnits)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
A constant value to indicate alignment/positioning toward the left.

See Also:
Constant Field Values

CENTER

public static final int CENTER
A constant value to indicate centered alignment/positioning.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
A constant value to indicate alignment/positioning toward the right.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
A constant value to indicate alignment/positioning toward the bottom.

See Also:
Constant Field Values

TOP

public static final int TOP
A constant value to indicate alignment/positioning toward the top.

See Also:
Constant Field Values

CELL_RENDERER_CHANGED_PROPERTY

public static final java.lang.String CELL_RENDERER_CHANGED_PROPERTY
See Also:
Constant Field Values

HEADER_RENDERER_CHANGED_PROPERTY

public static final java.lang.String HEADER_RENDERER_CHANGED_PROPERTY
See Also:
Constant Field Values

HEADER_VALUE_CHANGED_PROPERTY

public static final java.lang.String HEADER_VALUE_CHANGED_PROPERTY
See Also:
Constant Field Values

IDENTIFIER_CHANGED_PROPERTY

public static final java.lang.String IDENTIFIER_CHANGED_PROPERTY
See Also:
Constant Field Values

MODEL_INDEX_CHANGED_PROPERTY

public static final java.lang.String MODEL_INDEX_CHANGED_PROPERTY
See Also:
Constant Field Values

WIDTH_CHANGED_PROPERTY

public static final java.lang.String WIDTH_CHANGED_PROPERTY
See Also:
Constant Field Values

WIDTHUNITS_CHANGED_PROPERTY

public static final java.lang.String WIDTHUNITS_CHANGED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

TableColumn

public TableColumn()
This constructor is necessary for serialization and should otherwise not be used.


TableColumn

public TableColumn(int modelIndex)
Creates a TableColumn with the specified model index, undefined width, and undefined cell and header renderers.

Parameters:
modelIndex - The column index in the model from which this column should display data.

TableColumn

public TableColumn(int modelIndex,
                   int width)
Creates a TableColumn with the specified model index and width, and undefined cell and header renderers.

Parameters:
modelIndex - The column index in the model from which this column should display data.
width - The width of the column.

TableColumn

public TableColumn(int modelIndex,
                   int width,
                   TableCellRenderer cellRenderer,
                   TableCellRenderer headerRenderer)
Creates a TableColumn with the specified model index, width, and cell and header renderers.

Parameters:
modelIndex - The column index in the model from which this column should display data.
width - The width of the column.
cellRenderer - The cell renderer to use for rendering values in this column. This parameter may be null if desired.
headerRenderer - The cell renderer to use for rendering header values in this column. This parameter may be null if desired.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener to the column.

Parameters:
l - The listener to add.

getCellRenderer

public TableCellRenderer getCellRenderer()
Returns the cell renderer for this column. The cell renderer will produce a component for each row of this column based on the value in that row.

Returns:
The cell renderer for this column.

getHeaderRenderer

public TableCellRenderer getHeaderRenderer()
Returns the header cell renderer for this column. The header cell renderer will produce a component for the header cell of this column based on the header value.

Returns:
The header cell renderer for this column.

getHeaderValue

public java.lang.Object getHeaderValue()
Returns the header value for this column. The header value is the object that will be provided to the header renderer to produce a component that will be used as the table header for this column.

Returns:
The header value for this column.

getIdentifier

public java.lang.Object getIdentifier()
Returns the identifier for this column. Each table column may have an identifier. Identifiers are provided as a convenience to the application developer, and are neither used nor required by the Table component.

Returns:
The identifier for this column.

getModelIndex

public int getModelIndex()
Returns the index of this column in the model. This value is independent of the TableColumn's. position within the table.

Returns:
The index of this column in the model.

getWidth

public int getWidth()
Returns the width of this column, in pixels.

Returns:
The width of this column, in pixels. Negative values indicate an undefined width.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener from the column.

Parameters:
l - The listener to remove.

setCellRenderer

public void setCellRenderer(TableCellRenderer newValue)
Sets the cell renderer for this column. The cell renderer will produce a component for each row of this column based on the value in that row.

Parameters:
newValue - The new cell renderer for this column.

setHeaderRenderer

public void setHeaderRenderer(TableCellRenderer newValue)
Sets the header cell renderer for this column. The header cell renderer will produce a component for the header cell of this column based on the header value.

Parameters:
newValue - The new header renderer for this column.

setHeaderValue

public void setHeaderValue(java.lang.Object newValue)
Sets the header value for this column. The header value is the object that will be provided to the header renderer to produce a component that will be used as the table header for this column.

Parameters:
newValue - The new header value for this column.

setIdentifer

public void setIdentifer(java.lang.Object newValue)
Sets the identifier for this column. Each table column may have an identifier. Identifiers are provided as a convenience to the application developer, and are neither used nor required by the Table component.

Parameters:
newValue - The new identifier for this column.

setModelIndex

public void setModelIndex(int newValue)
Sets the index of the column in the TableModel which this TableColumn object represents. This value is independent of the column's position within the column model, such that columns may be displayed in an arbitrary order.

Parameters:
newValue - The new model index of this column.

setWidth

public void setWidth(int newValue)
Sets the width of the column.

Parameters:
newValue - The width of this column. A negative value indicates an undefined width.

setColumnHorizontalAlignment

public void setColumnHorizontalAlignment(int alignment)
Sets the horizontal alignment of a column.

Parameters:
alignment - must be LEFT, CENTER or RIGHT

getColumnHorizontalAlignment

public int getColumnHorizontalAlignment()
Gets the horizontal alignment of a column.

Returns:
horizontal alignment value

setColumnVerticalAlignment

public void setColumnVerticalAlignment(int alignment)
Sets the vertical alignment of a column.

Parameters:
alignment - must be TOP, CENTER or BOTTOM

getColumnVerticalAlignment

public int getColumnVerticalAlignment()
Gets the vertical alignment of a column.

Returns:
vertical alignment value

setPaddingController

public void setPaddingController(AbstractPaddingController paddingController)
Sets the padding controller used by this column.


getPaddingController

public AbstractPaddingController getPaddingController()
Gets the padding controller used by this column.


getRightPadding

public int getRightPadding(int column,
                           int row,
                           java.lang.Object component)
Gets the left padding value for a given cell

Parameters:
column - column index of the cell
row - row index of the cell
component - component that resides in the cell
Returns:
left padding value, returning negative number will make the renderer ignore the padding

getLeftPadding

public int getLeftPadding(int column,
                          int row,
                          java.lang.Object component)
Gets the right padding value for a given cell

Parameters:
column - column index of the cell
row - row index of the cell
component - component that resides in the cell
Returns:
right padding value, returning negative number will make the renderer ignore the padding

getTopPadding

public int getTopPadding(int column,
                         int row,
                         java.lang.Object component)
Gets the top padding value for a given cell

Parameters:
column - column index of the cell
row - row index of the cell
component - component that resides in the cell
Returns:
top padding value, returning negative number will make the renderer ignore the padding

getBottomPadding

public int getBottomPadding(int column,
                            int row,
                            java.lang.Object component)
Gets the bottom padding value for a given cell

Parameters:
column - column index of the cell
row - row index of the cell
component - component that resides in the cell
Returns:
bottom padding value, returning negative number will make the renderer ignore the padding

getWidthUnits

public int getWidthUnits()

setWidthUnits

public void setWidthUnits(int widthUnits)