Using themes with Struts XDIME elements

In XDIME, themes can be used to define an overall look and feel that is tailored to the requesting device. Within the Theme editor in Rational Application Developer there are numerous style properties categories. One of these categories is Form. Within the Form category, there are different properties that control how form elements are displayed.

Supporting radio, checkbox, and multibox tags

One of the properties in the Form category, Selection List Style, is used to control how selection elements are displayed within a form. If no theme is applied or if a theme that contains the value "defaults" as the Selection List Style is used, the default display type is a drop down list.

For compatibility reasons, the Struts HTML radio and multibox tags have the same names in the Struts XDIME tag libraries. The function they provide is intended to be as similar to the original as possible. However it is impossible to guarantee that the presentation of these controls matches their names, as that depends on the applied theme. If you would like the radio tag to generate radio buttons and the multibox element to generate check boxes, an appropriate theme must be applied.

Coding example:
  1. Create a new selector called controls.
  2. Select Form under the Style Properties category.
  3. Select controls for the Selection List Style property.
  4. Save the theme in the Theme editor.
  5. In the JSP add the theme as an attribute on the canvas tag:
    <canvas layoutName="/Subscription.mlyt" type="portlet" theme="/subscription.mthm">
  6. Finally add the controls selector as the styleClass attribute to the <xdime:select> tag that contains the radio or multibox tag(s):
    <xdime:select property="accountType" multiple="false"
    	entryPane="mailserver_type" styleClass="controls">
    	<xdime:radio property="accountType" value="primary">
    		<bean:message key="option.primary" />
    	</xdime:radio>
    ..
    </xdime:select>
The MWPStrutsSample Portlet demonstrates this function and can be used as a reference.

Supporting the TextArea tag

XDIME does not have a separate element type to create textarea controls. Instead, to create the equivalent of an HTML textarea, a theme must be applied. Two of the properties in the Form category of the Theme editor are Rows and Columns. These values can be set to create a textarea of the desired height and width.
Note: For more information see the topic Working with Themes to create a theme policy in the IBM® Mobile Portal Accelerator Toolkit Information Center.
  1. Create a new selector called xftextinput.textarea.
  2. Select Form under the Style Properties category.
  3. Assign an integer value to the Rows property.
  4. Optionally, assign an integer value to the Columns property.
  5. Save the theme in the Theme editor.
  6. In the JSP add the theme as an attribute on the canvas tag:
    <canvas layoutName="/Registration.mlyt" type="portlet"
    	theme="/subscriptionTable.mthm">
  7. Finally add the textarea selector as the styleClass attribute to the <xdime:textarea> tag:
    <xdime:textarea property="comment" entryPane="comment" styleClass="textarea" />



Terms of use
(C) Copyright IBM Corporation 2012. All Rights Reserved.