Public Member Functions | |
AbstractWidget | findByWidgetId (Number widget_id, Boolean missing_ok) |
Find a widget instance by its id. | |
AbstractWidget | findByNode (Node node) |
Find a widget instance which was constructed using the given input Node. | |
AbstractWidget | findByAppId (String app_id) |
Find a widget instance whose appId member variable is equal to the provided app_id. | |
void | processConstructorNodes (Array nodes) |
Process all the constructor nodes in the provided Array. | |
burst.webui.widgets.AbstractWidget | processConstructorNode (Node node, Boolean ctor_must_exist) |
Process the single constructor node. | |
void | findAndProcessConstructorNodes () |
A convenience, equivalent to this.processConstructorNodes(WidgetManager.findConstructorNodes()) . | |
void | getAndProcessConstructorNodes (Array ids, Boolean widget_id_strict) |
A convenience, equivalent to this.processConstructorNodes(WidgetManager.getConstructorNodes(ids, widget_id_strict)) . | |
Static Public Member Functions | |
void | registerWidgetClass (String name, Function ctor) |
Register a widget constructor by name. | |
String | getInlineWidgetType (Node node, Boolean missing_ok) |
Extract the widget class name from an inline constructor. | |
String | isInlineConstructor (Node node) |
Returns whether the provided node is an inline constructor or not (by checking for the marker attribute). | |
Array | findConstructorNodes (Document doc) |
Iterates through the Nodes in the DOM document looking for ones with the marker attribute. | |
Array | getConstructorNodes (Array ids, Boolean be_strict, Document doc) |
Unlike findConstructorNodes, which iterates through the whole DOM, this returns an Array of Node objects matching just the provided element ids. | |
Static Public Attributes | |
Boolean | findWidgets |
Class property: Whether to search all elements on the page for inline constructors (elements with the marker attribute). | |
String | initWidgetIds |
Class property: If specified, a list of IDs of elements on the page which are inline constructors. |
|
Find a widget instance whose appId member variable is equal to the provided app_id. Returns undefined if none. Note that the application may have used the same appId in multiple widgets, but if so, only the first is returned. Returns undefined if none. |
|
Find a widget instance which was constructed using the given input Node. Note there may conceivably be multiple widgets associated with the same node, but only the first is returned. Returns undefined if none. |
|
Find a widget instance by its id. If none found, will return if missing_ok, otherwise will throw.
|
|
Iterates through the Nodes in the DOM document looking for ones with the marker attribute. Returns an Array of the Nodes. It does search recursively, but it does not descend the element tree underneath any inline constructor; it only finds top-level inline constructors. This function does not process the constructors, it just returns the Nodes. This function should not be called prior to the document onload event (since there may not be much of a tree yet).
|
|
Unlike findConstructorNodes, which iterates through the whole DOM, this returns an Array of Node objects matching just the provided element ids. If any id does not exist as a DOM element, or if the found node has no marker attribute, the handling is according to be_strict. If be_strict, an Error is thrown. If !be_strict a warning is issued and the id is skipped. This function should not be called prior to the document onload event.
|
|
Extract the widget class name from an inline constructor. Must be found in the attribute unless missing_ok is true. The value is not checked, but just returned. |
|
Process the single constructor node. It will get the value of the marker attribute to determine the widget type (class name). If the script file defining that widget is not yet loaded, and !ctor_must_exist it will attempt to load the appropriate script. In that case, completion is asynchronous (the widget may not be defined at the time the function returns, and nothing will be returned synchronously).
|
|
Process all the constructor nodes in the provided Array. Notice that the first constructor to thrown an exception will abort all processing. |
|
Register a widget constructor by name. Called at load time for each AbstractWidget subclass. This is a class method; there is only one class registry per process, but there can be multiple instance managers. NOTE: At this time, the name used at registration time must match identically to that used in inline constructor marker attribute values. In particular, we do not attempt to have implied packages. If you register 'SortTable' as a name, then you can use 'SortTable' in a attribute value, regardless of the package the constructor function lives in. |
|
Class property: Whether to search all elements on the page for inline constructors (elements with the marker attribute). Default value is false |
|
Class property: If specified, a list of IDs of elements on the page which are inline constructors. Can be an Array or a comma-separated String. No default. |