|
||||||||||
| 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.ListDataProvider
This TableDataProvider implementation
wraps the contents of a List. This DataProvider ignores FieldKeys
entirely, and maintains a single list of objects.
NOTE about Serializable: By default, this class uses an ArrayList
as its internal data storage, which is a Serializable implementation of
List. The internal storage can be swapped out using the
setList(List) method. For this class to remain Serializable,
the contained List must be a Serializable implementation. Also, and more
importantly, the contents of the storage List must be Serializable as well
for this class to successfully be serialized.
| Field Summary | |
protected java.util.List |
list
Storage for the internal List (ArrayList by default) |
| 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 | |
ListDataProvider()
Constructs a new ListDataProvider using the default internal storage |
|
ListDataProvider(java.util.List list)
Constructs a new ListDataProvider using the specified List as internal storage. |
|
| Method Summary | |
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()
NOTE: This implementation always returns false from this
method. |
boolean |
canInsertRow(RowKey beforeRow)
NOTE: This implementation always returns false from this
method. |
boolean |
canRemoveRow(RowKey row)
NOTE: This implementation always returns true from this
method. |
int |
getCursorIndex()
|
java.util.List |
getList()
|
int |
getRowCount()
|
int |
getRowIndex(RowKey row)
|
java.lang.Class |
getType(FieldKey fieldKey)
NOTE: FieldKey is ignored in this class. |
java.lang.Object |
getValue(FieldKey fieldKey,
RowKey row)
NOTE: FieldKey is ignored in this class. |
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)
NOTE: FieldKey is ignored in this class. |
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 |
setList(java.util.List list)
Sets the List to use for internal storage. |
void |
setValue(FieldKey fieldKey,
RowKey row,
java.lang.Object value)
NOTE: FieldKey is ignored in this class. |
| 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, getCursorRow, getRowKey, getRowKeys, 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, getFieldKey, getFieldKeys, 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, getFieldKey, getFieldKeys, removeDataListener |
| Field Detail |
protected java.util.List list
List (ArrayList by default)
| Constructor Detail |
public ListDataProvider()
public ListDataProvider(java.util.List list)
Constructs a new ListDataProvider using the specified List as internal storage.
NOTE about Serializable: By default, this class uses an ArrayList as its internal data storage, which is a Serializable
implementation of List. The internal storage can be swapped out
using the setList(List) method. For this class to remain
Serializable, the contained List must be a Serializable implementation.
Also, and more importantly, the contents of the storage List must be
Serializable as well for this class to successfully be serialized.
list - List to use for internal storage| Method Detail |
public java.util.List getList()
public void setList(java.util.List list)
Sets the List to use for internal storage.
NOTE about Serializable: By default, this class uses an ArrayList as its internal data storage, which is a Serializable
implementation of List. The internal storage can be swapped out
using the setList(List) method. For this class to remain
Serializable, the contained List must be a Serializable implementation.
Also, and more importantly, the contents of the storage List must be
Serializable as well for this class to successfully be serialized.
list - List to use for internal storage
public java.lang.Object getValue(FieldKey fieldKey,
RowKey row)
throws DataProviderException
NOTE: FieldKey is ignored in this class.
Return value of the data element referenced by the specified
FieldKey and RowKey.
getValue in interface TableDataProvidergetValue in class AbstractTableDataProviderDataProviderException
public java.lang.Class getType(FieldKey fieldKey)
throws DataProviderException
NOTE: FieldKey is ignored in this class.
Returns the data type of the data element referenced by the specified data key.
getType in interface DataProvidergetType in class AbstractTableDataProviderDataProviderException
public boolean isReadOnly(FieldKey fieldKey)
throws DataProviderException
NOTE: FieldKey is ignored in this class.
NOTE: This method always returns false, as the storage List can be edited at any row.
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 AbstractTableDataProviderDataProviderException
public void setValue(FieldKey fieldKey,
RowKey row,
java.lang.Object value)
throws DataProviderException
NOTE: FieldKey is ignored in this class.
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 AbstractTableDataProviderDataProviderException
public int getRowCount()
throws DataProviderException
getRowCount in interface TableDataProvidergetRowCount in class AbstractTableDataProviderDataProviderException
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 AbstractTableDataProviderDataProviderException
public int getCursorIndex()
throws DataProviderException
getCursorIndex in class AbstractTableDataProviderDataProviderException
public int getRowIndex(RowKey row)
throws DataProviderException
DataProviderException
public boolean canInsertRow(RowKey beforeRow)
throws DataProviderException
NOTE: This implementation always returns false from this
method. To resize the data provider, access the List directly.
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 AbstractTableDataProviderDataProviderException
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 AbstractTableDataProviderDataProviderException
public boolean canAppendRow()
throws DataProviderException
NOTE: This implementation always returns false from this
method. To resize the data provider, access the List directly.
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 AbstractTableDataProviderDataProviderException
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
public boolean canRemoveRow(RowKey row)
throws DataProviderException
NOTE: This implementation always returns true from this
method.
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 AbstractTableDataProviderDataProviderException
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 AbstractTableDataProviderDataProviderException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||