com.arsdigita.toolbox.ui
Class DataTable.DataQueryTableModel

java.lang.Object
  extended bycom.arsdigita.toolbox.ui.DataTable.DataQueryTableModel
All Implemented Interfaces:
TableModel
Enclosing class:
DataTable

protected static class DataTable.DataQueryTableModel
extends Object
implements TableModel

A TableModel which gets its data from a DataQuery. This TableModel is used in the DataTable.DataBuilderAdapter to iterate through the query returned by the DataQueryBuilder and generate rows for it on the screen.


Field Summary
 
Fields inherited from interface com.arsdigita.bebop.table.TableModel
versionId
 
Constructor Summary
DataTable.DataQueryTableModel(DataTable t, DataQuery data, String keyColumn)
          Create a new DataQueryTableModel
 
Method Summary
 int getColumnCount()
          Return the number of columns this table model has.
 DataQuery getDataQuery()
          Return the original DataQuery.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTable.DataQueryTableModel

public DataTable.DataQueryTableModel(DataTable t,
                                     DataQuery data,
                                     String keyColumn)
Create a new DataQueryTableModel

Parameters:
t - the DataTable which needs this model
data - the to be wrapped
keyColumn - the name of the column in the query which represents the primary key
Method Detail

getColumnCount

public int getColumnCount()
Description copied from interface: TableModel
Return the number of columns this table model has.

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in the table model

nextRow

public boolean nextRow()
Description copied from interface: TableModel
Move to the next row and return true if the model is now positioned on a valid row. Initially, the table model is positioned before the first row. The table will call this method before it retrieves the data for the row with calls to 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.

Specified by:
nextRow in interface TableModel
Returns:
true if the model is positioned on a valid row

getElementAt

public Object getElementAt(int columnIndex)
Description copied from interface: TableModel
Return the data element for the given column and the current row. The returned object will be passed to the table cell renderer as the value argument without modifications.

Specified by:
getElementAt in interface TableModel
Parameters:
columnIndex - the number of the column for which to get data
Returns:
the object to pass to the table cell renderer for display
See Also:
TableCellRenderer

getKeyAt

public Object getKeyAt(int columnIndex)
Description copied from interface: TableModel
Return the key for the given column and the current row. The key has to be unique for each row in the table model, but does not need to be unique for each row and column, though it may. The key is passed to the table cell renderer as the key argument.

Specified by:
getKeyAt in interface TableModel
Parameters:
columnIndex - the number of the column for which to get data
Returns:
the key for the given column and the current row.
See Also:
TableCellRenderer

getDataQuery

public DataQuery getDataQuery()
Return the original DataQuery. The query's cursor will be "pointing" at the current row



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC