Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Connections wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category IBM Connections 3.0.1 Documentation Custom Search Scope...
Search
Community Articles > Widgets > iWidget Overview
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Duinseach Carey
Contribution Summary:
  • Articles authored: 38
  • Articles edited: 27
  • Comments Posted: 20

Recent articles by this author

Importing default media gallery object types

You must import the default photo and video object types provided with IBM® Connections to enable media galleries in IBM Connections deployments. This step is mandatory when Connections Files is installed.

Using Search - IBM Connections 4

This video shows you how to perform an advanced search to find information that is relevant to you.

Video: Using IBM Connections 4

This video provides an overview of some of the valuable capabilities found in IBM Connections 4.

Setting the timeout for seedlist requests

You can set the default timeout for seedlist requests by creating an IBM® WebSphere® Application Server environment variable and specifying the required value of the timeout.

Verifying email digests

You can verify that your email digests are working correctly by logging into IBM® Connections and accessing specific URLs to trigger the email digests to be sent.

Community articleiWidget Overview

Added by Duinseach Carey | Edited by IBM contributor Ronny A Pena on March 3, 2010 | Version 41
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: 2.5, iWidget, customizing, overview
This section provides a quick description of the iWidget specification and a simple example of an iWidget.  

The iWidget specification is an IBM standard for defining a common format for widgets. The iWidget specification is implemented in several IBM products, including IBM Lotus® Connections 2.5. To view the complete iWidget specification document, go to the following Web address: http://www-10.lotus.com/ldd/mashupswiki.nsf/dx/iwidget-spec-v1.0.pdf/$file/iwidget-spec-v1.0.pdf  

Lotus Connections supports version 1.0 of the iWidget specification.  

The iWidget XML descriptor  
The core component of any iWidget is its XML descriptor.  

Here is an example of the XML definition of a very basic iWidget. This widget displays the string "Hello world". When the user clicks the Click me button, the string "button clicked" is displayed under the button.

XML definition of a very basic iWidget  

<iw:iwidget name="helloWorld" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"

      iScope="HelloWorldWidgetClass" supportedModes="view">

      <iw:resource uri="helloworld.js" />            

      <iw:content mode="view">

        <![CDATA[

            <div id="root">

                  Hello World! <br/>

                  <button id="click" onclick="iContext.iScope().onClickButton()">Click me!</button>

                  <div id="placeHolder"></div>

            </div>

        ]]>

     </iw:content>    

</iw:iwidget>


  


        
This XML definition includes the following attributes.  

Table 1: iWidget attributes    
Attribute    
Description    
iScope    
The name of an instance of the declared JavaScript™ class. This class is the JavaScript class written by the widget developer, which implements the logic behind the widget.  

An instance of this class is automatically created by the iWidget framework and associated with the iWidget. The code of the backing class can be implemented in one of the JavaScript resource files using the iw:resource attribute.    
iw:resource  
Points to the resources needed by the iWidget. These resources are loaded dynamically and evaluated by the iWidget framework.  
iw:content    
Provides the widget markup (HTML code) and displays it to the end-user. There can be several different modes corresponding to different views supported by the widget.
 

The following screenshot shows how the widget is rendered when deployed in Lotus Connections.   

Hello World Widget


 
Note: The XML descriptor only defines the body part of the widget. The title bar and chrome around the widget body rendered using the above code sample are generated and added automatically by the Lotus® Connections widget framework.  


iContext and iScope objects  
The iWidget framework automatically inserts an object name, iContext, in to each widget iScope object as a member (this.iContext). The iContext can be used by the widget developer to interact with the iWidget framework, as in the onClickButton method in the following example.  

Declaration of the iScope class in "pure" JavaScript

var HelloWorldWidgetClass = function(){

      this.onLoad = function(){

            // your initialization code here

      }

     

      this.onClickButton = function(){         

            this.iContext.getElementById("placeHolder").innerHTML = "button clicked";

      }

}



 

Declaration using the Dojo JavaScript toolkit

dojo.provide("HelloWorldWidgetClass");

 

dojo.declare("HelloWorldWidgetClass", null,{

      onLoad: function () {

            // your initialization code here

      },

 

      onClickButton: function(){

            this.iContext.getElementById("placeHolder").innerHTML = "button clicked";

      }

});


 



Name-value pairs with itemsets  
An item set is a set of name-value pairs that is managed by the iWidget framework. You can declare item sets in the XML definition of your widgets.  

For example:

<iw:itemSet id="itemSet1">

      <iw:item id="item1" value="value1" />

      <iw:item id="item2" value="value2" />

</iw:itemSet>


 


ItemSets can be manipulated in your code using the iContext object associated with the i Scope object of the widget.  

For example:  

var item1Value = this.iContext.getItemSet("itemSet1").getItemValue("item1");

this.iContext.getItemSet("itemSet1").setItemValue("item1", "new value");


 



More details on the operations allowed on the itemset objects can be found in the iWidget specification document.    

ItemSets are used in Lotus Connections as a way to provide the widget with information related to the e mbedding environments, that is, the Home page, Profiles, and Communities features.    

ItemSets can also be managed, allowing the widget developer to persist preferences across sessions.
 
Widget mode
Lotus Connections supports the standard view and edit modes, as defined in the iWidget specification. The iWidget is responsible for providing a way to go back to the normal (or any other) view. An iWidget can switch modes programmatically by firing an onModeChanged event.  
   
For example:  

this.exitEditUI = function (controlObj)  
{  
     this.iContext.iEvents.fireEvent("onModeChanged", "", "{'newMode': '" +  
     this.iContext.constants.mode.VIEW + "'}");  
};

 
 



 

Parent topic  
Lotus Connections iWidget Development Guide  

Related topics  
Common iWidget Support in Lotus Connections  
iWidget Support in the Home Page  
iWidget Support in Profiles and Communities  
Best practices for iWidget development  

   

Authors: Vincent Burckhardt and Ronny A Pena  

  • Edit
  • More Actions Show Menu▼


expanded Attachments (1)
collapsed Attachments (1)
Edit the article to add or modify attachments.
File TypeSizeFile NameCreated On
image/x-png 2 KB hello_world_widget.PNG 7/7/09 7:56 AM
expanded Versions (41)
collapsed Versions (41)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (41)Mar 3, 2010 11:04:00 AMRonny A Pena  IBM contributor
40Mar 3, 2010 10:52:08 AMRonny A Pena  IBM contributor
39Mar 3, 2010 10:50:32 AMRonny A Pena  IBM contributor
38Mar 3, 2010 10:49:35 AMRonny A Pena  IBM contributor
37Nov 12, 2009 8:35:52 AMDuinseach Carey  IBM contributor
36Nov 12, 2009 8:34:32 AMDuinseach Carey  IBM contributor
35Nov 12, 2009 8:26:01 AMDuinseach Carey  IBM contributor
34Nov 12, 2009 8:21:46 AMDuinseach Carey  IBM contributor
33Nov 12, 2009 8:19:19 AMDuinseach Carey  IBM contributor
32Nov 12, 2009 8:16:03 AMDuinseach Carey  IBM contributor
31Nov 12, 2009 8:10:34 AMDuinseach Carey  IBM contributor
30Aug 29, 2009 1:28:07 AMDana Liburdi  IBM contributor
29Aug 29, 2009 12:26:27 AMDana Liburdi  IBM contributor
28Aug 11, 2009 1:57:40 PMPaddy Barrett  IBM contributor
27Aug 11, 2009 10:34:01 AMPaddy Barrett  IBM contributor
26Aug 11, 2009 8:13:13 AMDuinseach Carey  IBM contributor
25Aug 11, 2009 4:54:54 AMDuinseach Carey  IBM contributor
24Aug 11, 2009 4:48:42 AMDuinseach Carey  IBM contributor
23Aug 11, 2009 4:47:16 AMDuinseach Carey  IBM contributor
22Aug 11, 2009 4:46:15 AMDuinseach Carey  IBM contributor
21Aug 10, 2009 10:05:42 AMDuinseach Carey  IBM contributor
20Aug 10, 2009 10:04:03 AMDuinseach Carey  IBM contributor
19Aug 10, 2009 9:59:16 AMDuinseach Carey  IBM contributor
18Aug 10, 2009 9:50:12 AMDuinseach Carey  IBM contributor
17Aug 10, 2009 9:39:18 AMDuinseach Carey  IBM contributor
16Jul 13, 2009 10:23:50 AMDuinseach Carey  IBM contributor
15Jul 13, 2009 10:11:23 AMDuinseach Carey  IBM contributor
14Jul 9, 2009 8:25:07 AMDuinseach Carey  IBM contributor
13Jul 9, 2009 8:24:21 AMDuinseach Carey  IBM contributor
12Jul 9, 2009 8:19:40 AMDuinseach Carey  IBM contributor
11Jul 9, 2009 8:18:10 AMDuinseach Carey  IBM contributor
10Jul 9, 2009 7:43:15 AMDuinseach Carey  IBM contributor
9Jul 9, 2009 7:37:20 AMDuinseach Carey  IBM contributor
8Jul 9, 2009 7:35:14 AMDuinseach Carey  IBM contributor
7Jul 9, 2009 7:12:21 AMDuinseach Carey  IBM contributor
6Jul 9, 2009 7:01:14 AMDuinseach Carey  IBM contributor
5Jul 9, 2009 6:56:40 AMDuinseach Carey  IBM contributor
4Jul 8, 2009 9:08:50 AMDuinseach Carey  IBM contributor
3Jul 7, 2009 8:59:58 AMDuinseach Carey  IBM contributor
2Jul 7, 2009 8:56:14 AMDuinseach Carey  IBM contributor
1Jul 7, 2009 7:56:58 AMDuinseach Carey  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use