The GridColumnModel
is one of the two models that are used within a grid assembly — the other
being the caplin.grid.GridRowModel. The column model allows the currently displayed columns
within a grid to be accessed and/or modified, including the addition & removal of columns, the setting of sort
orders on columns, and the addition of display filters on columns. Additionally, the column model allows classes to
subscribe to column model level events. Classes that need to listen to column model events must implement the
caplin.grid.GridColumnModelListener interface, and register themselves for these
events by calling #addColumnModelListener.
Attributes | Name and Description |
---|---|
|
caplin.grid.GridColumnModel()
Constructs a |
Attributes | Name and Description |
---|---|
|
void
addColumnModelListener(caplin.grid.GridColumnModelListener oColumnModelListener)
Adds a column model listener that wishes to observe events fired from this |
|
Array
addColumns(Array pColumnIdentifiers, int nStartIndex)
Adds a set of columns to the |
|
void
applyFilters()
Applies all the filters that have been added to the columns within this |
|
void
clearAllFilters()
Removes all the filters that have been added to the columns within this |
|
void
clearSort()
Removes any sort currently applied to the grid column model. |
|
Array
getActiveColumns()
Returns the list of visible columns. |
|
Array
getActiveFilters()
Returns an array of all the currently active column filters. |
|
Array
getAvailableColumns()
Returns the list of columns that are not currently being shown, but are available for addition. |
|
caplin.grid.GridColumn
getColumnById(String sColumnId)
Returns the column with specified column identifier. |
|
caplin.grid.GridColumn
getColumnByIndex(int nColumnIndex)
Returns the column identified by the specified column index. |
|
Array
getRequiredFields()
Returns the list of fields the data provider must make available so that the columns have all the necesarry information to perform updates. |
|
caplin.grid.GridColumn
getSortColumn()
Returns the column that the grid is currently using for sorting. |
|
boolean
hasColumnOrderChanged()
Determine whether the column order has changed since the grid was first opened. |
|
void
isColumnAvailable(String sColumnId)
Returns true if the column id is a column that is not presently active but could be made active |
|
void
moveColumn(int nIndex, int nNewIndex)
Moves the column from its present position to a new one. |
|
boolean
removeColumnModelListener(caplin.grid.GridColumnModelListener oColumnModelListener)
Removes a column model listener that no longer wishes to observe events fired from this
|
|
void
removeColumns(int nStartIndex, int nSize)
Removes a set of columns from the |
|
void
replaceColumn(int nIndex, String sColumnId)
Replaces the column at the specified index with the specified column. |
►
caplin.grid.GridColumnModel()
Constructs a caplin.grid.GridColumnModel
instance — end-users will never need to do this
themselves since grids are fully constructed based on their XML definition files by the
caplin.grid.GridComponentFactory class.
►
void
addColumnModelListener(caplin.grid.GridColumnModelListener oColumnModelListener)
Adds a column model listener that wishes to observe events fired from this GridColumnModel
.
caplin.grid.GridColumnModelListener | oColumnModelListener | The listener to add. |
►
Array
addColumns(Array pColumnIdentifiers, int nStartIndex)
Adds a set of columns to the GridColumnModel
that will be inserted at the specified start index.
If any of the specified columns are duplicates, or if any of the specified columns are already present in the model, an array of the columns that could not be added the the model will be returned.
Array | pColumnIdentifiers | The unique identifiers of the columns to be added to the model. |
int | nStartIndex | The zero-based start index where the columns should be added. |
►
void
applyFilters()
Applies all the filters that have been added to the columns within this GridColumnModel
.
Filters can be added one at a time, and the view will need to constantly reflect the latest state of the model, and so the caplin.grid.GridColumnModelListener#onFiltersChanged callback method will need to fire as each change happens, whereas the application of filters so that it affects the caplin.grid.GridDataProvider responsible for fetching the data may not happen until some later point, depending on how the caplin.grid.decorator.GridDecorator instance(s) used to add these filters have been implemented.
►
void
clearAllFilters()
Removes all the filters that have been added to the columns within this GridColumnModel
.
►
void
clearSort()
Removes any sort currently applied to the grid column model.
►
Array
getActiveColumns()
Returns the list of visible columns.
Columns that are not shown, but that are available to be added, are in a separate list that can be accessed via #getAvailableColumns. When a column is added to list of active columns (using #addColumns it is at the same time removed from the list of available columns. Equally, when a column, or columns, are removed from the list of available columns (using #removeColumns) they are at the same time added to list of available columns.
►
Array
getActiveFilters()
Returns an array of all the currently active column filters.
►
Array
getAvailableColumns()
Returns the list of columns that are not currently being shown, but are available for addition.
►
caplin.grid.GridColumn
getColumnById(String sColumnId)
Returns the column with specified column identifier.
String | sColumnId | the identifier of the column as specified within the XML file used to configure the grid. |
null
otherwise.
►
caplin.grid.GridColumn
getColumnByIndex(int nColumnIndex)
Returns the column identified by the specified column index. Note - this index is into the currently active (visible) columns.
int | nColumnIndex | the zero based index of the column in the currently active columns. |
null
otherwise.
►
Array
getRequiredFields()
Returns the list of fields the data provider must make available so that the columns have all the necesarry information to perform updates.
►
caplin.grid.GridColumn
getSortColumn()
Returns the column that the grid is currently using for sorting.
A grid can only be sorted on one column. If an arbitrary GridColumn
has its sort order changed, then
any other column that was being used for sorting will have its sort order set to no sorting. If there is currently
no sorting applied to the grid, then this method will return null
.
null
if no sorting is currently applied.
►
boolean
hasColumnOrderChanged()
Determine whether the column order has changed since the grid was first opened.
►
void
isColumnAvailable(String sColumnId)
Returns true if the column id is a column that is not presently active but could be made active
String | sColumnId | the id of the column from the XML configuration. |
►
void
moveColumn(int nIndex, int nNewIndex)
Moves the column from its present position to a new one. To move to the the very beginning use index zero. To move to the very end use the number of columns.
int | nIndex | Zero based index of the column to move |
int | nNewIndex | Index at which the column will be placed |
►
boolean
removeColumnModelListener(caplin.grid.GridColumnModelListener oColumnModelListener)
Removes a column model listener that no longer wishes to observe events fired from this
GridColumnModel
.
caplin.grid.GridColumnModelListener | oColumnModelListener | The listener to remove. |
true
if the listener previously existed, and false
otherwise.
►
void
removeColumns(int nStartIndex, int nSize)
Removes a set of columns from the GridColumnModel
.
int | nStartIndex | The zero-based index of the first column to be removed. |
int | nSize | The number of columns to remove after the start index. |
►
void
replaceColumn(int nIndex, String sColumnId)
Replaces the column at the specified index with the specified column.
int | nIndex | The index of the column to replace. |
String | sColumnId | The unique identifier of the new column that will replace the existing column at the given index. |