| |
|
| com.sun.data.provider.TableDataProvider
All known Subclasses: com.sun.data.provider.impl.AbstractTableDataProvider, com.sun.data.provider.impl.CachedRowSetDataProvider, com.sun.data.provider.impl.MethodResultTableDataProvider,
TableDataProvider | public interface TableDataProvider extends DataProvider(Code) | | TableDataProvider is a specialized subinterface of
DataProvider that provides access to a scrollable set of "rows" of data elements, with
each row being identified by a
RowKey . Access to the underlying
data elements may be done in a random fashion by using the methods defined
in this interface, or you can set the cursor row and use the
getType() , getValue() , isReadOnly() ,
and setValue() methods from the base
DataProvider interface to access data elements for the cursor row specified by calling
setCursorRow(RowKey) .
The set of
FieldKey s returned by getFieldKeys()
MUST be available on every row supported by this
TableDataProvider . This implies a rectangular (matrix) dataset.
The set of
RowKey s returned by getRowKeys(...) are
expected to uniquely represent the rows contained in the underlying data
source. The RowKey objects should remain valid as long as the set of rows
in the TableDataProvider has not been re-fetched. Once a re-fetch has
happened (by whatever means are supplied by specific TableDataProvider
implementations), the previously fetched RowKeys may become invalid. Consult
the documentation of the specific TableDataProvider implementation for
details on the expected valid lifespan of a RowKey.
Most methods throw
DataProviderException , which is a generic
runtime exception indicating something is amiss in the internal state of the
TableDataProvider implementation. Because DPE is a runtime exception, method
calls are not required to be wrapped in a try...catch block, but it is
advised to check the documentation of the particular TableDataProvider
implementation to see what conditions will cause a DataProviderException to
be thrown. It is recommended to always wrap calls to this interface in
try...catch blocks in case an unforseen error condition arises at runtime.
author: Joe Nuxoll author: Matthew Bohm |
Method Summary | |
public void | addTableCursorListener(TableCursorListener listener) | public void | addTableDataListener(TableDataListener listener) | public RowKey | appendRow() Appends a new row at the end of the list and returns the row key for
the newly appended row.
NOTE: The method should only be called after testing the
canAppendRow() method to see if this TableDataProvider
supports the append operation.
The row key for the newly appended row throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). | public boolean | canAppendRow() This method is called to test if this TableDataProvider supports
the append operation. | public boolean | canInsertRow(RowKey beforeRow) This method is called to test if this TableDataProvider supports
resizability. | public boolean | canRemoveRow(RowKey rowKey) This method is called to test if this TableDataProvider supports
the removeRow operation. | public boolean | cursorFirst() Move the cursor to the first row in this TableDataProvider.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. | public boolean | cursorLast() Move the cursor to the last row in this TableDataProvider.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. | public boolean | cursorNext() Move the cursor to the row after the current cursor row, unless the
cursor is currently at the last row
TableDataProvider .
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. | public boolean | cursorPrevious() Move the cursor to the row before the current cursor row, unless
the cursor is currently at the first row.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. | public RowKey | getCursorRow() the RowKey of the current cursor row position throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). | public int | getRowCount() the number of rows represented by thisTableDataProvider if this information is available;otherwise, return -1 (indicating unknown row count) throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning -1. | public RowKey | getRowKey(String rowId) Returns a RowKey for the specified rowId. | public RowKey[] | getRowKeys(int count, RowKey afterRow) Returns an array of
RowKey objects representing the requested
batch of RowKeys. | public TableCursorListener[] | getTableCursorListeners() An array of the TableCursorListeners currently registeredon this TableDataProvider. | public TableDataListener[] | getTableDataListeners() An array of the TableDataListeners currently registeredon this TableDataProvider. | public Object | getValue(FieldKey fieldKey, RowKey rowKey) Return value of the data element referenced by the specified
FieldKey and
RowKey .
Parameters: fieldKey - FieldKey identifying the data elementwhose value is to be returned Parameters: rowKey - RowKey identifying the data row whose valueis to be returned value of the data element referenced by the specifiedFieldKey and RowKey throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning null. | public RowKey | insertRow(RowKey beforeRow) Inserts a new row at the specified row.
NOTE: The method should only be called after testing the
canInsertRow(RowKey beforeRow) to see if this
TableDataProvider supports resizing.
Parameters: beforeRow - The desired location to insert the new row in front of A RowKey representing the address of the newly inserted row throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). | public boolean | isRowAvailable(RowKey rowKey) Returns true if the specified
RowKey represents
data elements that are supported by this
TableDataProvider ;
otherwise, return false
Parameters: rowKey - RowKey specifying row to be tested true if the row is available, false ifnot throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. | public void | removeRow(RowKey rowKey) Removes the specified row.
NOTE: The method should only be called after testing the
canRemoveRow(RowKey) method to see if this TableDataProvider
supports removing rows.
Parameters: rowKey - The desired row key to remove throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). | public void | removeTableCursorListener(TableCursorListener listener) | public void | removeTableDataListener(TableDataListener listener) | public void | setCursorRow(RowKey rowKey) Sets the cursor to the row represented by the passed
RowKey .
Parameters: rowKey - New RowKey to move the cursor to. throws: TableCursorVetoException - if a TableCursorListener decides toveto the cursor navigation throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). | public void | setValue(FieldKey fieldKey, RowKey rowKey, Object value) Sets the value of the data element represented by the specified
FieldKey and
RowKey to the specified new value.
Parameters: fieldKey - FieldKey identifying the data elementwhose value is to be modified Parameters: rowKey - RowKey indentifying the data row whose valueis to be modified Parameters: value - New value for this data element throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). |
appendRow | public RowKey appendRow() throws DataProviderException(Code) | | Appends a new row at the end of the list and returns the row key for
the newly appended row.
NOTE: The method should only be called after testing the
canAppendRow() method to see if this TableDataProvider
supports the append operation.
The row key for the newly appended row throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). Consultthe documentation of the specific TableDataProviderimplementation for details on what exceptions might be wrappedby a DPE. See Also: TableDataProvider.canAppendRow() |
canAppendRow | public boolean canAppendRow() throws DataProviderException(Code) | | This method is called to test if this TableDataProvider supports
the append operation. If rows can be appended to the list, this method
should return true . If the data provider is not resizable,
or cannot support an append operation, this method should return
false .
true if the data provider supports the appendoperation, or false if not. throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this RowKey does notrepresent a row provided by this TableDataProvider. Consult thedocumentation of the specific TableDataProvider implementationfor details on what exceptions might be wrapped by a DPE. See Also: TableDataProvider.appendRow() |
canInsertRow | public boolean canInsertRow(RowKey beforeRow) throws DataProviderException(Code) | | This method is called to test if this TableDataProvider supports
resizability. If objects can be inserted and removed from the list,
this method should return true . If the data provider is
not resizable, this method should return false .
The following methods will only be called if this method returns
true :
insertRow(RowKey beforeRow)
appendRow()
removeRow(RowKey rowKey)
Parameters: beforeRow - The desired location to insert the new row in front of true if the data provider is resizable, orfalse if not. throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. A DPE may also indicate that thisRowKey does not represent a row provided by thisTableDataProvider. Consult the documentation of the specificTableDataProvider implementation for details on what exceptionsmight be wrapped by a DPE. See Also: TableDataProvider.insertRow(RowKey) |
canRemoveRow | public boolean canRemoveRow(RowKey rowKey) throws DataProviderException(Code) | | This method is called to test if this TableDataProvider supports
the removeRow operation. If rows can be removed from the table, this
method should return true . If the data provider is does
not support removing rows, this method should return false .
Parameters: rowKey - The desired row to remove true if the data provider supports removing rows,or false if not. throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this RowKey does notrepresent a row provided by this TableDataProvider. Consultthe documentation of the specific TableDataProviderimplementation for details on what exceptions might be wrappedby a DPE. See Also: TableDataProvider.removeRow(RowKey) |
cursorFirst | public boolean cursorFirst() throws DataProviderException(Code) | | Move the cursor to the first row in this TableDataProvider.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
cursorLast | public boolean cursorLast() throws DataProviderException(Code) | | Move the cursor to the last row in this TableDataProvider.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
cursorNext | public boolean cursorNext() throws DataProviderException(Code) | | Move the cursor to the row after the current cursor row, unless the
cursor is currently at the last row
TableDataProvider .
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
cursorPrevious | public boolean cursorPrevious() throws DataProviderException(Code) | | Move the cursor to the row before the current cursor row, unless
the cursor is currently at the first row.
true if the cursor row was successfully changed;else false throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
getCursorRow | public RowKey getCursorRow() throws DataProviderException(Code) | | the RowKey of the current cursor row position throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). Consultthe documentation of the specific TableDataProviderimplementation for details on what exceptions might be wrappedby a DPE. |
getRowCount | public int getRowCount() throws DataProviderException(Code) | | the number of rows represented by thisTableDataProvider if this information is available;otherwise, return -1 (indicating unknown row count) throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning -1. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
getRowKey | public RowKey getRowKey(String rowId) throws DataProviderException(Code) | | Returns a RowKey for the specified rowId. This allows a RowKey to be
stored off as a simple string, which can be resolved into an instance
of a RowKey at a later date.
Parameters: rowId - The cannoncial string ID of the desired RowKey A RowKey object representing the desired row, ornull if the specified rowId does not correspond toa row in this TableDataProvider throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning null. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
getRowKeys | public RowKey[] getRowKeys(int count, RowKey afterRow) throws DataProviderException(Code) | | Returns an array of
RowKey objects representing the requested
batch of RowKeys. If null is passed as the afterRow
parameter, the returned batch of RowKeys will start with the first one.
Parameters: count - The desired count of RowKeys to fetch. If this numberexceeds the total number of rows available, the return arraywill contain the available number, and no exception will bethrown. Consider this an optimistic request of theTableDataProvider. Parameters: afterRow - The RowKey that represents the last row before the setof desired RowKeys to be returned. Typically, this is the lastRowKey from the previously fetched set of RowKeys. Ifnull is passed, the returned set will begin with thefirst row. An array of RowKey objects representing the requested batch ofrows. throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning null or an empty array. Consult thedocumentation of the specific TableDataProvider implementationfor details on what exceptions might be wrapped by a DPE. |
getTableCursorListeners | public TableCursorListener[] getTableCursorListeners()(Code) | | An array of the TableCursorListeners currently registeredon this TableDataProvider. If there are no registered listeners,a zero-length array is returned. |
getTableDataListeners | public TableDataListener[] getTableDataListeners()(Code) | | An array of the TableDataListeners currently registeredon this TableDataProvider. If there are no registered listeners,a zero-length array is returned. |
getValue | public Object getValue(FieldKey fieldKey, RowKey rowKey) throws DataProviderException(Code) | | Return value of the data element referenced by the specified
FieldKey and
RowKey .
Parameters: fieldKey - FieldKey identifying the data elementwhose value is to be returned Parameters: rowKey - RowKey identifying the data row whose valueis to be returned value of the data element referenced by the specifiedFieldKey and RowKey throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning null. A DPE may also indicate that thisFieldKey or RowKey does not representa data element provided by this TableDataProvider. Consult thedocumentation of the specific TableDataProvider implementationfor details on what exceptions might be wrapped by a DPE. |
insertRow | public RowKey insertRow(RowKey beforeRow) throws DataProviderException(Code) | | Inserts a new row at the specified row.
NOTE: The method should only be called after testing the
canInsertRow(RowKey beforeRow) to see if this
TableDataProvider supports resizing.
Parameters: beforeRow - The desired location to insert the new row in front of A RowKey representing the address of the newly inserted row throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this RowKey does notrepresent a row provided by this TableDataProvider. Consult thedocumentation of the specific TableDataProvider implementationfor details on what exceptions might be wrapped by a DPE. See Also: TableDataProvider.canInsertRow(RowKey) |
isRowAvailable | public boolean isRowAvailable(RowKey rowKey) throws DataProviderException(Code) | | Returns true if the specified
RowKey represents
data elements that are supported by this
TableDataProvider ;
otherwise, return false
Parameters: rowKey - RowKey specifying row to be tested true if the row is available, false ifnot throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException) ratherthan simply returning false. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
removeRow | public void removeRow(RowKey rowKey) throws DataProviderException(Code) | | Removes the specified row.
NOTE: The method should only be called after testing the
canRemoveRow(RowKey) method to see if this TableDataProvider
supports removing rows.
Parameters: rowKey - The desired row key to remove throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this RowKey does notrepresent a row provided by this TableDataProvider. Consultthe documentation of the specific TableDataProviderimplementation for details on what exceptions might be wrappedby a DPE. See Also: TableDataProvider.canRemoveRow(RowKey) |
setCursorRow | public void setCursorRow(RowKey rowKey) throws TableCursorVetoException(Code) | | Sets the cursor to the row represented by the passed
RowKey .
Parameters: rowKey - New RowKey to move the cursor to. throws: TableCursorVetoException - if a TableCursorListener decides toveto the cursor navigation throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this RowKey does notrepresent a row provided by this TableDataProvider. Consultthe documentation of the specific TableDataProviderimplementation for details on what exceptions might be wrappedby a DPE. |
setValue | public void setValue(FieldKey fieldKey, RowKey rowKey, Object value) throws DataProviderException(Code) | | Sets the value of the data element represented by the specified
FieldKey and
RowKey to the specified new value.
Parameters: fieldKey - FieldKey identifying the data elementwhose value is to be modified Parameters: rowKey - RowKey indentifying the data row whose valueis to be modified Parameters: value - New value for this data element throws: DataProviderException - Implementations may wish to surfaceinternal exceptions (nested in DataProviderException). A DPEmay also indicate that this FieldKey orRowKey does not represent a data element providedby this TableDataProvider. Consult the documentation of thespecific TableDataProvider implementation for details on whatexceptions might be wrapped by a DPE. |
|
|
|