|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.DefaultTableColumnModel | +--dyntable.AbstractEntityTableColumnModel
$Id: AbstractEntityTableColumnModel.java,v 1.0 2005/09/25 jDynTable@gmx.de $
The AbstractEntityTableColumnModel is a super
class for models that define the columns to be displayed in an
EntityTable. If default behaviour is required, developers should
subclass AbstractEntityTableColumnModel to quickly get an
implementation of the EntityTableColumnModel interface which
provides a mapping between entity objects and a table view.
The EntityTableColumnModel defines column properties including
the datatypes, editors, and attributes associated with each
column, such as sortability and column order.
An entity (which is used in some of the methods in this class) represents
a row of data contained within a table.
For any entity, the user must implement the getCellValue(int,Object)
and setCellValue(int,Object,Object) functions since they are
specific to the entity used and map entities to table columns.
Some methods such as getCellValue(int, Object)
require both a column index and an entity object. The index is used to
identify the column for which the cell value is being requested. The order of the columns
matches the order they were added to this AbstractEntityTableColumnModel.
The first column is at index 0.
The entity Object is required because it contains the data for the row.
Some examples of the functionality that this class provides include:
- Enabling and disabling editing of data within individual columns
- Displaying or Hiding columns from the user
- Sorting columns using left alignment or right alignment
- Locking columns so they are always displayed
even when the user pans across the columns of the table
Constructor Summary | |
---|---|
AbstractEntityTableColumnModel()
Constructs a new EntityTableColumnModel. |
Method Summary | |
---|---|
void |
addColumn(EntityTableColumn c)
Adds the given EntityTableColumn to the right-side of the table. |
EntityTableColumn |
getByName(java.lang.String name)
Returns the column with the specified name. |
abstract java.lang.Object |
getCellValue(int col,
java.lang.Object entity)
Returns an Object containing the cell value at the given column number for a specified entity. |
java.lang.Class |
getColumnClass(int col)
Returns the column class specified by the col parameter. |
java.lang.String |
getColumnName(int col)
Returns the name for the specified column. |
int |
getRealColumnCount()
Returns the number of visible columns. |
boolean |
hasEditableColumns()
Returns true if the table has any editable columns, false otherwise. |
boolean |
isEditable(int col)
Returns true if the specified column is editable, false otherwise. |
boolean |
isHidden(int col)
Returns true if the specified column is hidden, false otherwise. |
boolean |
isLocked(int col)
Returns true if the specified column is locked, false otherwise. |
boolean |
isRightAlignmentSortable(int col)
Returns true if the specified column is right alignment sortable, false otherwise. |
boolean |
isSortable(int col)
Returns true if the specified column is sortable, false otherwise. |
void |
removeColumn(int col)
Removes the specified column from the table. |
abstract void |
setCellValue(int col,
java.lang.Object entity,
java.lang.Object value)
Changes the specified entity to store the specified value based on the column index. |
void |
setEditable(int col,
boolean newValue)
Sets the specified column to be editable or not. |
void |
setHidden(int col,
boolean newValue)
Sets a specified column to be hidden or visible. |
void |
setLocked(int col,
boolean newValue)
Locks or unlocks the specified column. |
void |
setRightAlignmentSortable(int col,
boolean newValue)
Sets right alignment sortability for the specified column. |
void |
setSortable(int col,
boolean newValue)
Enables or disables sorting on the specified colum. |
Methods inherited from class javax.swing.table.DefaultTableColumnModel |
---|
addColumn, addColumnModelListener, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, propertyChange, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface dyntable.EntityTableColumnModel |
---|
getColumnCount |
Methods inherited from interface javax.swing.table.TableColumnModel |
---|
addColumn, addColumnModelListener, getColumn, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel |
Constructor Detail |
public AbstractEntityTableColumnModel()
Method Detail |
public abstract java.lang.Object getCellValue(int col, java.lang.Object entity)
EntityTableColumnModel
getCellValue
in interface EntityTableColumnModel
col
- the column numberentity
- the Object to retrieve the value from.
This is typically a row entity.
public abstract void setCellValue(int col, java.lang.Object entity, java.lang.Object value)
EntityTableColumnModel
setCellValue
in interface EntityTableColumnModel
col
- the column where the cell is locatedentity
- the Object the cell is located in. This is
represented as a row in the table.value
- the Object which is the new valuepublic java.lang.Class getColumnClass(int col)
EntityTableColumnModel
getColumnClass
in interface EntityTableColumnModel
col
- the index of the column
public boolean isLocked(int col)
EntityTableColumnModel
isLocked
in interface EntityTableColumnModel
col
- the column index
public void setLocked(int col, boolean newValue)
EntityTableColumnModel
setLocked
in interface EntityTableColumnModel
col
- the column indexnewValue
- locked if true, unlocked if falsepublic boolean isSortable(int col)
EntityTableColumnModel
isSortable
in interface EntityTableColumnModel
col
- the column index
public void setSortable(int col, boolean newValue)
EntityTableColumnModel
setSortable
in interface EntityTableColumnModel
col
- the column indexnewValue
- sortable if true, not sortable if falsepublic boolean isRightAlignmentSortable(int col)
EntityTableColumnModel
isRightAlignmentSortable
in interface EntityTableColumnModel
col
- the column index
public void setRightAlignmentSortable(int col, boolean newValue)
EntityTableColumnModel
setRightAlignmentSortable
in interface EntityTableColumnModel
col
- the column indexnewValue
- enabled if true, disabled otherwisepublic boolean isHidden(int col)
EntityTableColumnModel
isHidden
in interface EntityTableColumnModel
col
- the column index
public void setHidden(int col, boolean newValue)
EntityTableColumnModel
setHidden
in interface EntityTableColumnModel
col
- the column indexnewValue
- hidden if true, visible otherwisepublic boolean isEditable(int col)
EntityTableColumnModel
isEditable
in interface EntityTableColumnModel
col
- the column index
public void setEditable(int col, boolean newValue)
EntityTableColumnModel
setEditable
in interface EntityTableColumnModel
col
- the column indexnewValue
- editable if true, not editable if falsepublic java.lang.String getColumnName(int col)
EntityTableColumnModel
getColumnName
in interface EntityTableColumnModel
col
- the column index
public void addColumn(EntityTableColumn c)
EntityTableColumnModel
addColumn
in interface EntityTableColumnModel
c
- the new columnpublic void removeColumn(int col)
EntityTableColumnModel
removeColumn
in interface EntityTableColumnModel
col
- the column indexpublic EntityTableColumn getByName(java.lang.String name)
EntityTableColumnModel
getByName
in interface EntityTableColumnModel
name
- the String name of the column
public int getRealColumnCount()
EntityTableColumnModel
getRealColumnCount
in interface EntityTableColumnModel
public boolean hasEditableColumns()
EntityTableColumnModel
hasEditableColumns
in interface EntityTableColumnModel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |