+

Search Tips   |   Advanced Search

Class attributes for iWidgets on static pages


Similar to the portlet microformat, the portal supports the iWidget microformat. We use it to place an instance of an iWidget on a static page to be rendered by the portal. If the iWidget definition referenced in the iWidget microformat has not been registered to the portal before creating the static page, the static page deployment process makes sure of the iWidget registration.

Refer to the following list of class attributes. Examples of iWidgets rendered from HTML is also provided. For more information about the iWidget microformat for including iWidgets into a broader set of markup, such as a portal page, refer to iWidget Specification V 2.1


Including iWidgets in a static page

Both the iw-iWidget and the iw-Definition attributes represent the minimum class attribute values required for adding iWidgets on a static page.

Refer to the following example for rendering a static page with a single iWidget instance from full HTML markup. The iWidget instances uses the standard skin and is added to the sampleContainer component container in the layout of the static page.

Example:

<html>
   <head>
      <title>Sample Static Page with iWidget instance</title>
   </head>
   <body>
      <p>This is a static page example, which includes a single iWidget instance.</p>

      <div class="component-container" name="sampleContainer">

         <!-- microformat to include an instance of the SampleWidget iWidget in the page -->
         <div class="iw-iWidget" id="sampleWidget" style="skin:csa2.standard">

            <!-- Reference the definition of this iWidget instance using a WebDAV file store URI -->
            <a class="iw-Definition" href="http://myco.com/dav:fs-type1/iwidgets/sampleWidget/SampleWidget.xml"></a>
         </div>
      </div>
   </body>
</html>
The iWidget specification details further class attribute values. Those microformats can be used when placing an iWidget instance on a static page to override specifications from the referenced iWidget definition or to define iWidget items that do not exist in the referenced iWidget definition. The following paragraphs provide an overview of the available class attribute values.


Define iWidget event descriptions and events

Example:

<div class="component-container" name="sampleContainer">
   <div class="iw-iWidget" id="sampleWidget" style="skin:csa2.standard">
      <a class="iw-Definition" href="http://myco.com/p/dav:fs-type1/iwidgets/sampleWidget/SampleWidget.xml"></a>

      <!-- one per described iWidget event -->
      <span class="iw-EventDescription" >
         <span class="iw-PayloadType">{text/javascript}String</span>
         <span class="iw-Description">
            <!-- one per locale -->
            <span class="iw-Value" lang="en">This is a sample event description.</span>
         </span>
         <span class="iw-Title">
            <!-- one per locale -->
            <span class="iw-Value" lang="en">Sample Event Description</span>
         </span>
      </span>

      <!-- one per event -->
      <span class="iw-Event iw-Published iw-Handled" >
         <a class="iw-DescRef" href="http://setgetweb.com/p/portal80/#sampleEventDescription"></a>
         <span class="iw-Handler">handleEventFn</span>
         <span class="iw-NewWire">handleNewWireFn</span>
         <span class="iw-RemoveWire">handleRemoveWireFn</span>
      </span>
   </div>
</div>


Define wires between iWidget instances

The following example shows the specification of a wire when placing a single iWidget instance on a static page from an HTML fragment. The example does not show the microformat that includes the source iWidget instance, and it assumes that the target endpoint of the wire is defined in the iWidget definition of the shown iWidget instance.

<div class="component-container" name="sampleContainer">
   <div class="iw-iWidget" id="sampleWidget" style="skin:csa2.standard">
      <a class="iw-Definition" href="http://myco.com/p/dav:fs-type1/iwidgets/sampleWidget/SampleWidget.xml"></a>

      <!-- one per event to receive -->
      <span class="iw-ReceivedEvent">
         <a class="iw-SourceEvent" href="http://setgetweb.com/p/portal80/#anotherSampleWidgetID">sampleSourceEvent</a>
         <span class="iw-TargetEvent">sampleTargetEvent</span>
      </span>
   </div>
</div>


Initializing iWidget item sets

The following example shows the initialization of an iWidget item set, which contains one item, when placing a single iWidget instance on a static page from an HTML fragment:

<div class="component-container" name="sampleContainer">
   <div class="iw-iWidget" id="sampleWidget" style="skin:csa2.standard">
      <a class="iw-Definition" href="http://setgetweb.com/p/portal80/dav:fs-type1/iwidgets/sampleWidget/SampleWidget.xml"></a>

      <!-- override values from iWidget definition -->
      <span class="iw-ItemSet" >
         <!-- one per item value supplied -->
         <a class="iw-Item" lang="en" href="http://setgetweb.com/p/portal80/#sampleItem">sampleValueForEnglish             &
            lt;!-- one per additional locale -->
            <span class="iw-Value" lang="de">sampleValueForGerman</span>
         </a>
      </span>
   </div>
</div>


Define iWidget instance content

The following example shows how we specify of the iWidget content for the view mode when you place a single iWidget instance on a static page from an HTML fragment:

<div class="component-container" name="sampleContainer">
   <div class="iw-iWidget" id="sampleWidget" style="skin:csa2.standard">
      <a class="iw-Definition" href="http://setgetweb.com/p/portal80/dav:fs-type1/iwidgets/sampleWidget/SampleWidget.xml"></a>

      <!-- one per iWidget mode (if allowed by the iWidget definition) -->
      <div class="iw-Content view">
         <!-- content for this iWidget mode -->
         <p>The iWidget instance is currently rendered in view mode.</p>
      </div>
   </div>
</div>


Complex example of a static page including iWidgets

The following code snippet combines all the examples shown previously in one single static page from full HTML markup. To create a wire between iWidgets, a second iWidget instance is placed on the static page that serves as the publisher of the event.

<html>
   <head>
      <title>Sample Static Page with two wired iWidget instances</title>
   </head>
   <body>
      <p>This is a static page example, which includes two iWidget instance that can exchange events.</p>

      <div class="component-container" name="sampleContainer">
         <!-- microformat to include an instance of the SampleWidgetA iWidget in the page -->
         <div class="iw-iWidget" id="SampleWidgetA" style="skin:csa2.standard">
            <!-- references the definition of this iWidget instance using an portal server relative URL -->
            <a class="iw-Definition" href="http://setgetweb.com/p/portal80//sampleWidgetA/sampleWidgetA/SampleWidgetA.xml"></a>
         </div>

         <!-- microformat to include an instance of the SampleWidgetB iWidget in the page -->
         <div class="iw-iWidget" id="SampleWidgetB" style="skin:csa2.standard">
            <!-- references the definition of this iWidget instance using a WebDAV file store URI -->
            <a class="iw-Definition" href="http://setgetweb.com/p/portal80/dav:fs-type1/iwidgets/sampleWidgetB/SampleWidgetB.xml"></a>

            <!-- defines an event description -->
            <span class="iw-EventDescription" >
               <!-- defines the JavaScript type String as payload of events based on this event description -->
               <span class="iw-PayloadType">{text/javascript}String</span>
               <span class="iw-Description">
                  <!-- defines the description of this event description for the English locale -->
                  <span class="iw-Value" lang="en">This is a sample event description.</span>
               </span>
               <span class="iw-Title">
                  <!-- defines the title of this event description for the English locale-->
                  <span class="iw-Value" lang="en">Sample Event Description</span>
               </span>
            </span>

            <!-- defines a target event based on the sampleEventDescription event description;
                 this event is handled by the handleEventFn JavaScript function -->
            <span class="iw-Event iw-Handled" >
               <a class="iw-DescRef" href="http://setgetweb.com/p/portal80/#sampleEventDescription"></a>
               <span class="iw-Handler">handleEventFn</span>
            </span>

            <!-- defines wire between sampleWidgetA and sampleWidgetB, where                  
                    - the source event is specified in the definition of sampleWidgetA and                  
                    - the target event is specified in the microformat of sampleWidgetB -->
            <span class="iw-ReceivedEvent">
               <a class="iw-SourceEvent" href="http://setgetweb.com/p/portal80/#SampleWidgetA">sampleSourceEvent</a>
               <span class="iw-TargetEvent">sampleTargetEvent</span>
            </span>

            <!-- overrides the items of the sampleItemSet item set from the iWidget definition -->
            <span class="iw-ItemSet" >
               <!-- overrides the values of the sampleItem item of the iWidget definition                     
                       with values for the English and for the German locale -->
               <a class="iw-Item" lang="en" href="http://setgetweb.com/p/portal80/#sampleItem">sampleValueForEnglish                   
               <!-- defines the value of this item for the German locale -->
                  <span class="iw-Value" lang="de">sampleValueForGerman</span>
               </a>
            </span>

            <!-- defines the markup of the iWidget instance in view mode -->
            <div class="iw-Content view">
               <!-- defines the content for this iWidget mode -->
               <p>The iWidget instance of SampleWidgetB is currently rendered in view mode.</p>
            </div>
         </div>
      </div>
   </body>
</html>


Parent: Define and render a static portal page in HTML
Related reference:
Example HTML markup for defining a portal page
Class attributes for portlets on static pages
Class attributes for a portlet container on static pages
Class attributes for components on static pages
Navigation options for static pages
Portlets for adding dynamic elements to static pages
Registering iWidgets for use with the Page Builder theme
iWidget Specification V 2.1: http://public.dhe.ibm.com/software/dw/lotus/mashups/developer/iwidget-spec-v2.1.pdf