The class within the caplin.grid
package that is responsible
for displaying the rows specified within the provided
caplin.grid.GridRowModel, and the columns specified within the
provided caplin.grid.GridColumnModel. Additionally,
GridView
implements the caplin.component.Component
interface so that it can be rendered within a web-based windowing framework
(e.g. webcentric), and communicates with any specified
caplin.grid.decorator.GridDecorator instances — these allow the
grid functionality to be augmented in a modular way.
The GridView
class is not designed to be constructed directly
by user's of the CaplinTrader APIs. Instead, grid assemblies are defined
using XML, and are constructed on demand using
caplin.grid.GridComponentFactory.
Attributes | Name and Description |
---|---|
|
caplin.grid.GridView(caplin.grid.GridDefinition gridDefinition, caplin.grid.GridRowModel gridRowModel, caplin.grid.GridColumnModel gridColumnModel, Array gridDecorators)
Constructs a new |
Attributes | Name and Description |
---|---|
|
void
addColumnHeaderRendererListener(caplin.element.RendererEventListener rendererEventListener)
Adds an caplin.element.RendererEventListener listener to the grid view. |
|
void
addGridViewListener(caplin.grid.GridViewListener gridViewListener)
Adds a listener to the grid view, to be communicated of all grid level events. |
|
void
addRendererEventListener(caplin.element.RendererEventListener rendererEventListener)
Adds a RendererEventListener to listen to any of the events that occur on renderers in the GridView. |
|
void
canReceive()
|
|
void
canReceiveMultipleObjects()
|
|
void
canReceiveObjects( receivedObjects)
|
|
HtmlElement
getCellElement(int rowIndex, int columnIndex)
Returns the cell for the specified row and column. |
|
caplin.element.Renderer
getCellRenderer(int rowIndex, int columnIndex)
Returns the cell renderer responsible for rendering the given row and column indicies. |
|
Map
getElementIndicies(HtmlElement element)
Returns the map containing the row and column indices ( |
|
caplin.grid.GridColumnModel
getGridColumnModel()
Returns the underlying column model being used with the grid. |
|
Array
getGridDecorators()
Returns the decorators held by this Grid View |
|
caplin.grid.GridRowModel
getGridRowModel()
Returns the underlying row model being used with the grid. |
|
caplin.grid.GridRowSelectionModel
getGridRowSelectionModel()
Returns the row selection model being used with the grid. |
|
HtmlElement
getHeaderCellElement(int columnIndex)
Returns the header cell for the specified column. |
|
caplin.element.Renderer
getHeaderRenderer(int columnIndex)
Returns the header renderer responsible for rendering the given column index. |
|
HtmlElement
getHeaderRowElement()
Returns the header row. |
|
void
getLastReceiveFailureMessage()
|
|
int
getNumberOfDisplayedRows()
Returns the number of rendered rows visible in the grid at the present point in time. |
|
Array
getRendererTypes()
Returns an array containing all Renderer Types for every column. |
|
Map
getRendererTypesIndexedByColumnName()
Returns a map containing all Renderer Types for every column, indexed by column friendly name. |
|
HtmlElement
getRowContainerElement()
Returns the grid row container element. |
|
HtmlElement
getRowElement(int rowIndex)
Returns the row element with the specified row index. |
|
void
getSuccessMessage()
|
|
int
getTotalRowCount()
Returns the total number of rows in the dataset. |
|
String
getUniqueComponentId()
Gets a guaranteed ID for this component instance. |
|
int
getVisibleRowCount()
Returns the number of visible, populated rows in the grid. |
|
boolean
isColumnInView(int columnIndex)
Determines whether the specified column is in view. |
|
boolean
isRowInView(int rowIndex)
Determines whether the specified row is in view. |
|
boolean
isScrolling()
Test if the grid is currently being scrolled. |
|
void
isSortable()
The grid is sortable, unless it is empty. |
|
void
markAsDirty()
Calling this method will inform webcentric that the user's layout has changed. |
|
void
onAllDataReceived()
|
|
void
onColumnsAdded( gridColumns, startIndex)
|
|
void
onColumnsRemoved( gridColumns, startIndex)
|
|
void
onFiltersChanged()
|
|
void
onRendererEvent(caplin.element.Renderer renderer, Map rendererEvent, Map options)
The callback function to receive Renderer events. |
|
void
onRowContentsChanged( indices, rowUpdates)
|
|
void
onRowDataUnavailable()
|
|
void
onRowStructureChanged( indices)
|
|
void
onScroll( nType, scrollAmount)
|
|
void
onScrollComplete( nType, scrollAmount)
|
|
void
onSizeChanged( newSize)
|
|
void
onSortColumnChanged()
|
|
void
onStartIndexChanged( newStartIndex)
|
|
void
onWidthChanged( gridColumn)
|
|
void
recalculateHeights()
Inform the grid that the styling applied to the grids has dynamically changed, affecting the current column header and/or rows heights. |
|
void
receiveObjects( receivedObjects)
|
|
void
removeColumnHeaderRendererListener(caplin.element.RendererEventListener rendererEventListener)
Removes a listener previously been added via {#addColumnHeaderRendererListener}. |
|
void
removeGridViewListener(caplin.grid.GridViewListener gridViewListener)
Removes a previously registered grid view listener. |
|
void
setStartIndex(Number startIndex)
Set the first row being displayed within the grid. |
►
caplin.grid.GridView(caplin.grid.GridDefinition gridDefinition, caplin.grid.GridRowModel gridRowModel, caplin.grid.GridColumnModel gridColumnModel, Array gridDecorators)
Constructs a new GridView
with the specified arguments.
This constructor should not be called directly, but instead caplin.grid.GridComponentFactory should be used for the construction of all grid assemblies.
caplin.grid.GridDefinition | gridDefinition | The compiled XML definition of this grid. |
caplin.grid.GridRowModel | gridRowModel | The row model to be displayed by this grid. |
caplin.grid.GridColumnModel | gridColumnModel | The column model to be displayed by this grid. |
Array | gridDecorators | The array of caplin.grid.decorator.GridDecorator instances to be applied to this grid. |
►
void
addColumnHeaderRendererListener(caplin.element.RendererEventListener rendererEventListener)
Adds an caplin.element.RendererEventListener listener to the grid view. Any events raised on any of the renderers on the GridView will raise an event. Use {#removeColumnHeaderRendererListener} to remove a listener.
caplin.element.RendererEventListener | rendererEventListener | The listener to listener for renderer events. |
►
void
addGridViewListener(caplin.grid.GridViewListener gridViewListener)
Adds a listener to the grid view, to be communicated of all grid level events.
caplin.grid.GridViewListener | gridViewListener | The grid view listener to add. |
►
void
addRendererEventListener(caplin.element.RendererEventListener rendererEventListener)
Adds a RendererEventListener to listen to any of the events that occur on renderers in the GridView.
caplin.element.RendererEventListener | rendererEventListener | the listener to add. |
►
void
canReceive()
►
void
canReceiveMultipleObjects()
►
void
canReceiveObjects( receivedObjects)
receivedObjects |
►
HtmlElement
getCellElement(int rowIndex, int columnIndex)
Returns the cell for the specified row and column.
int | rowIndex | The row index of the cell |
int | columnIndex | The column index of the cell |
►
caplin.element.Renderer
getCellRenderer(int rowIndex, int columnIndex)
Returns the cell renderer responsible for rendering the given row and column indicies.
int | rowIndex | The index of the row for which the cell renderer will be returned. |
int | columnIndex | The index of the column for which the cell renderer will be returned. |
►
Map
getElementIndicies(HtmlElement element)
Returns the map containing the row and column indices (rowIndex
and columnIndex
respectively) for the specified cell element. If the specified cell represents a header, only a
columnIndex
will be returned within the map.
HtmlElement | element | The cell element for which the indices are required. |
rowIndex
and columnIndex
for the given element.
►
caplin.grid.GridColumnModel
getGridColumnModel()
Returns the underlying column model being used with the grid.
►
Array
getGridDecorators()
Returns the decorators held by this Grid View
►
caplin.grid.GridRowModel
getGridRowModel()
Returns the underlying row model being used with the grid.
►
caplin.grid.GridRowSelectionModel
getGridRowSelectionModel()
Returns the row selection model being used with the grid.
►
HtmlElement
getHeaderCellElement(int columnIndex)
Returns the header cell for the specified column.
int | columnIndex | The column index of the cell |
►
caplin.element.Renderer
getHeaderRenderer(int columnIndex)
Returns the header renderer responsible for rendering the given column index.
int | columnIndex | The index of the column for which the header renderer will be returned. |
►
HtmlElement
getHeaderRowElement()
Returns the header row.
►
void
getLastReceiveFailureMessage()
►
int
getNumberOfDisplayedRows()
Returns the number of rendered rows visible in the grid at the present point in time.
►
Array
getRendererTypes()
Returns an array containing all Renderer Types for every column.
►
Map
getRendererTypesIndexedByColumnName()
Returns a map containing all Renderer Types for every column, indexed by column friendly name.
►
HtmlElement
getRowContainerElement()
Returns the grid row container element.
►
HtmlElement
getRowElement(int rowIndex)
Returns the row element with the specified row index.
int | rowIndex | The row index |
►
void
getSuccessMessage()
►
int
getTotalRowCount()
Returns the total number of rows in the dataset.
►
String
getUniqueComponentId()
Gets a guaranteed ID for this component instance.
►
int
getVisibleRowCount()
Returns the number of visible, populated rows in the grid.
►
boolean
isColumnInView(int columnIndex)
Determines whether the specified column is in view.
int | columnIndex | The column index corresponding to the column |
true
if the column is in view, and false
otherwise.
►
boolean
isRowInView(int rowIndex)
Determines whether the specified row is in view.
int | rowIndex | The row index corresponding to the row |
true
if the row is in view, and false
otherwise.
►
boolean
isScrolling()
Test if the grid is currently being scrolled.
►
void
isSortable()
The grid is sortable, unless it is empty.
►
void
markAsDirty()
Calling this method will inform webcentric that the user's layout has changed. The layout will be marked using a *, informing the user that they must save their sheet to save any changes that have been made.
►
void
onAllDataReceived()
►
void
onColumnsAdded( gridColumns, startIndex)
gridColumns | ||
startIndex |
►
void
onColumnsRemoved( gridColumns, startIndex)
gridColumns | ||
startIndex |
►
void
onFiltersChanged()
►
void
onRendererEvent(caplin.element.Renderer renderer, Map rendererEvent, Map options)
The callback function to receive Renderer events.
caplin.element.Renderer | renderer | The renderer raising the event |
Map | rendererEvent | The renderer event |
Map | options | The event parameters |
►
void
onRowContentsChanged( indices, rowUpdates)
indices | ||
rowUpdates |
►
void
onRowStructureChanged( indices)
indices |
►
void
onScroll( nType, scrollAmount)
nType | ||
scrollAmount |
►
void
onScrollComplete( nType, scrollAmount)
nType | ||
scrollAmount |
►
void
onSizeChanged( newSize)
newSize |
►
void
onSortColumnChanged()
►
void
onStartIndexChanged( newStartIndex)
newStartIndex |
►
void
onWidthChanged( gridColumn)
gridColumn |
►
void
recalculateHeights()
Inform the grid that the styling applied to the grids has dynamically changed, affecting the current column header and/or rows heights.
Some uses of the grid may involve changing the display mode at runtime, so that the column headers or the rows themselves have a different height in these different modes. Although a display mode switch may be affected by the developer by setting a class name on the root grid element, and having different CSS rules for each mode, the grid must also be informed about this so that it's rendering logic can continue to work.
►
void
receiveObjects( receivedObjects)
receivedObjects |
►
void
removeColumnHeaderRendererListener(caplin.element.RendererEventListener rendererEventListener)
Removes a listener previously been added via {#addColumnHeaderRendererListener}.
caplin.element.RendererEventListener | rendererEventListener | The listener to remove. |
►
void
removeGridViewListener(caplin.grid.GridViewListener gridViewListener)
Removes a previously registered grid view listener.
caplin.grid.GridViewListener | gridViewListener | The grid view listener to remove. |
►
void
setStartIndex(Number startIndex)
Set the first row being displayed within the grid.
Number | startIndex | The row that will be displayed at the top of the grid. |