This module contains the base and common widget methods.
The most used method defined here is w$(), an alias of UI.Widget.get().
A Widget is a GUI component that interacts with users, such as a Table, a TreeView or a Form.
UI.Widget class manages the widget registry. This registry is a mapping between DOM elements and the associated widget, if any. Widget registration also ensures that a DOM element wrapped by a widget has the CSS class associated with it.
Once a widget instance is registed you can use the UI.Widget.get(element) to obtain a reference to the widget associated to the specified DOM element.
Widget registration is made by the constructor of the classes that inherits UI.Widget. If you extend UI.Widget, put something like this on the constructor:
My.PrettyWidget = function(...) { bindMethods(this) //Initialization stuff this.element = ... this.cssClass = ... this.register() }
The DOM element wrapped by the widget. (Read-Only).
The CSS class that the element wrapped by the widget must have. This property should have the same value on the same class instances, but should differ between UI.Widget derived classes.
UI.Widget.prototype.register():
Registers the widget. This should be called only from the derived classes constructors and after the element and cssClass propeties has been set.
Hides the widget.
UI.Widget.prototype.show(display="block"):
Shows the widget, using the CSS display property value specified by display.
UI.Widget.prototype.toDOM(parentElement), UI.Widget.prototype.__dom__(parentElement):
Implements the MochiKit's DOM coercion protocol <http://mochikit.com/doc/html/MochiKit/DOM.html#dom-coercion-rules>`_.
Copyright 2005-2006 Leonardo Soto M. <leo.soto@gmail.com> and Imagemaker IT <http://www.imagemaker.cl>.
This program is licensed under the CDDL v1.0 license, see http://www.sun.com/cddl/cddl.html.