Skip to main content link. Accesskey S
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • ANNOUNCEMENT: Wiki changed to read-only. READ MORE...
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
  • API Documentation
Search
Community Articles > Web Experience Factory > Samples and Techniques for Web Experience Factory > Text With Image Custom Builder
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Click to view profileIBM contributorJonathan Booth
Contribution Summary:
  • Articles authored: 28
  • Articles edited: 38
  • Comments Posted: 13

Recent articles by this author

JumpStart slides from Connect 2014

The attached deck is from a JumpStart session at IBM Connect 2014. It takes you through the process of creating a multichannel, responsive application. It uses the MultiChannel Feature Pack 2 for WEF 8.0, and it is based on this article and attached archive: ...

What's New Slides from Connect 2014 Conference

The attached slides are from the session "What’s New in Digital Experience Development with IBM Web Experience Factory" from the Connect 2014 Conference. They describe the latest mobilemultichannel features from the latest MultiChannel Feature Pack for Web Experience Factory 8.0. There is also ...

Script Application Builder for Using JQuery and Other Scripting Libraries

Background and overview Web Experience Factory (WEF) customers are increasingly wanting to use jQuery and other script libraries for implementing portions of their applications. To aid in this effort we've been creating a number of articles and samples that show various ways of doing this ...

Building a Multi-Channel Application with Web Experience Factory

Building a MultiChannel Application with Web Experience Factory This article and sample shows how to use the latest Web Experience Factory (WEF) Feature Pack to build an application that runs on any desktop or mobile device. The application is a “Parks View” application for viewing and updating ...

Receiving a URL parameter from an external application

The attached sample illustrates how to pass a URL parameter from some external application into a WEF portlet. This sample uses a POC ("piece of content") resolver. A POC resolver is a mechanism for implementing the behavior for resolving a URL request received by WebSphere Portal. The following ...
Community articleText With Image Custom Builder
Added by IBM contributorJonathan Booth | Edited by IBM contributorJonathan Booth on May 2, 2013 | Version 2
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: Code Samples, Custom builder
Text With Image custom builder

This is an example of a simple “control” builder that adds a couple of elements to the specified page location. It also shows how a custom builder can be automatically applied to data fields using a Rich Data Definition library along with the Data Field Settings builder.

This builder adds these elements:

  • Some text (typically an indirect reference to some element of a data structure).
  • An image such as an icon.

It also optionally calls the Visibility Setter builder so that the image is hidden when the text value is null. The customer use case was for displaying a phone number with a little phone icon, and when the phone number is null the icon should not be displayed. For example in this screenshot there are three phone number fields, but the third “Mobile Phone” field is null, so the phone icon is not displayed.


In a list/table view, the icon is hidden based on the value in that row, as shown below.

The builder is shown here.


Now, using that builder on its own may be slightly useful, but the real value comes when it's referenced via a Rich Data Definition (RDD) base library and used with Data Field Settings.


Using a builder as a “rendering builder” with Data Field Settings

The real value of a builder like this comes when it's used as a “rendering builder” which is automatically applied to data fields via the Page Automation system. Any control builder can be used as a rendering builder if:

  • It uses a builder input “PageLocation” to define where it generates UI.
  • It uses a builder input named “Value” for the value it is displaying/updating.
  • Any other required builder inputs can be defined via XML settings in an RDD file.

To add a rendering builder to a base RDD file, you can use the “DisplayControl” or “DataEntryControl” elements in the base RDD file. This is documented here: http://infolib.lotus.com/resources/portletfactory/8.0.0/WEF80ABD003/en_us/wef.8.0.0.html-wrapper.html#r_data_def_props

Here is the relevant section of the RDD base library in the sample package. Notice that the “HideIfNull” input is set and the ImageFile” input refers to the phone GIF file.

"base_PhoneWithImage"

 


com.ibm.samples.builders.TextWithImageBuilder Phone With Image "HideIfNull"
 
true "ImageFile"
 
/samples/demos/images/phone_16.gif

Once this is done, you can apply the builder to any of your data fields using the Data Field Settings builder as shown here. Notice how the “Phone With Image” field type is offered along with all the standard field types.


Sample files:

  • TextWithImageBuilder.bdef – the BuilderDef file for the builder (this was created using the Builder Skeleton builder).
  • TextWithImageBuilder.java – the builder's regen class.
  • sample_base_datadef.xml – the base RDD file where the “Phone With Image” field type is defined.
  • CustomerInfoService.model – the simple provider model using XML data from a Variable.
  • CustomerInfo1.model – this shows how the icon would be applied without the custom builder, using Image and Visibility Setter builders.
  • CustomerInfo2.model – this shows how the custom builder can be manually applied to data fields (this is not the recommended approach).
  • CustomerInfo3.model – this shows the recommended approach for using the custom builder. The custom builder is used in a base field type in the RDD library, and it's applied to three fields (on all pages) using the Data Field Settings builder.
expanded Attachments (1)
collapsed Attachments (1)
File TypeSizeFile NameCreated OnDelete file
application/x-zip 12 KB text_with_image_builder.zip 4/17/13, 4:03 PM
expanded Versions (3)
collapsed Versions (3)
Version Comparison     
VersionDateChanged by              Summary of changes
3Jul 9, 2013, 10:37:18 AMJonathan Booth  IBM contributor
This version (2)May 2, 2013, 2:46:38 PMJonathan Booth  IBM contributor
1Apr 18, 2013, 1:37:09 PMJonathan Booth  IBM contributor
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 LinkThe Social Lounge
  • 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