Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category Web Experience Factory 8 Documentation WebSphere Portlet Factory 7 Documentation WebSphere Portlet Factory 7.0.1 Documentation Custom Search Scope...
Search
Community Articles > Web Experience Factory > What are page automation templates?
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Rob Flynn
Contribution Summary:
  • Articles authored: 237
  • Articles edited: 298
  • Comments Posted: 2

Recent articles by this author

JAX-WS Handler Sample using IBM Web Experience Factory

Overview The Web Experience Factory (WEF) 8.0 release contains an enhancement to the web service call builders that gives you an option to define a global JAXWS handler class. This handler makes it possible for models to intercept and process the inbound and outbound SOAP envelopes associated ...

WebSphere Dashboard Framework 7.0.1.1 Fix pack now available

The WebSphere Dashboard Framework 7.0.1.1 Fix pack has been released.

IBM Web Experience Factory Version 7.0.1.4 Fix Pack is now available

This fix pack includes new fixes and updates for Web Experience Factory Version 7.0.1. and is now available on Fix Central and can be downloaded from here: ...

IBM Web Experience Factory WCAG 2.0 Compliance

IBM Web Experience Factory, developed and tested compliant to WCAG 2.0, can produce output (web pages, sites and content) that can be WCAG 2.0 Level A and Level AA compliant. IBM Web Experience Factory neither enforces nor prevents this compliance. Application developers must know and understand ...

Yeah!!! New IBM Web Experience Factory V8.0 is announced!!!

A quick snapshot of what's new in IBM Web Experience Factory... IBM Web Experience Factory is all about making it quick and easy to develop applications (portlets) that are included as part of an exceptional web experience. We've seen our customers doing some awesome stuff, whether it be ...

Community articleWhat are page automation templates?

Added by Rob Flynn | Edited by IBM contributor R Flynn on January 14, 2010 | Version 13
  • 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: overview, Page Automation, PageAutomation
The Data Page builder, along with the other builders that use Data Page, can automatically generate HTML for displayed pages. We call this feature “Page Automation”. You can control the look and feel of this generated HTML by using Page Automation HTML Templates.

Page Automation HTML templates


There is a default HTML template which is very useful for rapid prototyping and simple pages. However, when you want to achieve a specific look and feel for your generated pages, you can create your own HTML template and use this approach to format multiple application pages with little or no hand-crafting.


Why use an HTML template?


You can control the automatic generation of HTML by using HTML template files that guide the actions of the page automation builders. This control greatly reduces the need to hand-craft the look and feel of each individual page. To create your own HTML template, copy of one of the master templates that come with the product and edit it.


Use one HTML template for all pages in an application to achieve a consistent look and feel or use different templates for different pages or sets of pages. You use HTML templates in conjunction with imported pages (Imported Page builder) for content layout, graphics and non-generated artifacts. You can also use them with style sheets.


When to use an HTML template?


The amount of control you want to exert over the look of the application will vary depending on your situation. In some cases, auto-generated HTML will be just fine. In other cases, you might want a more sophisticated look and feel for your pages than what is available by default from the page automation system.


In general, you have several options to choose from when it comes to page formatting:



Let system determine page look and feel Use Data Page and its associated builders to generate all the HTML needed for an application. This insulates you completely from changes and ensures that, if the data driving your application changes, your pages will reflect the changes automatically.
Create a base page and stylesheet If you want your own look and feel you can add a base HTML page and a style sheet to get some control over the way that page looks. Used in conjunction with Data Modifiers, this will give you control over many of the elements on your page.
Hard code HTML tags If you want complete control over the look of the application you can also hard code individual tag names into an HTML page to control the display of all items on the page. This approach can be tedious and you can end up tied to the underlying data. In addition, you are not taking advantage of the Data Page builder's page generation capabilities.
Use an HTML Template This approach represents a great middle ground and provides two major advantages: HTML Templates offer you a lot of control over individual page elements and HTML Templates also allow you to exploit the Data Page builder's ability generate the bulk of the HTML code.

The structure of automatically generated HTML templates


Pages generated by the Data Page builder have a common structure that is based on constructs.


A construct is a building block of a displayed page. By changing an HTML master template you can alter the way a construct displays a page element. Each construct is composed of sub-elements that define its content. For example, some basic page constructs include:


Construct Sub-elements
Table Wrapper

Label

Title
Column Header

Header sorted

Column data
Display Group Wrapper

Label

Group
Field Display field

Data entry field

The system provides HTML master templates that include all the constructs that are generated by the Data Page builder. Typically, you will create your own HTML templates from these master files. By editing the sections of the HTML template that define the constructs of interest, you can control how page elements are displayed.


16 basic constructs


There are 16 basic constructs that constitute a generated page.


The HTML template file contains examples of HTML for each of these constructs. The HTML will applied to the resulting page as needed. The example HTML is identified using the name attribute. For example:

<td name="ColumnHeader_int" align="center" class="label"> 

<span name="HeaderElement"></span> 

</td> 



A construct always starts with the XML element that contains the name attribute that matches the construct name ("ColumnHeader_int"), with or without qualifiers appended.


Note: Names are case sensitive.

Constructs include the following:

    • DisplayPageWrapper
    • DataEntryPageWrapper
    • TableWrapper
    • TableLabel
    • Table
    • ColumnHeader
    • ColumnHeaderSorted
    • ColumnData
    • DisplayGroupWrapper
    • DisplayGroup
    • DisplayGroupLabel
    • DisplayField
    • DataEntryGroupWrapper
    • DataEntryGroup
    • DataEntryGroupLabel
    • DataEntryField
Data Entry vs. Display constructs


All of the constructs except Table can be divided into two groups, Data Entry and Display. This distinction is always made on a page-wide basis. In other words, if there are any Data Entry fields on the page, then the entire page is considered to be a Data Entry page, and every selection of a construct will be made.



Adding elements to a template


Sometimes you will want to use additional builders which will operate on HTML generated by the Page Automation code.


For example, you might want to include an Add Row button for a table, that enables the end-user to add a row. You would like to include an extra row at the bottom of the table which contains a named tag to which you can attach your Button builder. Furthermore, the table template that you are using might be used elsewhere on the page, so you want to be able to make sure your Button builder targets exactly the right tag.


The way to accomplish this is to create an XML node inside the construct that has a name that starts with an underscore. For example, you might make an element


<span name="_AddButton"> 


The system will rename this element when it uses the construct, by pre-pending the name of the container or field that was being rendered when it chose this construct. In this example, if the above span appeared inside the Table construct and was used to create the PhoneNumber table, that node would be changed to the following span on the page, making it perfect for attaching a Button builder.


<span name="PhoneNumber_AddButton"> 


Alternating styles (and classes) for table rows


Often, in creating an HTML table, you want to have alternating styles for the rows to make the table easier to read.


You can build this functionality into an HTML template. On any XML node for which an alternating attribute is desired, simply prefix the attribute name with sequence_ (with the underscore) and list the different values for the attribute in a comma-separated list.


For example, in a

<TR>
tag, to alternate between the HTML class names TableRowOdd and TableRowEven, add the following:


<tr sequence_class="TableRowOdd,TableRowEven"> 

... 

</tr> 


This technique has the identical effect as adding an attribute sequencer on the node, selecting the class attribute, and supplying those values for the sequence. You can apply the sequence_ prefix to any attribute, so you could define the style directly. For example:



<div sequence_style="background-color:white,background-color:cyan"> 

... 

</div> 


Fitting constructs together

The critical part of building your own template is understanding how the constructs fit together.


You have to specify the different elements so that, when they are fitted together, they will result in valid HTML. There are two features that make this process easier:

  1. Inner constructs can be created in place, that is, inside the elements where they will eventually be placed by the Page Automation engine. The rule is that any container element will be emptied before it is used.
  2. You can add text in the places where text will eventually go in the finished page, so that you can see, in the template page, what it will look like.
Fitting constructs together mirrors the rules that apply to building well-formed HTML. An important consideration when fitting constructs together is that all examples of the constructs that might go in a particular container must be built with HTML that will fit correctly. For example, if you make your DisplayPageWrapper such that the PageContentsContainer within it is a tag, then the constructs TableWrapper and DisplayGroupWrapper should start with a tag, or, perhaps, with a that contains tags. You can make several different versions of the TableWrapper tag, with different qualifiers, but they all should be crafted to fit within all versions of the DisplayPageWrapper and the DataEntryPageWrapper constructs.

HTMLWRAPPER tags


The HTML templates provided by IBM® WebSphere® Portlet Factory include tags around some of the markup.


This is part of the XML markup of the model. The tag is used to contain elements of the page to which you can apply other builders. This tag is used in place of standard HTML tags in places where HTML markup would not allow a tag, for example, between a

and a tag. When the page is transformed to JSP, these tags are removed, leaving valid HTML markup.


The following is an example of how this tag is used around a table row in the columnar.html template.

<HTMLWRAPPER name="LabelContainer"> 



  <TR name="TableLabel"> 

   <TD colspan="4"> 

    <SPAN name="LabelText">Table Label</SPAN> 

   </TD> 

  </TR> 



</HTMLWRAPPER> 


For custom HTML, you can use this tag around elements that you intend to attach with builders. Be sure to provide a unique name on the name attribute.


Qualifying a construct by field control type

You can also qualify the DataEntryField and the DisplayField according to the control type that will be used to display them, using the qualifier _ (including the underscore).


For example, if your normal data entry field layout is to have 4 columns containing the label, the required prompt, the input element, and the validation error, respectively, but when the input element is a text area, you would like, instead, to use two rows, where the first row has the label, the required prompt, and the validation error, and then the second row contains a single column (with colspan=4) which holds the textarea element. In this case, you would specify the normal DataEntryField construct with the name "DataEntryField," and then create another construct named DataEntryField_textarea.


Qualifying a construct by container/field name


To create a construct for a specifically named node that you know is going to appear in your data, use the qualifier.


This always gets the highest precedence. For example, if you know that your data contains a repeated element named "Order" and you want to use a non-default table layout for that table, you can create a construct named TableByName_Order which will be used only for the container named "Order".


Qualifying a construct by container/field type


In some cases, you might want to change the display of certain elements based on the type of the element.


For example, you might normally have column heads and column data left-aligned. However, if the data type is double you would like to center-align the column head and right-align the data. You do this by creating a construct name with the qualifier _. For the example above, you would have the normal ColumnHeader and ColumnData constructs, then you would add two other additional complete constructs with the names ColumnHeader_double and ColumnData_double.

Note: There is a special type name, "autodelete," that is applied to automatically generated columns created in the Data Column Modifier and which provide the delete functionality. This type is applied to all delete columns, no matter what type of delete column choice was selected (Link, Button or Checkbox). You can use the autodelete type qualifier with ColumnHeader or ColumnData constructs: for example, ColumnHeader_autodelete.


How Themes and HTML templates can work together


The default theme for a project provides a convenient way for you to specify HTML template files in your application.


HTML template files describe the formatting for all constructs generated by builders in the application. Using a theme, you can control HTML template use at the project level and in individual models. An input (Use Theme) in the following builders lets you invoke HTML template files based on the project default theme.

  • Data Page
  • Input Form
  • View & Form

These builders are used to generate the user interface (UI) in your application. Using the project default theme lets you manage HTML template use for your application UI in a central location. For an individual model, you can override the project default theme by using the Theme builder to specify different HTML templates files that override the defaults.


If you do not use a theme in those builders, use inputs (HTML Template File) to specify HTML template files for different page types. These specifications of HTML templates can be overridden by other builders at any level in the page automation hierarchy of contents, such as a Data Field Modifier or a Data Column Modifier. There is a hierarchy of action associated with the formats: more specific references override more general (global) settings. Thus a Data Field Modifier specification for a Field or Container node overrides the corresponding specification for that construct in the HTML template file.


When a template file is specified for a container, it is also used for all elements within that container, unless it is further overridden at a lower level.


You can also override a template file with the Data Hierarchy Modifier builder. In this case, the override does not affect the containers that were selected. Only new group containers that the builder creates are affected. This is a common reason to use the Data Hierarchy Modifier: so that you can quickly create new groups with an entirely different display style.


Page automation example: adding spacer rows to a table


By changing only the template, you can add spacer rows anywhere in a table: before the header, between the header and the data, before or after each data row, and after the entire table.


This example has far too many spacer rows. Notice that it uses a Construct Name Qualifier of ByName_PhoneNumber so that this construct will only apply to a container with the name PhoneNumber.


The important step for adding spacer rows before and after the data rows was to separate the RepeatElement from the DataContainer. In the basic template, the DataContainer element of the table construct was not specified, so it defaulted to the same XML node as the RepeatElement. In this example, we want to repeat more than just the data row, we want to repeat around a section that includes the data row and the spacer rows. This is accomplished by adding a tag which acts as the repeat element, and adding the



<tr>


for the DataContainer within it.


Note: All of the containers are left empty. This is because this overrides only the table construct, and the system will continue to use the ColumnHeader and ColumnData constructs that are already defined in the template. The (rather hideous) result of this addition to the basic template is beside it.


<table name="TableByName_PhoneNumber"> 

<tr><td colspan="100"> 

--- spacer row above header --- 

</td></tr> 

<tr name="TableHeaderContainer"></tr> 

<tr><td colspan="100"> 

--- spacer row below header --- 

</td></tr> 

<span name="RepeatElement"> 

<tr><td colspan="100"> 

--- spacer row above each data row --- 

</td></tr> 

<tr name="DataContainer"></tr> 

<tr><td colspan="100"> 

--- spacer row below each data row --- 

</td></tr> 

</span> <!-- end Table.RepeatElement --> 

<tr><td colspan="100"> 

--- spacer row below entire table --- 

</td></tr> 

</table> <!-- end Table construct --> 


Page automation example: changing page layout based on control type


Often you will want to change the layout for a field based on the control type. The most common situation is that you want any field which is edited using a textarea get the entire width of the screen for the textarea, even though the other fields are using only the right-hand portion for their edit devices.


With the following change to the basic template, plus a Data Field Modifier builder on the Comments section which tells it to use a textarea for editing, we get the desired results. For comparison, the normal Data Entry Field construct is shown here along with the qualified one.


<tr name="DataEntryField">
<td class="label"><span name="FieldLabel">Sample Field Label</span></td>
<td><span name="FieldRequired">*</span></td>
<td><span name="FieldElement">Sample Field Element</span></td>
<td><span name="FieldValidationError">Sample Validation Error</span></td>
</tr>
<span name="DataEntryField_textarea">
<tr>
<td class="label"><span name="FieldLabel">Sample Field Label</span></td>
<td><span name="FieldRequired">*</span></td>
<td></td> <!-- Leave empty so Validation column lines up. -->
<td><span name="FieldValidationError">Sample Validation Error</span></td>
</tr>
<tr><td colspan="4">
<textarea name="FieldElement" cols="40" rows="10"></textarea>
</td></tr>
</span>


  • Edit
  • More Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (13)
collapsed Versions (13)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (13)Jan 14, 2010 1:32:31 PMR Flynn  IBM contributor
12Jan 5, 2010 2:15:07 PMRob Flynn  IBM contributor
12Jan 14, 2010 1:29:53 PMR Flynn  IBM contributor
11Jan 5, 2010 2:14:29 PMRob Flynn  IBM contributor
11Jan 14, 2010 1:27:49 PMR Flynn  IBM contributor
10Jan 5, 2010 2:12:40 PMRob Flynn  IBM contributor
9Jan 5, 2010 2:07:53 PMRob Flynn  IBM contributor
8Jan 5, 2010 2:06:55 PMRob Flynn  IBM contributor
7Dec 11, 2009 10:49:41 AMRob Flynn  IBM contributor
6Dec 11, 2009 10:41:56 AMRob Flynn  IBM contributor
5Dec 11, 2009 10:36:57 AMRob Flynn  IBM contributor
4Dec 11, 2009 10:33:26 AMRob Flynn  IBM contributor
2Dec 11, 2009 10:18:13 AMRob Flynn  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
  • BlogsIBMSocialBizUX 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