Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

burst.webui.WidgetManager Class Reference

List of all members.

Detailed Description

The (typically singleton) class whose instance manages all widget instances.

Todo:
The choice of what is a class method/variable versus instance method/variable is somewhat ad hoc here, as one might expect for a singleton.


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.


Member Function Documentation

AbstractWidget burst.webui.WidgetManager.findByAppId String  app_id  ) 
 

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.

AbstractWidget burst.webui.WidgetManager.findByNode Node  node  ) 
 

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.

AbstractWidget burst.webui.WidgetManager.findByWidgetId Number  widget_id,
Boolean  missing_ok
 

Find a widget instance by its id.

If none found, will return if missing_ok, otherwise will throw.

Parameters:
widget_id The id. If not a Number, it will be converted to one (and throws if that fails).
missing_ok optional. If true, will return null rather than throwing if none found.

Array burst.webui.WidgetManager.findConstructorNodes Document  doc  )  [static]
 

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).

Parameters:
doc Optional, defaults to document.

Array burst.webui.WidgetManager.getConstructorNodes Array  ids,
Boolean  be_strict,
Document  doc
[static]
 

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.

Parameters:
ids The Array of id values, or String of comma-separated ids.
be_strict Optional, defaults to false. Whether to throw an Error (versus just warn) about bad ids
doc Optional, defaults to document.

String burst.webui.WidgetManager.getInlineWidgetType Node  node,
Boolean  missing_ok
[static]
 

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.

burst.webui.widgets.AbstractWidget burst.webui.WidgetManager.processConstructorNode Node  node,
Boolean  ctor_must_exist
 

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).

Todo:
Right now, dynamic widget script loading seems not to work in Safari or Opera, just Moz and IE.

void burst.webui.WidgetManager.processConstructorNodes Array  nodes  ) 
 

Process all the constructor nodes in the provided Array.

Notice that the first constructor to thrown an exception will abort all processing.

void burst.webui.WidgetManager.registerWidgetClass String  name,
Function  ctor
[static]
 

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.


Member Data Documentation

Boolean burst.webui.WidgetManager.findWidgets [static]
 

Class property: Whether to search all elements on the page for inline constructors (elements with the marker attribute).

Default value is false

String burst.webui.WidgetManager.initWidgetIds [static]
 

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.


The documentation for this class was generated from the following file:
Generated on Tue Nov 30 04:03:09 2004 for BurstProject by doxygen 1.3.4