com.sas.servlet.tbeans.tableview
Class TableColumn

com.sas.servlet.tbeans.tableview.TableColumn

public class TableColumn

A TableColumn provides slots for a renderer and an editor that can be used to display and edit the cells in this column. When the renderer (or editor) in the TableColumn is null, the default renderer from the TableView is used.

The TableColumn stores the link between the columns in the TableView and the columns in the TableModel. The modelIndex is the column in the TableModel, which will be queried for the data values for the cells in this column. As the column moves around in the view this modelIndex does not change.

Setting the modelIndex to -1 indicates the the column is a custom column. Thus the column does not map to a column in the TableModel. A custom column is not editable and thus the cellEditor is never used.

See Also:
TableColumnModel, DefaultTableColumnModel, BaseHeader.getDefaultRenderer(), BaseTableView.getDefaultRenderer(), BaseTableView.getDefaultEditor(), BaseTableView.getCellRenderer(int, int), BaseTableView.getCellEditor(int, int)

Constructor Summary
TableColumn()
          Constructs a new TableColumn using a default model index of 0, a null renderer and a null editor.
TableColumn(int mIndex)
          Constructs a new TableColumn using a null renderer and a null editor.
TableColumn(int mIndex, TableCellRenderer cRenderer, TableCellEditor cEditor)
          Constructs a new TableColumn using the given renderer and editor.
 
Method Summary
 TableCellEditor getCellEditor()
          Returns the TableCellEditor used by the TableView to edit the cells for this column.
 TableCellRenderer getCellRenderer()
          Returns the TableCellRenderer used by the TableView to draw the cells for this column.
 TableCellRenderer getHeaderRenderer()
          Returns the TableCellRenderer used to draw the header of the TableColumn.
 java.lang.String getHeaderValue()
          Returns the String used as the value for the header renderer.
 java.lang.Object getIdentifier()
          Returns the identifier object for this column.
 int getModelIndex()
          Returns the model index for this column.
 int getSize()
           
 java.lang.Object getUniqueModelIdentifier()
           
 boolean isResizable()
           
 void setCellEditor(TableCellEditor cellEditor)
          Sets the TableCellEditor used by the TableView to edit the cells for this column.
 void setCellRenderer(TableCellRenderer cellRenderer)
          Sets the TableCellRenderer used by the TableView to draw the cells for this column.
 void setHeaderRenderer(TableCellRenderer headerRenderer)
          Sets the TableCellRenderer used to draw the header of the TableColumn.
 void setHeaderValue(java.lang.String headerValue)
          Sets the String that will be used as the value for the headerRenderer.
 void setIdentifier(java.lang.Object identifier)
          Sets the TableColumn's identifier.
 void setModelIndex(int modelIndex)
          Sets the model index for this column.
 void setResizable(boolean resizable)
           
 void setSize(int size)
           
 void setUniqueModelIdentifier(java.lang.Object uniqueModelIdentifier)
           
 

Constructor Detail

TableColumn

public TableColumn()
Constructs a new TableColumn using a default model index of 0, a null renderer and a null editor.


TableColumn

public TableColumn(int mIndex)
Constructs a new TableColumn using a null renderer and a null editor.

Parameters:
mIndex - the new modelIndex for the column

TableColumn

public TableColumn(int mIndex,
                   TableCellRenderer cRenderer,
                   TableCellEditor cEditor)
Constructs a new TableColumn using the given renderer and editor.

Parameters:
mIndex - the new modelIndex for the column
cRenderer - the new renderer for the column
cEditor - the new editor for the column
Method Detail

setModelIndex

public void setModelIndex(int modelIndex)
Sets the model index for this column. The model index is the index of the column in the model that will be displayed by this TableColumn. As the TableColumn is moved around in the view the model index remains constant.

Parameters:
modelIndex - the new modelIndex

getModelIndex

public int getModelIndex()
Returns the model index for this column.

Returns:
the modelIndex property

setIdentifier

public void setIdentifier(java.lang.Object identifier)
Sets the TableColumn's identifier. Identifiers are not used by the TableView, they are purely a convenience for the external tagging and location of columns.

Parameters:
identifier - an identifier for this column

getIdentifier

public java.lang.Object getIdentifier()
Returns the identifier object for this column. Identifiers are not used by TableView, they are purely a convenience for external use. If the identifier is null, getIdentifier() returns getHeaderValue as a default.

Returns:
the identifier property

getUniqueModelIdentifier

public java.lang.Object getUniqueModelIdentifier()

setUniqueModelIdentifier

public void setUniqueModelIdentifier(java.lang.Object uniqueModelIdentifier)

setHeaderValue

public void setHeaderValue(java.lang.String headerValue)
Sets the String that will be used as the value for the headerRenderer. When the TableColumn is created, the default headerValue is null.

Parameters:
headerValue - the new headerValue

getHeaderValue

public java.lang.String getHeaderValue()
Returns the String used as the value for the header renderer.

Returns:
the headerValue property

setHeaderRenderer

public void setHeaderRenderer(TableCellRenderer headerRenderer)
Sets the TableCellRenderer used to draw the header of the TableColumn.

Parameters:
headerRenderer - the new headerRenderer

getHeaderRenderer

public TableCellRenderer getHeaderRenderer()
Returns the TableCellRenderer used to draw the header of the TableColumn. When the headerRenderer is null, the ColumnHeader uses its defaultRenderer. The default value for a headerRenderer is null.

Returns:
the headerRenderer property

setCellRenderer

public void setCellRenderer(TableCellRenderer cellRenderer)
Sets the TableCellRenderer used by the TableView to draw the cells for this column.

Parameters:
cellRenderer - the new cellRenderer

getCellRenderer

public TableCellRenderer getCellRenderer()
Returns the TableCellRenderer used by the TableView to draw the cells for this column. The cellRenderer of the column not only controls the visual look for the column, but is also used to interpret the value supplied by the TableModel. When the cellRenderer is null, the TableView uses its default renderer. The default value for a cellRenderer is null.

Returns:
the cellRenderer property
See Also:
BaseTableView.getDefaultRenderer()

setCellEditor

public void setCellEditor(TableCellEditor cellEditor)
Sets the TableCellEditor used by the TableView to edit the cells for this column.

Parameters:
cellEditor - the new cellEditor

getCellEditor

public TableCellEditor getCellEditor()
Returns the TableCellEditor used by the TableView to edit the cells for this column. When the cellEditor is null, the TableView uses its default editor. The default value for a cellEditor is null.

Returns:
the cellEditor property
See Also:
BaseTableView.getDefaultEditor()

setResizable

public void setResizable(boolean resizable)

isResizable

public boolean isResizable()

setSize

public void setSize(int size)

getSize

public int getSize()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.