This TableDataProvider
implementation wraps access to an array of JavaBeans objects. Depending on whether the class in the array is a simple Java Object
or a JavaBeans object, the data provider's field keys correspond either to the properties of the JavaBeans object or to the public member fields of the Java Object
in the list. If the class in the list is not a JavaBeans object, you must set the includeFields
property to make the class's public instance variables accessible as fields.
A common use of this data provider is to wrap an array and then bind the Table component to it, as you can do with a database table.
This data provider determines which fields are available by examining the underlying component data type of the array. If you pass in an array that is of type Object[]
, with initialization code like the following code, the fields of your actual object type will not be available.:
Map map = ...;
return new ObjectArrayDataProvider(map.values().toArray());
If you know that your data is all of type Foo, use code simlar to the following code:
Map map = ...;
return new ObjectArrayDataProvider
((Foo[]) map.values().toArray(new Foo[0]));
This data provider is one of several TableDataProvider
implementations that have the notion of a cursor that can be positioned at a particular row in the underlying data. TableDataProvider
provides both random access, where you specify both a FieldKey
and a RowKey
, and cursor-based access, where you specify a FieldKey
and the RowKey
is determined by the current setting for the cursor.