|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
$Id: EntityTableColumnModel.java,v 1.0 2005/09/25 jDynTable@gmx.de $
The EntityTableColumnModel interface describes the model that defines the
behaviour of columns in an EntityTable. If default behaviour is required,
developers should subclass AbstractEntityTableColumnModel to quickly get an
implementation of this EntityTableColumnModel interface.
The EntityTableColumnModel defines column properties including
the datatypes, editors, and
attributes associated with each column, such as sortability and column order.
This EntityTableColumnModel defines the mapping between
an entity and all columns. Once an EntityList which manages entities,
and an EntityTableColumnModel have been provided,
the data can be rendered in an EntityTable. To link the entity to this
EntityTableColumnModel, the getCellValue(int,Object)
and setCellValue(int,Object,Object) functions need to be implemented to work with the entity.
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 first column is at index 0.
The entity Object is required because it contains the data for the row.
Since the user is able to move columns and columns can be locked, the actual order
of the columns in the table may be different from the order of the columns
in this EntityTableColumnModel. The column index that must
be used for methods in this EntityTableColumnModel is the
logical index that represents the columns in the order they were
added to this EntityTableColumnModel. For information
about locking and other column attributes see EntityTableColumn.
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
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. |
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. |
int |
getColumnCount()
Returns the number of columns in this EntityTableColumnModel. |
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. |
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 interface javax.swing.table.TableColumnModel |
---|
addColumn, addColumnModelListener, getColumn, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel |
Method Detail |
public java.lang.Object getCellValue(int col, java.lang.Object entity)
col
- the column numberentity
- the Object to retrieve the value from.
This is typically a row entity.
public void setCellValue(int col, java.lang.Object entity, java.lang.Object value)
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 boolean isLocked(int col)
col
- the column index
public void setLocked(int col, boolean newValue)
col
- the column indexnewValue
- locked if true, unlocked if falsepublic boolean isSortable(int col)
col
- the column index
public void setSortable(int col, boolean newValue)
col
- the column indexnewValue
- sortable if true, not sortable if falsepublic boolean isHidden(int col)
col
- the column index
public void setHidden(int col, boolean newValue)
col
- the column indexnewValue
- hidden if true, visible otherwisepublic boolean isEditable(int col)
col
- the column index
public void setEditable(int col, boolean newValue)
col
- the column indexnewValue
- editable if true, not editable if falsepublic boolean isRightAlignmentSortable(int col)
col
- the column index
public void setRightAlignmentSortable(int col, boolean newValue)
col
- the column indexnewValue
- enabled if true, disabled otherwisepublic java.lang.Class getColumnClass(int col)
col
- the index of the column
public java.lang.String getColumnName(int col)
col
- the column index
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableColumnModel
public int getRealColumnCount()
public void addColumn(EntityTableColumn c)
c
- the new columnpublic void removeColumn(int col)
col
- the column indexpublic EntityTableColumn getByName(java.lang.String name)
name
- the String name of the column
public boolean hasEditableColumns()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |