|
||||||||||
| 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 DataProvidergetFieldKeys in class AbstractDataProviderDataProviderException - 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
AbstractDataProviderReturns the FieldKey associated with the specified data
element canonical id, if any; otherwise, return null.
getFieldKey in interface DataProvidergetFieldKey in class AbstractDataProviderfieldId - 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 DataProvidergetType in class AbstractTableDataProviderfieldKey - 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 DataProviderisReadOnly in class AbstractTableDataProviderfieldKey - 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 TableDataProvidergetRowCount in class AbstractTableDataProviderTableDataProvider 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 TableDataProvidergetRowKeys in class AbstractTableDataProvidercount - 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 TableDataProvidergetRowKey in class AbstractTableDataProviderrowId - 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 TableDataProviderisRowAvailable in class AbstractTableDataProviderrow - 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 TableDataProvidergetValue in class AbstractTableDataProviderfieldKey - 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 TableDataProvidersetValue in class AbstractTableDataProviderfieldKey - 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 TableDataProvidercanInsertRow in class AbstractTableDataProviderbeforeRow - 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 TableDataProviderinsertRow in class AbstractTableDataProviderbeforeRow - 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 TableDataProvidercanAppendRow in class AbstractTableDataProvidertrue 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 TableDataProviderappendRow in class AbstractTableDataProviderDataProviderException - 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 TableDataProvidercanRemoveRow in class AbstractTableDataProviderrow - 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 TableDataProviderremoveRow in class AbstractTableDataProviderrow - 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
TransactionalDataProviderCause any cached changes to values of data elements supported by this
DataProvider to be passed through to the underlying data
structure.
commitChanges in interface TransactionalDataProviderDataProviderException - 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
TransactionalDataProviderCause 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 TransactionalDataProviderDataProviderException - 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 TransactionalDataProviderl - New TransactionalDataListener to registerpublic void removeTransactionalDataListener(TransactionalDataListener l)
Deregister an existing TransactionalDataListener from
TransactionalDataProvider instance.
removeTransactionalDataListener in interface TransactionalDataProviderl - Old TransactionalDataListener to removepublic TransactionalDataListener[] getTransactionalDataListeners()
getTransactionalDataListeners in interface TransactionalDataProviderTransactionalDataListeners
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 | |||||||||