Widget definition is in an XML file. Here is an example of the
widget definition:
<iw:iwidget name="htmlWidget" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget" iScope="htmlWidget" supportedModes="view" mode="view">
<iw:resource uri="htmlWidget.js"/>
<iw:resource uri=“utils.js”/>
<iw:resource uri=‘htmlWidget.css’/>
<iw:itemSet id="attributes" private="true">
<iw:item id="url" value=""/>
</iw:itemSet>
<iw:itemSet id=“life" private="true">
<iw:item id=“user" value=‘{“name” : “Jesse”, “phone” : “110”}’/>
<iw:item id=“fruit" value=‘[“apple”, “orange”, “pear”]’ />
<iw:item id=“movies” value=‘[“Batman”, “Leon”, “The Godfather”]’ />
</iw:itemSet>
<iw:content mode="view">
<![CDATA[
<iframe class="rootFrame" style="width:100%;min-width:60px; min- height:200px;border:0px;"></iframe
]]>
</iw:content>
<iw:content mode="view1">
<![CDATA[
<div id='userName'></div>
<input type="text" name="amount" id="amount" size="10" maxLength="10">
]]>
<div><input type="button" style="height=30px" value="OK" onclick='iContext.iScope().onClickButton1()'/></div>
</iw:content>
Tags are described in the following tables.
-
Table 1. iWidget name tagParameter |
Description |
name |
Name of the widget. Mandatory. |
xmlms:iw |
Namespace of iWidget. Mandatory. |
iScope |
The class name defined in the javascript file. Optional. |
supportedModes |
The modes that the widget supports, in BTT Web2.0 iWidget,
it supports view, collapse, max, close, edit, refresh. Optional. |
mode |
the default mode, the default value is view.
Optional. |
Table 2. resource tagParameter |
Description |
uri |
Indicates the JavaScript™ file or CSS file, optional.
The resource file can be shared among different widgets, but it will only
load once. And you can define multiple URI in one widget XML file. |
-
Table 3. itemSet tagParameter |
Description |
id |
The id of itemSet. The itemSet with attributes as
ID contains the attributes for the widget. Mandatory. |
private |
The scope of itemSet, BTT Web2.0 iWidget supports
true as the value, which means user can’t get the attribute of the itemSet.
Mandatory. |
item |
The items defined in itemSet, developer can define
multiple items in an itemSet. |
-
Table 4. item tagParameter |
Description |
id |
The id of item. Mandatory. |
value |
The value of item. Mandatory. |
Table 5. content tagParameter |
Description |
mode |
The mode defines the forms in which the widget can display
on the workplace. |