org.netbeans.microedition.lcdui
Interface TableModel

All Known Implementing Classes:
SimpleTableModel

public interface TableModel

TableModel interface specifies methods, which Table component uses to get data it shows. The following example shows how the model is being used in Table:

TableModel myTableModel = new MyTableModel(); Table myTable = new Table(); myTable.setModel(myTableModel);


Method Summary
 void addTableModelListener(TableModelListener listener)
          Adds TableModelListener to this model.
 int getColumnCount()
          Gets the number of columns of the table
 java.lang.String getColumnName(int column)
          Gets the name of the given column.
 int getRowCount()
          Gets the number of rows of the table
 java.lang.Object getValue(int column, int row)
          Gets the value of a table cell at a specified location.
 boolean isUsingHeaders()
          Decides wheter this table is using headers (column names).
 void removeTableModelListener(TableModelListener listener)
          Removes TableModelListener from this model.
 

Method Detail

addTableModelListener

void addTableModelListener(TableModelListener listener)
Adds TableModelListener to this model.

Parameters:
listener - listener to be added

removeTableModelListener

void removeTableModelListener(TableModelListener listener)
Removes TableModelListener from this model.

Parameters:
listener - listener to be removed

getColumnCount

int getColumnCount()
Gets the number of columns of the table

Returns:
column count

getRowCount

int getRowCount()
Gets the number of rows of the table

Returns:
row count

isUsingHeaders

boolean isUsingHeaders()
Decides wheter this table is using headers (column names).

Returns:
true if the column names are being supplied and should be visualized, false otherwise

getColumnName

java.lang.String getColumnName(int column)
Gets the name of the given column. The given index should never exceed the number specified by the getColumnCount() method.

Parameters:
column - index of column of which the name should be returned. May return null.
Returns:
The name of the column

getValue

java.lang.Object getValue(int column,
                          int row)
Gets the value of a table cell at a specified location. For example getValue(2,3) returns a cell value from 2nd column and 3rd row.

The given column and row should never exceed the numbers specified by the getColumnCount() or getRowCount() methods.

Parameters:
column - column index of the value
row - row index of the value
Returns:
value for the given cell coordinates. May return null if there is no value.