The GridRowModel
is one of the two models that are used within a grid assembly — the other
being the caplin.grid.GridColumnModel. The row model allows row data to be accessed, and row
events to be listened to. Classes that need to listen to row model events must implement the
caplin.grid.GridRowModelListener interface, and register themselves for these events by
calling #addRowModelListener.
Although clients could choose to implement GridRowModel
themselves when they wish to provide a new
grid data-source (e.g. a row model that gets it's data by querying some custom web-service), it is expected that
clients will use the generic caplin.grid.DataProviderRowModel, and instead implement
caplin.grid.GridDataProvider to access any custom data &mdash this is much
simpler than implementing the entire GridRowModel
interface.
Attributes | Name and Description |
---|---|
|
caplin.grid.GridRowModel()
|
Attributes | Name and Description |
---|---|
<static>
|
caplin.grid.GridRowModel.FILTERING
A constant definition used with #supportsFeature to allow row models to declare whether they support filtering. |
<static>
|
caplin.grid.GridRowModel.SORTING
A constant definition used with #supportsFeature to allow row models to declare whether they support sorting. |
Attributes | Name and Description |
---|---|
|
void
addRow(String sSubject)
Adds a row to the |
|
void
addRowModelListener(caplin.grid.GridRowModelListener oRowModelListener)
Adds a listener to the row model, to be communicated of all row model events. |
|
void
clearFilterExpression(String sFilterName)
Removes the named filter expression from the row model. |
|
void
clearGroupByField()
Removes any grouping from the grid row model. |
|
void
clearSortRule()
Removes any sorting from the grid row model. |
|
Map
getAllFilterExpressions()
Returns a map of all filter expressions. |
|
caplin.grid.filter.FilterExpression
getFilterExpression(String sFilterName)
Returns the named filter expression. |
|
caplin.grid.GridDataProvider
getGridDataProvider()
Returns the grid data provider which the row model listens to for data updates. |
|
String
getGroupByField()
Get the field, if one has been set, that is used to group the rows contained within row model. |
|
int
getIndexBySubject(String sSubject)
Return the index of a subject. |
|
caplin.services.security.PermissionKey
getPermissionKey()
Returns a tuple containing the permissioning search query parameters that can be used to determine whether the user has the available permissions to view the data contained within this row model. |
|
Object
getRowData(int nIndex)
Returns the row data record at the specified index. |
|
int
getRowRangeSize()
Returns the size of the row range that is set with the setRowRange method. |
|
String
getSerializedState()
Invoked when the grid is saved. |
|
int
getSize()
Returns the number of rows available — not the number of rows that are currently visible. |
|
caplin.grid.sort.SortRule
getSortRule()
Get the rule, if one exists, that is used to sort the data within the row model. |
|
int
getStartIndex()
Returns the start index of the row model which can be used to see how many rows have been scrolled. |
|
String
getSubjectId(int nIndex)
Returns the RTTP subject identifier for the row at the specified index. |
|
void
getSubjects()
|
|
String
getTransformMode()
Get the transform mode that determines how grid updates are pushed out from the data source. |
|
Array
getVisibleSubjects()
Returns an array of subjects currently in the model (corresponding to visible rows), in order. |
|
void
pauseUpdates()
Signals the |
|
void
removeRow(String sSubject)
Removes a row from the |
|
void
removeRowModelListener(caplin.grid.GridRowModelListener oRowModelListener)
Removes a listener that no longer wishes to listen to row model events. |
|
void
removeRows(String pSubjects)
Removes a number of rows from the |
|
void
resumeUpdates()
Signals the |
|
void
setFilterExpression(caplin.grid.filter.FilterExpression oFilterExpression, String sFilterName)
Add a filter expression to this row model. |
|
void
setGroupByField(String sFieldName)
Sets the field to be used for grouping the rows within the row model. |
|
void
setRowData(String nIndex, Map mRowData)
Method added to allow editing data inside grid. |
|
void
setRowRange(int nStartIndex, int nSize)
Sets the start index and total number of rows that the caplin.grid.GridView is able to display, and hence the the row model should provide. |
|
void
setSortRule(caplin.grid.sort.SortRule oSortRule)
Set a rule that will be used to sort the data within the row model. |
|
void
supportsFeature(int nFeature)
Determine whether this instance of |
|
void
terminateUpdates()
Signals the |
►
caplin.grid.GridRowModel()
►
<static>
caplin.grid.GridRowModel.FILTERING
A constant definition used with #supportsFeature to allow row models to declare whether they support filtering.
Row models that do support filtering will need access to the caplin.grid.GridColumnModel they are working in tandem with (e.g. by having the column model as one of their constructor parameters) so that they can listen to the column model events — in particular caplin.grid.GridColumnModelListener#onFiltersChanged and caplin.grid.GridColumnModelListener#onApplyFilters.
►
<static>
caplin.grid.GridRowModel.SORTING
A constant definition used with #supportsFeature to allow row models to declare whether they support sorting.
Row models that do support sorting will need access to the caplin.grid.GridColumnModel they are working in tandem with (e.g. by having the column model as one of their constructor parameters) so that they can listen to the column model events — in particular caplin.grid.GridColumnModelListener#onSortColumnChanged.
►
void
addRow(String sSubject)
Adds a row to the GridRowModel
.
String | sSubject | The RTTP subject identifier (e.g. /FX/EURUSD) for the new row. |
►
void
addRowModelListener(caplin.grid.GridRowModelListener oRowModelListener)
Adds a listener to the row model, to be communicated of all row model events.
caplin.grid.GridRowModelListener | oRowModelListener | The listener to add. |
►
void
clearFilterExpression(String sFilterName)
Removes the named filter expression from the row model.
The filter name parameter is optional. If no parameter is passed then the 'default' parameter expression will be removed.
String | sFilterName | (Optional) The name of the filter expression to remove. |
►
void
clearGroupByField()
Removes any grouping from the grid row model.
►
void
clearSortRule()
Removes any sorting from the grid row model.
►
Map
getAllFilterExpressions()
Returns a map of all filter expressions.
The returned map should not be modified by external clients as it is may be used internally by the row model class.
►
caplin.grid.filter.FilterExpression
getFilterExpression(String sFilterName)
Returns the named filter expression.
The filter name parameter is optional. If no parameter is passed then the 'default' parameter expression will be returned.
String | sFilterName | (Optional) The name of the filter expression to remove. |
►
caplin.grid.GridDataProvider
getGridDataProvider()
Returns the grid data provider which the row model listens to for data updates.
►
String
getGroupByField()
Get the field, if one has been set, that is used to group the rows contained within row model.
null
otherwise.
►
int
getIndexBySubject(String sSubject)
Return the index of a subject.
String | sSubject | The RTTP subject identifier (e.g. /FX/EURUSD) for the row. |
►
caplin.services.security.PermissionKey
getPermissionKey()
Returns a tuple containing the permissioning search query parameters that can be used to determine whether the user has the available permissions to view the data contained within this row model.
Row models whose data is not permissioned do not need to return a permissioning key, and may instead return
null
.
null
►
Object
getRowData(int nIndex)
Returns the row data record at the specified index.
int | nIndex | The index of the specified row. |
►
int
getRowRangeSize()
Returns the size of the row range that is set with the setRowRange method.
►
String
getSerializedState()
Invoked when the grid is saved.
GridRowModel
. This may
be an empty string if the row model was configured by a parent grid definition.
►
int
getSize()
Returns the number of rows available — not the number of rows that are currently visible.
►
caplin.grid.sort.SortRule
getSortRule()
Get the rule, if one exists, that is used to sort the data within the row model.
null
otherwise.
►
int
getStartIndex()
Returns the start index of the row model which can be used to see how many rows have been scrolled.
►
String
getSubjectId(int nIndex)
Returns the RTTP subject identifier for the row at the specified index.
Row models whose rows correspond to objects that can be requested from a Liberator should use this method to make
that information available — this may be true even for row models where the data itself does not come from a
Liberator (e.g. a custom web-service) provided the row data corresponds to requestable objects within the Liberator.
Some decorators (such as the caplin.grid.decorator.DragDecorator require this information in order to allow
dragging & dropping of row data into trade panels or custom grids. Row models whose data does not correspond to
requestable objects within the Liberator can instead return null
.
int | nIndex | The index of the row being queried. |
null
otherwise.
►
void
getSubjects()
►
String
getTransformMode()
Get the transform mode that determines how grid updates are pushed out from the data source.
►
Array
getVisibleSubjects()
Returns an array of subjects currently in the model (corresponding to visible rows), in order.
►
void
pauseUpdates()
Signals the GridRowModel
to temporarily pause any updates to all RowModelListener
instances.
►
void
removeRow(String sSubject)
Removes a row from the GridRowModel
.
String | sSubject | The RTTP subject identifier (e.g. /FX/EURUSD) for the new row. |
►
void
removeRowModelListener(caplin.grid.GridRowModelListener oRowModelListener)
Removes a listener that no longer wishes to listen to row model events.
caplin.grid.GridRowModelListener | oRowModelListener | The listener to remove. |
►
void
removeRows(String pSubjects)
Removes a number of rows from the GridRowModel
.
String | pSubjects | The RTTP subject identifiers of the rows to remove. |
►
void
resumeUpdates()
Signals the GridRowModel
to resume updates to any RowModelListener
instances.
►
void
setFilterExpression(caplin.grid.filter.FilterExpression oFilterExpression, String sFilterName)
Add a filter expression to this row model.
The filter name parameter is optional. If no parameter is passed then this filter expression will be assumed to be 'default'.
caplin.grid.filter.FilterExpression | oFilterExpression | The filter expression to apply to this row model. |
String | sFilterName | (Optional) The name that this filter expression will be known by. |
►
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
setRowData(String nIndex, Map mRowData)
Method added to allow editing data inside grid. Sets the field value for the row with the specific index
String | nIndex | index id of the row to add field |
Map | mRowData | field maps to update |
►
void
setRowRange(int nStartIndex, int nSize)
Sets the start index and total number of rows that the caplin.grid.GridView is able to display, and hence the the row model should provide.
int | nStartIndex | The start index of the first row visible within the view. |
int | nSize | The number of rows visible within the view. |
►
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
supportsFeature(int nFeature)
Determine whether this instance of GridRowModel
supports a particular feature.
int | nFeature | the feature constant that is being queried. |
►
void
terminateUpdates()
Signals the GridRowModel
to terminate all updates to any RowModelListener
instances.
This method is essentially the destructor for classes implementing GridRowModel
, and
is the opportunity to perform any clean-up that may be required.