|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The TableModel
is the abstraction a Table
uses to access the data it
displays. The table will ask its TableModelBuilder
to
instantiate a new table model once for each request it processes.
The table will request each element in the model at most once per
request, moving through the rows with successive calls to nextRow()
. For each row, the table retrieves the values and keys in each
column with calls to getElementAt(int)
and getKeyAt(int)
.
The table data is accessed by the table by moving through the rows
of the table model with calls to nextRow()
. The data for each
column in a row is represented by two objects: the data element which
usually contains display information for that column and can be as
simple as a string, and the key, which is used to identify the
column. The key is usually a suitable representation of the primary key
of the underlying object in the database. The key needs to be unique
amongst all rows in the table model, but doesn't need to
uniquely identify the row and column for that data item -
all calls to getKeyAt(int)
can return the same value for one row in
the table model.
Table
,
TableModelBuilder
Field Summary | |
static String |
versionId
|
Method Summary | |
int |
getColumnCount()
Return the number of columns this table model has. |
Object |
getElementAt(int columnIndex)
Return the data element for the given column and the current row. |
Object |
getKeyAt(int columnIndex)
Return the key for the given column and the current row. |
boolean |
nextRow()
Move to the next row and return true if the model is now positioned on a valid row. |
Field Detail |
public static final String versionId
Method Detail |
public int getColumnCount()
public boolean nextRow()
getElementAt
and getKeyAt
.
If this method returns true
, subsequent calls to
getElementAt
and getKeyAt
have
to succeed and return non-null objects. If this method returns
false
, the table assumes that it has traversed all the
data contained in this model.
true
if the model is positioned on a valid rowpublic Object getElementAt(int columnIndex)
value
argument without modifications.
columnIndex
- the number of the column for which to get data
TableCellRenderer
public Object getKeyAt(int columnIndex)
key
argument.
columnIndex
- the number of the column for which to get data
TableCellRenderer
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |