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

burst.webui.widgets.AbstractWidget Class Reference

Inheritance diagram for burst.webui.widgets.AbstractWidget:

burst.webui.widgets.ControlWidget burst.webui.widgets.SortHead burst.webui.widgets.SortTable List of all members.

Detailed Description

Abstract base class for widgets.

These instances are managed by a burst.webui.WidgetManager instance.

Identifying and Finding Widgets

The provided node might be used for an inline constructor, and it will be replaced. Or it might be a node that will be left as is, but some behavior will be attached. Thus there might be 3 different objects that a person might want to relate:

  1. The input Node (which might be dynamically created by the caller, or from the document).
  2. The instance of a AbstractWidget subclass (hereafter, "widget instance").
  3. Any top-level Node that the widget instance may create as part of its implementation.
It is possible to recover any widget instance that was constructed using a given Node using the class method findByNode. It is conceivable that there may be multiple widgets using the same Node, but the function just returns the first one.

From a widget instance, it is possible to determine its input Node by the public variable inputNode.

The library maintains globally unique numerical ids of every widget instance. This can be obtained from an instance via the public variable widgetId. A widget instance from its widget id by findByWidgetId

A widget instance also holds a public readwrite String variable called appId. The library does not care what it is, or if it is even set. It is available for use by the client programmer. A widget can be recovered from a given appId using findByAppId

The id attribute of the input node, if any, is not used by us. Some widgets will remove their input node from the document, and id attributes are not copied over ito any replacement node(s).


Public Member Functions

 AbstractWidget (Node node, Array propdefs, Boolean parse_properties)
 constructor.

AbstractWidget addChildWidget (AbstractWidget child_widget)
 Add the provided widget instance as a child of this widget instance parent.

void parseProperties (Boolean do_defaults, Boolean do_mandatory)
 Initialize the widget instance from any "inline constructor" attributes as well as special immediate children.


Public Attributes

Node inputNode
 The Node used in this widget instance's constructor.

Number widgetId
 The generated globally unique id of this widget instance.

String appId
 Any id associated with the instance by the client programmer.


Constructor & Destructor Documentation

burst.webui.widgets.AbstractWidget.AbstractWidget Node  node,
Array  propdefs,
Boolean  parse_properties
 

constructor.

If parse_properties, call parseProperties(true, true). Otherwise, it calls burst.reflect.PropertyDef.setDefaultEach

Parameters:
node The input node (either in the document, or just created by the caller).
propdefs An Array of PropertyDef instances, used for configuration.
parse_properties Whether to parse the node for any configuration properties


Member Function Documentation

AbstractWidget burst.webui.widgets.AbstractWidget.addChildWidget AbstractWidget  child_widget  ) 
 

Add the provided widget instance as a child of this widget instance parent.

Returns the child.

void burst.webui.widgets.AbstractWidget.parseProperties Boolean  do_defaults,
Boolean  do_mandatory
 

Initialize the widget instance from any "inline constructor" attributes as well as special immediate children.

It uses the inputNode member variable (probably set by the constructor). It also uses the propdefs_ member variable (set to some constant array when the subclass calls the AbstractWidget super class constructor).

There are a few different ways property values are found from a node:

  • Any "buAppId" attribute becomes a value for the appId member.
  • Any declared property named "fooBar" will obtain its value from a attribute with the same name.
  • If the node has a "buProperties" attribute, its value is parsed to set multiple properties. The value syntax is CSS-like, for example:
    "fooBar: 1; title: 'some title'"
  • Within the node, if it has a 'buProperty' attribute, and with any immediate child which has a 'buProperty' attribute and no 'buType' attribute, set the property whose name is the value of the 'buProperty' attribute. The value of the property is the value of the 'buValue' property, if any, otherwise it is the innerHTML of the node with the buProperty attribute.

Todo:
also try xmlns attributes within some namespace uri, for example getAttributeNS(BURST_WIDGET_NS, unqualname)
Parameters:
do_defaults as with burst.props.AbstractProperties.setObjectValues
do_mandatory as with burst.props.AbstractProperties.setObjectValues


Member Data Documentation

String burst.webui.widgets.AbstractWidget.appId
 

Any id associated with the instance by the client programmer.

readwrite and optional

Node burst.webui.widgets.AbstractWidget.inputNode
 

The Node used in this widget instance's constructor.

readonly.

Number burst.webui.widgets.AbstractWidget.widgetId
 

The generated globally unique id of this widget instance.

readonly.


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