|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.data.provider.impl.AbstractDataProvider
com.sun.data.provider.impl.AbstractTableDataProvider
com.sun.data.provider.impl.BasicTransactionalTableDataProvider
public class BasicTransactionalTableDataProvider
Field Summary | |
---|---|
protected java.util.HashMap |
changedRowMap
|
protected TableDataProvider |
provider
|
Fields inherited from class com.sun.data.provider.impl.AbstractTableDataProvider |
---|
cursorRow, rowKeyList, rowKeyMap, tcListeners |
Fields inherited from class com.sun.data.provider.impl.AbstractDataProvider |
---|
dpListeners, fieldKeys |
Constructor Summary | |
---|---|
BasicTransactionalTableDataProvider()
|
Method Summary | |
---|---|
void |
addTransactionalDataListener(TransactionalDataListener l)
Register a new |
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
|
boolean |
canAppendRow()
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 |
boolean |
canInsertRow(RowKey beforeRow)
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 The following methods will only be called if this method returns
|
boolean |
canRemoveRow(RowKey row)
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 |
void |
commitChanges()
Cause any cached changes to values of data elements supported by this DataProvider to be passed through to the underlying data
structure. |
protected void |
fireChangesCommitted()
Fires a changesCommtted event to each registered TransactionalDataListener |
protected void |
fireChangesReverted()
Fires a changesReverted event to each registered TransactionalDataListener |
FieldKey |
getFieldKey(java.lang.String fieldId)
Returns the |
FieldKey[] |
getFieldKeys()
|
int |
getRowCount()
|
RowKey |
getRowKey(java.lang.String rowId)
Returns a RowKey for the specified rowId. |
RowKey[] |
getRowKeys(int count,
RowKey afterRow)
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. |
TableDataProvider |
getTableDataProvider()
|
TransactionalDataListener[] |
getTransactionalDataListeners()
|
java.lang.Class |
getType(FieldKey fieldKey)
Returns the data type of the data element referenced by the specified data key. |
java.lang.Object |
getValue(FieldKey fieldKey,
RowKey row)
Return value of the data element referenced by the specified
|
RowKey |
insertRow(RowKey beforeRow)
Inserts a new row at the specified row. NOTE: The method should only be called after testing the
|
boolean |
isReadOnly(FieldKey fieldKey)
Return a flag indicating whether the value of the data element
represented by the specified |
boolean |
isRowAvailable(RowKey row)
Returns true if the specified RowKey represents
data elements that are supported by this TableDataProvider ;
otherwise, return false |
void |
removeRow(RowKey row)
Removes the specified row. NOTE: The method should only be called after testing the
|
void |
removeTransactionalDataListener(TransactionalDataListener l)
Deregister an existing |
void |
revertChanges()
Cause any cached changes to values of data elements supported by this DataProvider to be thrown away, so that the initial values are
again visible. |
void |
setTableDataProvider(TableDataProvider provider)
|
void |
setValue(FieldKey fieldKey,
RowKey row,
java.lang.Object value)
Sets the value of the data element represented by the specified
|
Methods inherited from class com.sun.data.provider.impl.AbstractTableDataProvider |
---|
addTableCursorListener, addTableDataListener, cursorFirst, cursorLast, cursorNext, cursorPrevious, findAll, findAll, findAll, findAll, findFirst, findFirst, findFirst, findFirst, fireCursorChanged, fireCursorChanging, fireRowAdded, fireRowRemoved, fireValueChanged, getAllRows, getCursorIndex, getCursorRow, getTableCursorListeners, getTableDataListeners, getValue, getValue, removeTableCursorListener, removeTableDataListener, setCursorIndex, setCursorRow, setValue, setValue |
Methods inherited from class com.sun.data.provider.impl.AbstractDataProvider |
---|
addDataListener, addFieldKey, addFieldKeys, clearFieldKeys, fireProviderChanged, fireValueChanged, getDataListeners, getFakeData, getFakeData, getType, getValue, isReadOnly, removeDataListener, removeFieldKey, removeFieldKeys, setValue, sortFieldKeys |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sun.data.provider.DataProvider |
---|
addDataListener, getDataListeners, getValue, removeDataListener, setValue |
Field Detail |
---|
protected TableDataProvider provider
protected java.util.HashMap changedRowMap
Constructor Detail |
---|
public BasicTransactionalTableDataProvider()
Method Detail |
---|
public void setTableDataProvider(TableDataProvider provider)
provider
- TableDataProviderpublic TableDataProvider getTableDataProvider()
public FieldKey[] getFieldKeys() throws DataProviderException
AbstractDataProvider
getFieldKeys
in interface DataProvider
getFieldKeys
in class AbstractDataProvider
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null or an empty array. Consult the
documentation of the specific DataProvider implementation for
details on what exceptions might be wrapped by a DPE.public FieldKey getFieldKey(java.lang.String fieldId) throws DataProviderException
AbstractDataProvider
Returns the FieldKey
associated with the specified data
element canonical id, if any; otherwise, return null
.
getFieldKey
in interface DataProvider
getFieldKey
in class AbstractDataProvider
fieldId
- String
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldId is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.public java.lang.Class getType(FieldKey fieldKey) throws DataProviderException
Returns the data type of the data element referenced by the specified data key.
getType
in interface DataProvider
getType
in class AbstractTableDataProvider
fieldKey
- FieldKey
identifying the data element
whose type is to be returned
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.public boolean isReadOnly(FieldKey fieldKey) throws DataProviderException
Return a flag indicating whether the value of the data element
represented by the specified FieldKey
can be modified via the
setValue()
method.
isReadOnly
in interface DataProvider
isReadOnly
in class AbstractTableDataProvider
fieldKey
- FieldKey
identifying the data element
whose settable status is to be returned
FieldKey
can be modified
via the setValue()
method
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning true. A DPE may also indicate that the
passed fieldKey is not valid. Consult the documentation of the
specific DataProvider implementation for details on what
exceptions might be wrapped by a DPE.public int getRowCount() throws DataProviderException
getRowCount
in interface TableDataProvider
getRowCount
in class AbstractTableDataProvider
TableDataProvider
if this information is available;
otherwise, return -1 (indicating unknown row count)
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning -1. Consult the documentation of the
specific TableDataProvider implementation for details on what
exceptions might be wrapped by a DPE.public RowKey[] getRowKeys(int count, RowKey afterRow) throws DataProviderException
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.
getRowKeys
in interface TableDataProvider
getRowKeys
in class AbstractTableDataProvider
count
- The desired count of RowKeys to fetch. If this number
exceeds the total number of rows available, the return array
will contain the available number, and no exception will be
thrown. Consider this an optimistic request of the
TableDataProvider.afterRow
- The RowKey that represents the last row before the set
of desired RowKeys to be returned. Typically, this is the last
RowKey from the previously fetched set of RowKeys. If
null
is passed, the returned set will begin with the
first row.
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null or an empty array. Consult the
documentation of the specific TableDataProvider implementation
for details on what exceptions might be wrapped by a DPE.public RowKey getRowKey(java.lang.String rowId) throws DataProviderException
getRowKey
in interface TableDataProvider
getRowKey
in class AbstractTableDataProvider
rowId
- The cannoncial string ID of the desired RowKey
null
if the specified rowId does not correspond to
a row in this TableDataProvider
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. Consult the documentation of the
specific TableDataProvider implementation for details on what
exceptions might be wrapped by a DPE.public boolean isRowAvailable(RowKey row) throws DataProviderException
true
if the specified RowKey
represents
data elements that are supported by this TableDataProvider
;
otherwise, return false
isRowAvailable
in interface TableDataProvider
isRowAvailable
in class AbstractTableDataProvider
row
- RowKey specifying row to be tested
true
if the row is available, false
if
not
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning false. Consult the documentation of the
specific TableDataProvider implementation for details on what
exceptions might be wrapped by a DPE.public java.lang.Object getValue(FieldKey fieldKey, RowKey row) throws DataProviderException
Return value of the data element referenced by the specified
FieldKey
and RowKey
.
getValue
in interface TableDataProvider
getValue
in class AbstractTableDataProvider
fieldKey
- FieldKey
identifying the data element
whose value is to be returnedrow
- RowKey
identifying the data row whose value
is to be returned
FieldKey
and RowKey
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning null. A DPE may also indicate that this
FieldKey
or RowKey
does not represent
a data element provided by this TableDataProvider. Consult the
documentation of the specific TableDataProvider implementation
for details on what exceptions might be wrapped by a DPE.public void setValue(FieldKey fieldKey, RowKey row, java.lang.Object value) throws DataProviderException
Sets the value of the data element represented by the specified
FieldKey
and RowKey
to the specified new value.
setValue
in interface TableDataProvider
setValue
in class AbstractTableDataProvider
fieldKey
- FieldKey
identifying the data element
whose value is to be modifiedrow
- RowKey
indentifying the data row whose value
is to be modifiedvalue
- New value for this data element
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). A DPE
may also indicate that this FieldKey
or
RowKey
does not represent a data element provided
by this TableDataProvider. Consult the documentation of the
specific TableDataProvider implementation for details on what
exceptions might be wrapped by a DPE.public boolean canInsertRow(RowKey beforeRow) throws DataProviderException
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)
canInsertRow
in interface TableDataProvider
canInsertRow
in class AbstractTableDataProvider
beforeRow
- The desired location to insert the new row in front of
true
if the data provider is resizable, or
false
if not.
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException) rather
than simply returning false. A DPE may also indicate that this
RowKey
does not represent a row provided by this
TableDataProvider. Consult the documentation of the specific
TableDataProvider implementation for details on what exceptions
might be wrapped by a DPE.TableDataProvider.insertRow(RowKey)
public RowKey insertRow(RowKey beforeRow) throws DataProviderException
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.
insertRow
in interface TableDataProvider
insertRow
in class AbstractTableDataProvider
beforeRow
- The desired location to insert the new row in front of
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). A DPE
may also indicate that this RowKey
does not
represent a row provided by this TableDataProvider. Consult the
documentation of the specific TableDataProvider implementation
for details on what exceptions might be wrapped by a DPE.TableDataProvider.canInsertRow(RowKey)
public boolean canAppendRow() throws DataProviderException
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
.
canAppendRow
in interface TableDataProvider
canAppendRow
in class AbstractTableDataProvider
true
if the data provider supports the append
operation, or false
if not.
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). A DPE
may also indicate that this RowKey
does not
represent a row provided by this TableDataProvider. Consult the
documentation of the specific TableDataProvider implementation
for details on what exceptions might be wrapped by a DPE.TableDataProvider.appendRow()
public RowKey appendRow() throws DataProviderException
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.
appendRow
in interface TableDataProvider
appendRow
in class AbstractTableDataProvider
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). Consult
the documentation of the specific TableDataProvider
implementation for details on what exceptions might be wrapped
by a DPE.TableDataProvider.canAppendRow()
public boolean canRemoveRow(RowKey row) throws DataProviderException
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
.
canRemoveRow
in interface TableDataProvider
canRemoveRow
in class AbstractTableDataProvider
row
- The desired row to remove
true
if the data provider supports removing rows,
or false
if not.
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). A DPE
may also indicate that this RowKey
does not
represent a row provided by this TableDataProvider. Consult
the documentation of the specific TableDataProvider
implementation for details on what exceptions might be wrapped
by a DPE.TableDataProvider.removeRow(RowKey)
public void removeRow(RowKey row) throws DataProviderException
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.
removeRow
in interface TableDataProvider
removeRow
in class AbstractTableDataProvider
row
- The desired row key to remove
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). A DPE
may also indicate that this RowKey
does not
represent a row provided by this TableDataProvider. Consult
the documentation of the specific TableDataProvider
implementation for details on what exceptions might be wrapped
by a DPE.TableDataProvider.canRemoveRow(RowKey)
public void commitChanges() throws DataProviderException
TransactionalDataProvider
Cause any cached changes to values of data elements supported by this
DataProvider
to be passed through to the underlying data
structure.
commitChanges
in interface TransactionalDataProvider
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). Consult
the documentation of the specific DataProvider implementation for
details on what exceptions might be wrapped by a DPE.public void revertChanges() throws DataProviderException
TransactionalDataProvider
Cause any cached changes to values of data elements supported by this
DataProvider
to be thrown away, so that the initial values are
again visible.
revertChanges
in interface TransactionalDataProvider
DataProviderException
- Implementations may wish to surface
internal exceptions (nested in DataProviderException). Consult
the documentation of the specific DataProvider implementation for
details on what exceptions might be wrapped by a DPE.public void addTransactionalDataListener(TransactionalDataListener l)
Register a new TransactionalDataListener
to this
TransactionalDataProvider
instance.
addTransactionalDataListener
in interface TransactionalDataProvider
l
- New TransactionalDataListener
to registerpublic void removeTransactionalDataListener(TransactionalDataListener l)
Deregister an existing TransactionalDataListener
from
TransactionalDataProvider
instance.
removeTransactionalDataListener
in interface TransactionalDataProvider
l
- Old TransactionalDataListener
to removepublic TransactionalDataListener[] getTransactionalDataListeners()
getTransactionalDataListeners
in interface TransactionalDataProvider
TransactionalDataListener
s
currently registered on this TransactionalDataProvider
.
If there are no registered listeners, a zero-length array is
returned.protected void fireChangesCommitted()
TransactionalDataListener
TransactionalDataListener.changesCommitted(TransactionalDataProvider)
protected void fireChangesReverted()
TransactionalDataListener
TransactionalDataListener.changesReverted(TransactionalDataProvider)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |