|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ui.component.table.DataModel
net.rim.device.api.ui.component.table.AbstractTableModel
public abstract class AbstractTableModel
A model for table components. Implementations of AbstractTableModel provide a representation of the data to be displayed in the view, e.g. concrete data structures, or an adapter to data stores in an alternative structure. It should handle requests from the controller and subsequently notify the view of any changes via listeners.
| Constructor Summary | ||
|---|---|---|
AbstractTableModel()
Default constructor. |
||
| Method Summary | ||
|---|---|---|
void |
addColumn(Object data)
Add a column to the data model. |
|
void |
addColumn(Object data,
boolean doNotifyListeners)
Add a column to the data model. |
|
void |
addMultipleRows(Object[] data)
Adds multiple rows to the model. |
|
void |
addRow(Object data)
Add a row to the model. |
|
void |
addRow(Object data,
boolean doNotifyListeners)
Add a row to the model. |
|
protected abstract 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 |
doAddMultipleRows(Object[] data)
This method provides the ability to customize the logic behind addMultipleRows()
so that a developer can specify this behavior while still ensuring that necessary notification
and exception handling overheads can occur as well. |
|
protected abstract 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 abstract 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 abstract 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 abstract 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 abstract 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 |
doInsertMultipleRowsAt(int rowIndex,
Object[] data)
This method provides the ability to customize the logic behind insertMultipleRowsAt()
so that a developer can specify this behavior while still ensuring that necessary notification
and exception handling overheads can occur as well. |
|
protected abstract 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 abstract 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 abstract 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 |
doRemoveRowRangeAt(int rowIndex,
int rowCount)
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 abstract 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. |
|
Object |
getColumn(int columnIndex)
Retrieves the array of elements at the specified column index. |
|
Object |
getElement(int rowIndex,
int columnIndex)
Retrieves the element at the specified row index and column index. |
|
abstract int |
getNumberOfColumns()
Get the number of columns in the table. |
|
abstract int |
getNumberOfRows()
Get the number of rows in the table. |
|
Object |
getRow(int rowIndex)
Retrieves the array of elements at the specified row index. |
|
boolean |
implementationSupportsBatchOperations()
Indicates whether this particular implementation supports aggregate batch operations using AbstractTableModel.addMultipleRows(Object[]),
AbstractTableModel.insertMultipleRowsAt(int, Object[]) and
AbstractTableModel.removeRowRangeAt(int, int). |
|
void |
insertColumnAt(int columnIndex,
Object data)
Inserts a column to the model at the specified index. |
|
void |
insertColumnAt(int columnIndex,
Object data,
boolean doNotifyListeners)
Inserts a column to the model at the specified index. |
|
void |
insertMultipleRowsAt(int index,
Object[] data)
Inserts multiple rows to the model. |
|
void |
insertRowAt(int rowIndex,
Object data)
Inserts a row to the model at the specified index. |
|
void |
insertRowAt(int rowIndex,
Object data,
boolean doNotifyListeners)
Inserts a row to the model at the specified index. |
|
void |
removeColumnAt(int columnIndex)
Deletes a column from the model at the specified index. |
|
void |
removeColumnAt(int columnIndex,
boolean doNotifyListeners)
Deletes a column from the model at the specified index. |
|
void |
removeRowAt(int rowIndex)
Deletes a row from the model at the specified index. |
|
void |
removeRowAt(int rowIndex,
boolean doNotifyListeners)
Deletes a row from the model at the specified index. |
|
void |
removeRowRangeAt(int rowIndex,
int rowCount)
Deletes a range of rows from the model at a specified index. |
|
void |
setElement(int rowIndex,
int columnIndex,
Object data)
Sets the element at specified rowIndex and columnIndex. |
|
void |
setElement(int rowIndex,
int columnIndex,
Object data,
boolean doNotifyListeners)
Sets the element at specified rowIndex and columnIndex. |
|
| 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 |
|---|
public AbstractTableModel()
| Method Detail |
|---|
public final Object getColumn(int columnIndex)
throws IllegalArgumentException
columnIndex - Column index to retrieve the elements from.
IllegalArgumentException - If the index is invalid.protected abstract Object doGetColumn(int columnIndex)
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.
columnIndex - Column index to retreive the elements from.
public final Object getRow(int rowIndex)
throws IllegalArgumentException
rowIndex - Row index to retrieve the elements from.
IllegalArgumentException - If the index is invalid.protected abstract Object doGetRow(int rowIndex)
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.
rowIndex - Row index to retrieve the elements from.
public final Object getElement(int rowIndex,
int columnIndex)
throws IllegalArgumentException
rowIndex - Row index to retrieve the element from.columnIndex - Column index to retrieve the elements from.
IllegalArgumentException - If the row index or column index is invalid.
protected abstract Object doGetElement(int rowIndex,
int columnIndex)
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.
rowIndex - Row index to retrieve the element from.columnIndex - Column index to retrieve the elements from.
public abstract int getNumberOfColumns()
public abstract int getNumberOfRows()
public final void addColumn(Object data,
boolean doNotifyListeners)
throws IllegalArgumentException
AbstractTableModel.getNumberOfRows(). If there is 1 row then data can be any object.
After the add is done the listeners are notified.
data - The column data to be added to the model.doNotifyListeners - True if listeners should be notified of changes. False otherwise.
IllegalArgumentException - If data is null or has invalid row count.- Since:
- BlackBerry API 6.0.0
public final void addColumn(Object data)
throws IllegalArgumentException
AbstractTableModel.getNumberOfRows(). If there is 1 row then data can be any object.
After the add is done the listeners are notified.
data - The column data to be added to the model.
IllegalArgumentException - If data is null or has invalid row count.- See Also:
AbstractTableModel.addColumn(Object, boolean)- Since:
- BlackBerry API 6.0.0
protected abstract boolean doAddColumn(Object data)
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.
data - The column data to be added to the model.
public final void addRow(Object data,
boolean doNotifyListeners)
throws IllegalArgumentException
AbstractTableModel.getNumberOfColumns() if there is 1 column then element can be any object.
After the add is done the listeners are notified.
data - The row data to be added to the model.doNotifyListeners - True if listeners should be notified of changes. False otherwise.
IllegalArgumentException - If data is null or has invalid column count.- Since:
- BlackBerry API 6.0.0
public boolean implementationSupportsBatchOperations()
AbstractTableModel.addMultipleRows(Object[]),
AbstractTableModel.insertMultipleRowsAt(int, Object[]) and
AbstractTableModel.removeRowRangeAt(int, int).
This will determine whether these methods will perform operations
as a contiguous operation, with a single notification event, or whether
they will perform row-by-row operation with discrete notifications.
Properly implementing these methods will provide significant performance improvements.
public final void addMultipleRows(Object[] data)
throws IllegalArgumentException
AbstractTableModel.getNumberOfColumns() if there is 1 column then the element can be any object.
After the elements are added, the listeners are notified.
The behaviour of this method depends on the return value of AbstractTableModel.implementationSupportsBatchOperations().
This method indicates whether a subclass has provided an implementation of the required methods:
AbstractTableModel.doAddMultipleRows(Object[]), AbstractTableModel.doInsertMultipleRowsAt(int, Object[]) and
AbstractTableModel.doRemoveRowRangeAt(int, int).
If implementationSupportsBatchOperations() is true, then multiple rows can be
added in a batch operation, with a single TableModelChangeEvent notification.
Otherwise, each row is added individually with AbstractTableModel.addRow(Object), with a
TableModelChangeEvent notification occurring for each row added.
This will cause an incremental layout for each row added, compared to a single layout for
classes which support batch operations.
data - The row data to be added to the model.
IllegalArgumentException - If data is null or has invalid column count.
public final void insertMultipleRowsAt(int index,
Object[] data)
AbstractTableModel.getNumberOfColumns() if there is one column then
the element can be any object. After the elements are added, the listeners are notified.
The behaviour of this method depends on the return value of AbstractTableModel.implementationSupportsBatchOperations().
This method indicates whether a subclass has provided an implementation of the required methods:
AbstractTableModel.doAddMultipleRows(Object[]), AbstractTableModel.doInsertMultipleRowsAt(int, Object[]) and
AbstractTableModel.doRemoveRowRangeAt(int, int).
If implementationSupportsBatchOperations() is true, then multiple rows can be
inserted in a batch operation, with a single TableModelChangeEvent notification.
Otherwise, each row is inserted individually with AbstractTableModel.insertRowAt(int, Object), with a
TableModelChangeEvent notification occurring for each row inserted.
This will cause an incremental layout for each row inserted, compared to a single layout for
classes which support batch operations.
index - The index for the start of the inserteddata - The row data to be added to the model.
IllegalArgumentException - if data is null or has invalid column count.
public final void addRow(Object data)
throws IllegalArgumentException
AbstractTableModel.getNumberOfColumns() if there is 1 column then element can be any object.
After the add is done the listeners are notified.
data - The row data to be added to the model.
IllegalArgumentException - If data is null or has invalid column count.- See Also:
AbstractTableModel.addRow(Object, boolean)- Since:
- BlackBerry API 6.0.0
protected abstract boolean doAddRow(Object data)
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.
data - The row data to be added to the model.
protected boolean doAddMultipleRows(Object[] data)
addMultipleRows()
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 addMultipleRows() algorithm doesn't change, while allowing
key behavior to be configurable.
The default behavior is not implemented.
If this method returns false, the base implementation will insert the rows with multiple
calls to addRow(). As such, implementations of doAddMultipleRows()
should ensure that rows are added atomically.
data - The rows of data to be added to the model.
public final void removeColumnAt(int columnIndex,
boolean doNotifyListeners)
throws IllegalArgumentException
columnIndex - Column index to delete the column at.doNotifyListeners - True if listeners should be notified of changes. False otherwise.
IllegalArgumentException - If columnIndex is invalid.
public final void removeColumnAt(int columnIndex)
throws IllegalArgumentException
columnIndex - Column index to delete the column at.
IllegalArgumentException - If columnIndex is invalid.AbstractTableModel.removeColumnAt(int, boolean)protected abstract boolean doRemoveColumnAt(int columnIndex)
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.
columnIndex - The index of the column to be removed.
public final void removeRowAt(int rowIndex,
boolean doNotifyListeners)
throws IllegalArgumentException
rowIndex - Row index to delete the row at.doNotifyListeners - True if listeners should be notified of changes. False otherwise.
IllegalArgumentException - If rowIndex is invalid.
public final void removeRowAt(int rowIndex)
throws IllegalArgumentException
rowIndex - Row index to delete the row at.
IllegalArgumentException - If rowIndex is invalid.AbstractTableModel.removeRowAt(int, boolean)
public final void removeRowRangeAt(int rowIndex,
int rowCount)
throws IllegalArgumentException
AbstractTableModel.implementationSupportsBatchOperations().
This method indicates whether a subclass has provided an implementation of the required methods:
AbstractTableModel.doAddMultipleRows(Object[]), AbstractTableModel.doInsertMultipleRowsAt(int, Object[]) and
AbstractTableModel.doRemoveRowRangeAt(int, int).
If implementationSupportsBatchOperations() is true, then multiple rows can be
removed in a batch operation, with a single TableModelChangeEvent notification.
Otherwise, each row is removed individually with AbstractTableModel.removeRowAt(int), with a
TableModelChangeEvent notification occurring for each row removed.
This will cause an incremental layout for each row removed, compared to a single layout for
classes which support batch operations.
rowIndex - the index of the start of the range to be deletedrowCount - the number of elements to be deleted
IllegalArgumentException - If rowIndex is invalid, or rowCount is invalid.protected abstract boolean doRemoveRowAt(int rowIndex)
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.
rowIndex - The index of the row to be removed.
protected boolean doRemoveRowRangeAt(int rowIndex,
int rowCount)
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.
rowIndex - Index of row to be removed.rowCount - The number of rows to remove
public final void insertColumnAt(int columnIndex,
Object data,
boolean doNotifyListeners)
throws IllegalArgumentException
columnIndex - Index at which to insert the column.data - Column of data to be inserted.doNotifyListeners - True if listeners should be notified. False otherwise.
IllegalArgumentException - If columnIndex is invalid or data is invalid.
public final void insertColumnAt(int columnIndex,
Object data)
throws IllegalArgumentException
columnIndex - Index at which to insert the column.data - Column of data to be inserted.
IllegalArgumentException - If columnIndex is invalid or data is invalid.AbstractTableModel.insertColumnAt(int, Object, boolean)
protected abstract boolean doInsertColumnAt(int columnIndex,
Object data)
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.
columnIndex - Index at which to insert the column.data - Column of data to be inserted.
public final void insertRowAt(int rowIndex,
Object data,
boolean doNotifyListeners)
throws IllegalArgumentException
rowIndex - Index at which to insert the row.data - Row of data to be inserted.doNotifyListeners - True if listeners should be notified. False otherwise.
IllegalArgumentException - If rowIndex is invalid or data is invalid.
public final void insertRowAt(int rowIndex,
Object data)
throws IllegalArgumentException
rowIndex - Index at which to insert the row.data - Row of data to be inserted.
IllegalArgumentException - If rowIndex is invalid or data is invalid.AbstractTableModel.insertRowAt(int, Object, boolean)
protected abstract boolean doInsertRowAt(int rowIndex,
Object data)
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.
rowIndex - Index at which to insert the column.data - Column of data to be inserted.
protected boolean doInsertMultipleRowsAt(int rowIndex,
Object[] data)
insertMultipleRowsAt()
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
insertMultipleRowsAt() algorithm doesn't change, while allowing key behavior to be configurable.\
The default behaviour is not implemented.
If this method returns false, the base implementation will insert the rows with multiple
calls to insertRowAt(). As such, implementations of doInsertMultipleRowsAt()
should ensure that rows are added atomically.
rowIndex - Index of row in which to insert.data - Array of row data to insert
public final void setElement(int rowIndex,
int columnIndex,
Object data,
boolean doNotifyListeners)
throws IllegalArgumentException
rowIndex - Index of row in which to insert.columnIndex - Index of column in which to insert.data - Element of data to insert.doNotifyListeners - True if listeners should be notified. False otherwise.
IllegalArgumentException - If rowIndex is invalid or columnIndex is invalid.
public final void setElement(int rowIndex,
int columnIndex,
Object data)
throws IllegalArgumentException
rowIndex - Index of row in which to insert.columnIndex - Index of column in which to insert.data - Element of data to insert.
IllegalArgumentException - If rowIndex is invalid or columnIndex is invalid.AbstractTableModel.setElement(int, int, Object, boolean)
protected abstract boolean doSetElement(int rowIndex,
int columnIndex,
Object data)
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.
rowIndex - Index of row in which to insert.columnIndex - Index of column in which to insert.data - Element of data to insert.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal