Class ScreenTableHelper
Object
|
+--ScreenTableHelper
- class
ScreenTableHelper
Helper class that can be used in order to help the framework
finding the HTML cells that make up a screen table in the page DOM.
It can be used to explicitly declare the cells to be used avoiding
any DOM search or to specify a root node to limit the scanning of the page
and/or to specify a subset of node types to be searched for Lightsreamer
attributes.
When a data table is brought to "running" state through
PushPage.addTable(), the screen table to be used to display its values
is also determined, based on the supplied id. This requires a search
throughout the page DOM for all the HTML nodes that declare the
specified id as their screen table id. This search operation may be
inefficient. Such load can be eased using a ScreenTableHelper properly
configured and notified through PushPage.addScreenTableHelper():
- if the ScreenTableHelper is populated with DOM nodes the search is not performed at all
by the framework; the given cells are used instead;
- if a root node is specified the search operation will only scan its descendants;
- if a list of node types is specified, then only nodes of that kind are checked
during the search;
Hence, using helper objects is recommended when a huge number
of PushPage.addTable() calls is performed and populating the
helper objects can be made in an efficient way.
Dynamically changing screen tables are supported. When new HTML
cells are created for a screen table, their pointers can be added
through the addCell() method. HTML cells that are removed from
the page, on the other hand, don't need to be notified.
It is also possible to change the root node or the node types for future searches.
However previously found cells will be kept as part of the screen table
unless detached from the page.
Note that all the changes to an existing screen table are only performed during
an PushPage.addTable() execution.
The ScreenTableHelper helper can only be used with basic screen
tables, that is, screen tables suitable for association to
OverwriteTable, ScrollTable or MetapushTable
data tables.
Defined in lspushpage.js
Constructor Summary |
ScreenTableHelper
(<String> id, <Array> tableCells)
Creates a helper object that can be used in order to help the framework
finding the HTML cells that make up a screen table in the page DOM.
|
Method Summary |
void
|
addCell(<DOMElement> cellElement)
Operation method that adds an HTML cell pointer to a screen table
helper.
|
void
|
setNodeTypes(<Array> nodeTypes)
Setter method that specifies a list of HTML element types to be searched for
during the population of the screen table associated with this ScreenTableHelper.
|
void
|
setRootNode(<DOMElement> rootNode)
Setter method that specifies the root node to be used when searching for
screen table cells.
|
ScreenTableHelper
ScreenTableHelper(<String> id, <Array> tableCells)
Creates a helper object that can be used in order to help the framework
finding the HTML cells that make up a screen table in the page DOM.
Parameters:
tableCells
- An array that contains the DOM pointers to the HTML cells that currently make up the screen table. A null value is allowed; cells can be omitted or specified later using the addCell() method.
The specified HTML cells should be "legal" cells for the screen table with the specified id (i.e. should be defined according with the requirements for the cells of that screen table). Moreover, elements of any types are allowed, provided that they support textual or HTML content or that a suitable update property is set on the cell.
addCell
void addCell(<DOMElement> cellElement)
Operation method that adds an HTML cell pointer to a screen table
helper.
Lifecycle: Cell pointers can be added to the related
screen table helper at any time.
However, if a pointer is added while the screen table is currently
associated to a data table in "running" state, then it will not be used
until the next association of a data table (possibly the same) to the
screen table through a new PushPage.addTable() call.
Parameters:
cellElement
- A DOM pointer to an HTML node. The specified HTML node should be a "legal" cell for the managed screen table (i.e. should be defined according with the requirements for the cells of that screen table). Moreover, nodes of any types are allowed, provided that they support textual or HTML content or that a suitable update property is set on the cell. By default if nodes of INPUT or TEXTAREA type are supplied, their "value" property will be updated.
setNodeTypes
void setNodeTypes(<Array> nodeTypes)
Setter method that specifies a list of HTML element types to be searched for
during the population of the screen table associated with this ScreenTableHelper.
Anyway note that if nodes where explicitly set through the constructor or through
the addCell() method, then the search will not be performed at all. Moreover
cells added through constructor or through addCell() can be of any type
regardless of the array passed to this method.
Default value: an array containing DIV SPAN and INPUT.
Lifecycle: Node types can be speicified at any time.
However, if the list is changed while the screen table is currently
associated to a data table in "running" state, then it will not be used
until the next association of a data table (possibly the same) to the
screen table through a new PushPage.addTable() call.
Parameters:
nodeTypes
- an array of node types to be searched for. If the array contains an asterisk (*) then all the node types will be checked.
setRootNode
void setRootNode(<DOMElement> rootNode)
Setter method that specifies the root node to be used when searching for
screen table cells. If specified only descendants of the specified node will
be checked.
Anyway note that if nodes where explicitly set through the constructor or through
the addCell() method, then the search will not be performed at all.
Default value: the entire document.
Lifecycle: a root node can be speicified at any time.
However, if the element is changed while the screen table is currently
associated to a data table in "running" state, then it will not be used
until the next association of a data table (possibly the same) to the
screen table through a new PushPage.addTable() call.
Parameters:
rootNode
- a DOM node to be used as starting point when searching for screen table cells.
Lightstreamer HTML Client API
Documentation generated by
JSDoc on Tue May 22 11:46:54 2012