com.sapportals.htmlb.table

Interface TableViewModel

All Known Implementing Classes:
DefaultTableViewModel, JCOTableViewModel, ProxyListTableViewModel

public interface TableViewModel

The TableViewModel interface specifies the methods the TableView will use to interrogate a tabular data model.

The TableView can be set up to display any data model which implements the TableViewModel interface.

Copyright 2004 SAP AG


Method Summary
 TableColumn addColumn(String columnName)
          adds a column with the specified name to the visible columns
 void addKeyColumn(int columnIndex)
          adds a key column
 TableColumn getColumnAt(int columnIndex)
          returns the column at the specified index
 int getColumnCount()
          Returns the number of columns in the model.
 String getColumnName(int columnIndex)
          Returns the name of the column at columnIndex.
 Vector getColumns()
          returns the columns that should be displayed
 IndexedLinkedList getKeyColumn()
          returns the key column
 int getRowCount()
          Returns the number of rows in the model.
 AbstractDataType getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 AbstractDataType getValueAt(int rowIndex, String columnKey)
          Returns the value for the cell at rowIndex and in the column named with columnKey.
 void removeColumn(String columnName)
          removes a column from the visible columns.
 void setColumnName(String columnName, int columnIndex)
          sets the name of the column at columnIndex to columnName
 void setKeyColumn(int columnIndex)
          sets the key column for the model
 void setValueAt(AbstractDataType aValue, int rowIndex, int columnIndex)
          sets the value at rowIndex and columnIndex
 

Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Returns:
the number of rows in the model
See Also:
getColumnCount()

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A TableView uses this method to determine how many columns it should create and display by default.

Returns:
the number of columns in the model
See Also:
getRowCount()

getColumnName

public String getColumnName(int columnIndex)
Returns the name of the column at columnIndex. This is used to initialize the table's column header name.

Parameters:
columnIndex - the index of the column
Returns:
the name of the column

setColumnName

public void setColumnName(String columnName,
                          int columnIndex)
sets the name of the column at columnIndex to columnName


getValueAt

public AbstractDataType getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

getValueAt

public AbstractDataType getValueAt(int rowIndex,
                                   String columnKey)
Returns the value for the cell at rowIndex and in the column named with columnKey.

Parameters:
rowIndex - the row index
columnKey - the name of the column whose value is to be retrieved
Returns:
the value object at the specified cell

setValueAt

public void setValueAt(AbstractDataType aValue,
                       int rowIndex,
                       int columnIndex)
sets the value at rowIndex and columnIndex

Parameters:
aValue - the value that the table cell at rowIndex and columNindex should have
rowIndex - the index of the row
columnIndex - the index of the column

setKeyColumn

public void setKeyColumn(int columnIndex)
sets the key column for the model

Parameters:
columnIndex - the index of the key column

addKeyColumn

public void addKeyColumn(int columnIndex)
adds a key column

Parameters:
columnIndex - the index of the key column

getKeyColumn

public IndexedLinkedList getKeyColumn()
returns the key column

Returns:
the key columns
See Also:
IndexedLinkedList

getColumns

public Vector getColumns()
returns the columns that should be displayed

Returns:
visible columns of the table

getColumnAt

public TableColumn getColumnAt(int columnIndex)
returns the column at the specified index

Returns:
the column at columnIndex

addColumn

public TableColumn addColumn(String columnName)
adds a column with the specified name to the visible columns

Parameters:
columnName - the name of the column which should be added

removeColumn

public void removeColumn(String columnName)
removes a column from the visible columns. This column becomes invisible after calling this method by rendering.

Parameters:
columnName - the name of the column


Copyright 2006 SAP AG Complete Copyright Notice