OpenAjax Metadata 1.0 Specification Widget Overview
NOTE: This wiki page holds part of the OpenAjax Metadata 1.0 Specification.
Chapter 2: Widget Overview
This chapter provides an overview of "OpenAjax Widgets".
The OpenAjax Widget format targets the following two definitions of the term "widget":
- UI controls - The user interface components—such as combo boxes, menu bars, charts, and calendars—that some Ajax libraries provide.
- Mashup components - Pre-packaged mini-applications (sometimes called "widgets" or "gadgets") that can be combined together within a composite application (the "mashup"), where the mashup components react to each other intelligently, such as when the user selects an address in one component, and a different component displays an updated map for that address.
An OpenAjax Widget consists of two components:
- Widget metadata (expressed in XML).
Note that this specification does not focus on desktop-installed mini-applications that run outside of the browser, such as the "widgets" or "gadgets" that run inside the Apple Dashboard or the Microsoft Vista Sidebar, or that launch from a mobile phone. Other standards organizations, such as the W3C, are focused on desktop-installed scenarios.
OpenAjax Widgets encompasses:
- Markup for describing widgets and their dependencies
- Support for multiple languages
- Macro substitution for property values, localization strings, widget ID strings, and bidirectional text (BIDI)
- Widget APIs (for "mashable widgets")
The XML markup for OpenAjax Widgets specifies the following tags for all widgets:
- Specifies the HTML markup that contains the widget's user interface. The block of HTML that is included within (or referenced by) the <content> element must be suitable for inclusion within an HTML <div> or <span> element. <script> elements can be included within this block of HTML.
- <require> and <library>
- Defines one of the widget's properties. Properties represent configurable widget parameters that might be assigned values at design-time via a property editor dialog or (in mashup scenarios) at run-time. (Shared properties are one way that widgets can interact when used together in a mashup.)
- Descriptive elements such as <description>
- The <description> element provides a long description for the widget. Other descriptive elements include <title>, <shortDescription>, <example>, <remarks>, <reference>, and <author>.
- Provides a category keyword for this widget to allow a widget catalog to group this widget with other widgets that belong to the same category.
And an additional tag for mashable widgets:
- Defines a message topic through which this widget communicates with other widgets when used in a mashup. For each given topic, a widget can indicate that it either publishes events on that topic, or subscribes to events on that topic, or both. (Pubsub techniques -- i.e., publish and subscribe -- are a second way that widgets can interact when used together in a mashup.)
See the Mashable widgets section below for an overview of features specific to mashable widgets.
UI control example
The following illustrates a sample color palette widget. This sample widget requires the Dojo toolkit (version 1.2) and the color palette widget that is included within Dojo.
In this specification, the term mashable widget indicates an OpenAjax Widget that includes various optional features that allow that widget to interact with other OpenAjax Widgets at run-time when combined with other widgets in a mashup.
The following is an overview of the optional features in OpenAjax Widgets that enable a widget to interact with other OpenAjax Widgets in a mashup:
- The 'jsClass' attribute on the <widget> element
NOTE: Developer tools that do not support the Widget APIs defined in this specification SHOULD NOT attempt to load widgets that include a 'jsClass' attribute.
- The 'sharedAs' attribute on the <property> element
- By default, properties are private to a given widget. Properties can be shared across widgets (i.e., public properties) by including a 'sharedAs' attribute on the <property> element. Public properties are managed by the mashup container application.
- The <topic> element
publish()method and can subscribe to messages published by other widgets by invoking the OpenAjax Hub 2.0 HubClient
subscribe()method (see OpenAjax Hub 2.0 Specification).
- widget lifecycle (e.g., widget loading and unloading)
- properties (e.g., handling notification of property value changes, changing property values)
- events (i.e., publish on a particular topic or subscribing to a topic, using the HubClient APIs from the OpenAjax Hub 2.0 Specification)
- modes (e.g., normal view mode, edit mode and help mode)
- URL proxies (some mashup environments require cross-domain requests to be channeled through a proxy server)
Mashable widget example
The Widget APIs chapter includes an example of a mashable widget.
OpenAjax Widget Developer Notes
OpenAjax Alliance maintains a wiki page that contains supplemental widget developer tips and guidelines beyond what is in this specification, such as specific techniques for particular Ajax libraries. The wiki page is at: