GridDataProvider
classes allow data from different data sources to be displayed within a grid when
used in conjunction with an instance of caplin.grid.DataProviderRowModel. The GridDataProvider
interface is much simpler to implement than the full caplin.grid.GridRowModel interface, and should allow
most, if not all, grid row models to be developed, and so is the preferred way of creating a
caplin.grid.GridRowModel.
Although Caplin will provide a set of generic data providers for retrieving different data types from a Liberator
(e.g. caplin.grid.RttpContainerGridDataProvider for retrieving RTTP container data), it is also anticipated
that customers may also need to create their own data provider classes for accessing other forms of data, e.g. a
data provider that accesses a custom web-service. So, GridDataProvider
is the interface that customers
wishing to have custom data displayed within a grid must implement.
Attributes | Name and Description |
---|---|
|
caplin.grid.GridDataProvider()
|
Attributes | Name and Description |
---|---|
<static>
|
caplin.grid.GridDataProvider.FILTERING
A constant definition used with #supportsFeature to allow data providers to declare whether they support filtering. |
<static>
|
caplin.grid.GridDataProvider.PAGING
A constant definition used with #supportsFeature to allow data providers to declare whether they support paging. |
<static>
|
caplin.grid.GridDataProvider.SORTING
A constant definition used with #supportsFeature to allow data providers to declare whether they support sorting. |
Attributes | Name and Description |
---|---|
|
void
addDataProviderListener(caplin.grid.GridDataProviderListener oDataProviderListener)
Adds a listener to the data provider, to be communicated of all data provider events. |
|
void
clearFilterExpression(String sFilterName)
Remove a named filter expression. |
|
void
clearGroupByField()
Removes any grouping from the grid row model. |
|
void
clearSortRule()
Removes any sorting from the grid row model. |
|
void
configureDataProvider(Element eXmlConfigurationNode, boolean bDataProviderDefinedByParent)
Allow the data provider to configure itself based on the XML attributes from the node used to configure the data provider. |
|
Map
getAllFilterExpressions()
A map of all the filter expressions added to this data provider. |
|
caplin.grid.filter.FilterExpression
getFilterExpression(String sFilterName)
Returns a named filter expression. |
|
void
getGroupByField()
Get the field, if one has been set, that is used to group the rows contained within row model. |
|
caplin.services.security.PermissionKey|null
getPermissionKey()
Returns a permissioning key tuple that can be used to query the permissioning system to determine whether the user is permitted to access the data that this data provider will be providing. |
|
String
getSerializedState()
Invoked when the grid row model needs to save the state of this data provider. |
|
void
getSortRule()
Get the rule, if one exists, that is used to sort the data within the row model. |
|
void
getStartIndex()
Returns the start index that is set on the Data Provider via the #setRowRange method. |
|
void
getSubjectIdentifiers(caplin.grid.GridDataProviderSnapshotListener oSnapshotListener)
Returns the array of subject identifiers provided by the data provider. |
|
String
getTransformMode()
Get the transform mode that determines how grid updates are pushed out from the data source. |
|
void
injectData(String sSubject, Map mData)
Injects a map of Data consistent on field_name:value pairs into a record given by its subject. |
|
void
pauseUpdates()
Signals the |
|
void
removeDataProviderListener(caplin.grid.GridDataProviderListener oDataProviderListener)
Removes a |
|
void
requestAllData()
Inform the |
|
void
resumeUpdates()
Signals the |
|
void
setFilterExpression(caplin.grid.filter.FilterExpression oFilterExpression, String sFilterName)
Set a filter expression on this data provider. |
|
void
setFilters(Array pActiveColumnFilters, mAllColumns)
Informs the |
|
void
setGridView(caplin.grid.GridView oGridView)
The opportunity for the data provider to add itself as a listener to the the caplin.grid.GridView as a renderer event listener. |
|
void
setGroupByField(String sFieldName)
Sets the field to be used for grouping the rows within the row model. |
|
void
setRequiredFields(Array pFieldNames)
Sets the required fields that this data provider should provide within each record. |
|
void
setRowData( sSubject, mRowData)
Updates the data on editable row. |
|
void
setRowRange(int nStartIndex, int nSize)
Sets the start index and total number of rows that this |
|
void
setSortRule(caplin.grid.sort.SortRule oSortRule)
Set a rule that will be used to sort the data within the row model. |
|
void
setTransformMode(String sTransformMode)
Sets the update mode that determines how grid updates are pushed out from the data source. |
|
void
supportsFeature(int nFeature)
Determine whether this instance of |
|
void
terminateUpdates()
Signals the |
►
caplin.grid.GridDataProvider()
►
<static>
caplin.grid.GridDataProvider.FILTERING
A constant definition used with #supportsFeature to allow data providers to declare whether they support filtering.
Data providers that do support filtering will need to correctly implement #setFilters.
►
<static>
caplin.grid.GridDataProvider.PAGING
A constant definition used with #supportsFeature to allow data providers to declare whether they support paging.
Data providers that do support paging will need to implement #setRowRange, whereas data providers that do not implement paging will instead need to implement #requestAllData.
►
<static>
caplin.grid.GridDataProvider.SORTING
A constant definition used with #supportsFeature to allow data providers to declare whether they support sorting.
Data providers that do support sorting will need to correctly implement #sortBy.
►
void
addDataProviderListener(caplin.grid.GridDataProviderListener oDataProviderListener)
Adds a listener to the data provider, to be communicated of all data provider events.
caplin.grid.GridDataProviderListener | oDataProviderListener | The listener to add. |
►
void
clearFilterExpression(String sFilterName)
Remove a named filter expression. Once removed the data provider will reset itself to display the data without the removed filter.
String | sFilterName | The name of the filter. |
►
void
clearGroupByField()
Removes any grouping from the grid row model.
►
void
clearSortRule()
Removes any sorting from the grid row model.
►
void
configureDataProvider(Element eXmlConfigurationNode, boolean bDataProviderDefinedByParent)
Allow the data provider to configure itself based on the XML attributes from the node used to configure the data provider.
Element | eXmlConfigurationNode | Access to the XML node that contains any configuration information the data provider needs to configure itself. |
boolean | bDataProviderDefinedByParent | Informs the data provider whether its configuration came via inheritance, or was configured locally — this will affect how the data provider should behave when it's #getSerializedState method is invoked. |
►
Map
getAllFilterExpressions()
A map of all the filter expressions added to this data provider.
►
caplin.grid.filter.FilterExpression
getFilterExpression(String sFilterName)
Returns a named filter expression.
String | sFilterName | The name of the filter to return — 'default' is the name given to filters generated from XML which lack the name attribute. |
caplin.grid.filter.FilterExpression
, if one exists,
or null
otherwise.
►
void
getGroupByField()
Get the field, if one has been set, that is used to group the rows contained within row model.
null
otherwise.
►
caplin.services.security.PermissionKey|null
getPermissionKey()
Returns a permissioning key tuple that can be used to query the permissioning system to determine whether the user is permitted to access the data that this data provider will be providing.
Data providers whose data is not permissioned need not return a permissioning key.
null
.
►
String
getSerializedState()
Invoked when the grid row model needs to save the state of this data provider. It returns an XML string representation of the state.
This interface differs from the implemented caplin.core.Serializable interface in the following way.
If the state of the data provider has changed since deserialization, or the data provider state has ever changed
in the past (i.e. the bDataProviderDefinedByParent
passed within the #configureDataProvider
method was false
, then the data provider should return a serialized representation of itself. If this
is not the case, however, the data provider should otherwise return null
.
Example:
caplin.grid.RttpContainerGridDataProvider.prototype.getSerializedState = function() { if (this.m_bStateChanged || !this.m_bDataProviderDefinedByParent) { var sEncodedContainerName = caplin.core.XmlUtility.encodeValue(this.m_sOriginalContainerName); return '\n'; } return null; };
null
if there have not
been any changes to the data provider. Must not be undefined
.
►
void
getSortRule()
Get the rule, if one exists, that is used to sort the data within the row model.
null
otherwise.
►
void
getStartIndex()
Returns the start index that is set on the Data Provider via the #setRowRange method.
null
if not yet set.
►
void
getSubjectIdentifiers(caplin.grid.GridDataProviderSnapshotListener oSnapshotListener)
Returns the array of subject identifiers provided by the data provider.
This will include all subject identifiers, not just those within the current view.
caplin.grid.GridDataProviderSnapshotListener | oSnapshotListener |
►
String
getTransformMode()
Get the transform mode that determines how grid updates are pushed out from the data source.
►
void
injectData(String sSubject, Map mData)
Injects a map of Data consistent on field_name:value pairs into a record given by its subject.
The GridDataProvider will notify all its observables about a record change with this data
String | sSubject | |
Map | mData |
►
void
pauseUpdates()
Signals the GridDataProvider
to temporarily pause updates to any GridDataProviderListener
instances.
This method is invoked as a consequence of caplin.grid.DataProviderRowModel#pauseUpdates being invoked. This method is a hint only, as the caplin.grid.DataProviderRowModel will also perform caching of updates so they do not need to be rendered to the screen. By implementing pausing at the data provider level, however, additional processor usage can be conserved allowing multiple sheets to be opened without increasing the burden placed on they processor.
►
void
removeDataProviderListener(caplin.grid.GridDataProviderListener oDataProviderListener)
Removes a GridDataProviderListener
that no longer wishes to listen to data updates.
caplin.grid.GridDataProviderListener | oDataProviderListener | The listener to remove. |
►
void
requestAllData()
Inform the GridDataProvider
that it is now permitted to begin sending data.
requestAllData
is only invoked on classes that do not support PAGING. Classes that do
support paging will receive multiple invocations to #setRowRange instead.
►
void
resumeUpdates()
Signals the GridDataProvider
to resume updates to all GridDataProviderListener
instances.
►
void
setFilterExpression(caplin.grid.filter.FilterExpression oFilterExpression, String sFilterName)
Set a filter expression on this data provider. This will filter the grid data according to the operator and values of the filter expression.
caplin.grid.filter.FilterExpression | oFilterExpression | A filter expression to apply to this data provider. |
String | sFilterName | The name of the filter. |
►
void
setFilters(Array pActiveColumnFilters, mAllColumns)
Informs the GridDataProvider
of the currently active column filters.
Array | pActiveColumnFilters | An array of all the currently active caplin.grid.GridColumnFilter instances. |
mAllColumns | A map of all GridView's column caplin.grid.GridColumn instances. |
►
void
setGridView(caplin.grid.GridView oGridView)
The opportunity for the data provider to add itself as a listener to the the caplin.grid.GridView as a renderer event listener.
caplin.grid.GridView | oGridView | The view that the data provider/controller can use to communicate with the View/Model. |
►
void
setGroupByField(String sFieldName)
Sets the field to be used for grouping the rows within the row model.
String | sFieldName | The field name that will be used for grouping. |
►
void
setRequiredFields(Array pFieldNames)
Sets the required fields that this data provider should provide within each record.
Array | pFieldNames | A list of field names as strings. |
►
void
setRowData( sSubject, mRowData)
Updates the data on editable row. Currently the data received is updated in a local cache and merged with received data works only if supported by implementing class (bEditable is set to true)
sSubject | - subject(objectName) of the row to be updated | |
mRowData | - map with field name and values to be updated for the subject specified |
►
void
setRowRange(int nStartIndex, int nSize)
Sets the start index and total number of rows that this GridDataProvider
should supply when notifying
listeners of row updates — this will change as the view is scrolled or resized to reveal different rows.
setRowRange
is only invoked on classes that support #PAGING. Classes that do not support
paging will receive a single invocation to #requestAllData instead.
int | nStartIndex | The start index of the first row within the range. |
int | nSize | The number of rows within the range. |
►
void
setSortRule(caplin.grid.sort.SortRule oSortRule)
Set a rule that will be used to sort the data within the row model.
caplin.grid.sort.SortRule | oSortRule | The object containing the sort parameters. |
►
void
setTransformMode(String sTransformMode)
Sets the update mode that determines how grid updates are pushed out from the data source.
String | sTransformMode | The update mode to use. |
►
void
supportsFeature(int nFeature)
Determine whether this instance of GridDataProvider
supports a particular feature.
int | nFeature | the feature constant that is being queried. |
►
void
terminateUpdates()
Signals the GridDataProvider
to permanently terminate updates to any
GridDataProviderListener
instances.
This method is essentially the destructor for classes implementing GridDataProvider
, and is the
opportunity to perform any clean-up that may be required.