net.rim.device.api.ui.component.table
Class TableModel

java.lang.Object
  extended by net.rim.device.api.ui.component.table.DataModel
      extended by net.rim.device.api.ui.component.table.AbstractTableModel
          extended by net.rim.device.api.ui.component.table.TableModel
Direct Known Subclasses:
SortedTableModel

public class TableModel
extends AbstractTableModel

Implemetation of AbstractTableModel that allows storage of any kind of data and supports all accessor/mutator methods.

Since:
BlackBerry API 6.0.0

Constructor Summary
TableModel()
          Creates a new data model with zero rows and zero columns.
TableModel(Object[][] elements)
          Creates a new table model using the provided elements as the data.
 
Method Summary
protected  boolean doAddColumn(Object data)
          This method provides the ability to customize the logic behind addColumn() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doAddRow(Object data)
          This method provides the ability to customize the logic behind addRow() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  Object doGetColumn(int columnIndex)
          This method provides the ability to customize the logic behind getColumn() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  Object doGetElement(int rowIndex, int columnIndex)
          This method provides the ability to customize the logic behind getElement() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  Object doGetRow(int rowIndex)
          This method provides the ability to customize the logic behind getRow() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doInsertColumnAt(int columnIndex, Object data)
          This method provides the ability to customize the logic behind insertColumnAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doInsertRowAt(int rowIndex, Object data)
          This method provides the ability to customize the logic behind insertRowAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doRemoveColumnAt(int columnIndex)
          This method provides the ability to customize the logic behind removeColumnAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doRemoveRowAt(int rowIndex)
          This method provides the ability to customize the logic behind removeRowAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
protected  boolean doSetElement(int rowIndex, int columnIndex, Object data)
          This method provides the ability to customize the logic behind setElement() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well.
 int getNumberOfColumns()
          Get the number of columns in the table.
 int getNumberOfRows()
          Get the number of rows in the table.
 
Methods inherited from class net.rim.device.api.ui.component.table.AbstractTableModel
addColumn, addColumn, addRow, addRow, getColumn, getElement, getRow, insertColumnAt, insertColumnAt, insertRowAt, insertRowAt, removeColumnAt, removeColumnAt, removeRowAt, removeRowAt, setElement, setElement
 
Methods inherited from class net.rim.device.api.ui.component.table.DataModel
modelReset, notifyListeners, registerListener, unregisterListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

TableModel

public TableModel()
Creates a new data model with zero rows and zero columns.

Since:
BlackBerry API 6.0.0

TableModel

public TableModel(Object[][] elements)
Creates a new table model using the provided elements as the data.

Notifications are not sent out for elements that are added through the constructor.

Parameters:
elements - Array of arrays representing a matrix to be inserted in this data model.
Since:
BlackBerry API 6.0.0


Method Detail

doGetColumn

protected Object doGetColumn(int columnIndex)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind getColumn() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall getColumn() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doGetColumn in class AbstractTableModel
Parameters:
columnIndex - Column index to retreive the elements from.
Returns:
Column at the specified index.
See Also:
AbstractTableModel.doGetColumn(int)
Since:
BlackBerry API 6.0.0

doGetRow

protected Object doGetRow(int rowIndex)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind getRow() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall getRow() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doGetRow in class AbstractTableModel
Parameters:
rowIndex - Row index to retrieve the elements from.
Returns:
Row at the specified index.
See Also:
AbstractTableModel.doGetRow(int)
Since:
BlackBerry API 6.0.0

doGetElement

protected Object doGetElement(int rowIndex,
                              int columnIndex)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind getElement() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall getElement() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doGetElement in class AbstractTableModel
Parameters:
rowIndex - Row index to retrieve the element from.
columnIndex - Column index to retrieve the elements from.
Returns:
Element at the specified indices.
See Also:
AbstractTableModel.doGetElement(int, int)
Since:
BlackBerry API 6.0.0

getNumberOfColumns

public int getNumberOfColumns()
Description copied from class: AbstractTableModel
Get the number of columns in the table.

Specified by:
getNumberOfColumns in class AbstractTableModel
Returns:
the number of columns in the table.
See Also:
AbstractTableModel.getNumberOfColumns()
Since:
BlackBerry API 6.0.0

getNumberOfRows

public int getNumberOfRows()
Description copied from class: AbstractTableModel
Get the number of rows in the table.

Specified by:
getNumberOfRows in class AbstractTableModel
Returns:
the number of rows in the table
See Also:
AbstractTableModel.getNumberOfRows()
Since:
BlackBerry API 6.0.0

doAddColumn

protected boolean doAddColumn(Object data)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind addColumn() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall addColumn() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doAddColumn in class AbstractTableModel
Parameters:
data - The column data to be added to the model.
Returns:
True if the column was added to the model. False otherwise.
See Also:
AbstractTableModel.addColumn(Object)
Since:
BlackBerry API 6.0.0

doAddRow

protected boolean doAddRow(Object data)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind addRow() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall addRow() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doAddRow in class AbstractTableModel
Returns:
True if the row was added to the model. False otherwise.
See Also:
AbstractTableModel.addRow(Object)
Since:
BlackBerry API 6.0.0

doInsertColumnAt

protected boolean doInsertColumnAt(int columnIndex,
                                   Object data)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind insertColumnAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall insertColumnAt() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doInsertColumnAt in class AbstractTableModel
Parameters:
columnIndex - Index at which to insert the column.
data - Column of data to be inserted.
Returns:
True if the column was inserted. False otherwise.
See Also:
AbstractTableModel.insertColumnAt(int, Object)
Since:
BlackBerry API 6.0.0

doInsertRowAt

protected boolean doInsertRowAt(int rowIndex,
                                Object data)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind insertRowAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall insertRowAt() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doInsertRowAt in class AbstractTableModel
data - Column of data to be inserted.
Returns:
True if the column was inserted. False otherwise.
See Also:
AbstractTableModel.insertRowAt(int, Object)
Since:
BlackBerry API 6.0.0

doRemoveColumnAt

protected boolean doRemoveColumnAt(int columnIndex)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind removeColumnAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall removeColumnAt() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doRemoveColumnAt in class AbstractTableModel
Parameters:
columnIndex - The index of the column to be removed.
Returns:
True if the column was removed. False otherwise.
See Also:
AbstractTableModel.removeColumnAt(int)
Since:
BlackBerry API 6.0.0

doRemoveRowAt

protected boolean doRemoveRowAt(int rowIndex)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind removeRowAt() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall removeRowAt() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doRemoveRowAt in class AbstractTableModel
Parameters:
rowIndex - The index of the row to be removed.
Returns:
True if the row was removed. False otherwise.
See Also:
AbstractTableModel.removeRowAt(int)
Since:
BlackBerry API 6.0.0

doSetElement

protected boolean doSetElement(int rowIndex,
                               int columnIndex,
                               Object data)
Description copied from class: AbstractTableModel
This method provides the ability to customize the logic behind setElement() so that a developer can specify this behavior while still ensuring that necessary notification and exception handling overheads can occur as well. This way, the general structure of the overall setElement() algorithm doesn’t change, while allowing key behavior to be configurable.

Specified by:
doSetElement in class AbstractTableModel
Parameters:
rowIndex - Index of row in which to insert.
columnIndex - Index of column in which to insert.
data - Element of data to insert.
Returns:
True if the element was inserted. False otherwise.
See Also:
AbstractTableModel.setElement(int, int, Object)
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.