Revamped Weblets in V11 SP4 to improve XSLT performance and browser compatibility of WAMs

Date:22 February 2008
Product/Release:LANSA for the Web (WAMs) V11 SP4
Abstract:WAM: Improve XSLT performance and browser compatibility of WAMs
Submitted By:LANSA Technical Support

As part of an ongoing program to improve WAM performance and browser compatibility, a number of Weblets have been revamped or rewritten in V11 SP4.

Revamped Weblets include std_anchor, std_boolean, std_button, std_char, std_checkbox, std_click_image, std_date, std_datetime, std_dropdown, std_float, std_hidden, std_input, std_integer, std_messages, std_time, std_varchar, std_script and std_style. These Weblets all have improved XSLT transformation times and and now work on all supported browsers.

Note: See special warning below if your WAM layouts use the LANSA supplied std_style and std_script Weblets.

The work on a number of other Weblets has resulted in changes that may have backwards compatibility issues. To avoid any such issues, new "v2" versions of the Weblets have been created. Existing application will need to be updated to take advantage of these new Weblets.

std_style_v2: The mechanism through which CSS stylesheets are loaded has been redesigned to make them easier to modify and to make better use of the power of CSS. It is no longer necessary to maintain multiple copies of the styles in std_style_base.css or create your own style Weblet (std_style_grass and std_style_royal are now deprecated). Now, a single std_style.css file is always loaded and modifications are then loaded over it. It is also possible to add multiple stylesheets to a layout or to an individual WEBROUTINE. The new mechanism can co-exist with with the old. So existing layouts that use std_style (or your own style Weblet) will still work.

std_layout_v2, std_layout[1-5]_v2: All the standard layouts have been modified to utilise the new style mechanism. For performance reasons, some of the customisation features have been removed as this can be better done using CSS.

std_menu_item_v2: The standard menu item has been simplified to achieve better performance. Most visual customisation has been removed in favour of using CSS. Support for left/right images in the menu item has been removed. Std_click_image and std_image_button are better tools for that job.

std_list_textarea_v2: The "Memo using a list" Weblet now performs proper word wrapping (at a word boundary instead of fixed character position) on the text returned to the server. It also preserves user entered line breaks. A "_v2" version of the Weblet has been created because existing back-end code may have special processing to handle the incorrect behavior of the previous Weblet which could be broken by the new Weblet.

std_grid_v2: The grid has been completely rewritten. It now has significantly improved XSLT transformation performance, improved browser rendering times and works on all supported browsers.

Default List Visualization: The default list visualisation has been updated to utilise some of the new grid code. This includes support for alternating row colours, sorting and column resizing.

WARNING!

Note: The following changes and warning were first issued with EPC802 but are also applicable for V11 SP4.

V11 SP4 introduces improvements in the way CSS stylesheets and JavaScript files are handled. If your WAM layouts use the LANSA supplied std_style and std_script Weblets, then you should experience no problems after installing this EPC. If you have created your own style and script Weblets that do not call the standard Weblets, then you may have problems after installing this EPC. In this case, you should make the modifications detailed below before applying this EPC.

Script:

Std_script.xsl has changed in a number of ways. It loads a new JavaScript file (std_script_v2.js) as well as the original (std_script.js) and it generates a number of JavaScript variables that are used by other Weblets to improve performance.

If your custom script Weblet currently calls std_script, then you will get this new functionality automatically. If it doesn’t, then it is likely that you have implemented the original std_script functionality yourself. We recommend that you remove this code and replace it with a call to the script template in std_script:

<xsl:import href="std_script.xsl" />
	<xsl:template name="my_script">
	      <xsl:call-template name="script">
	         <xsl:with-param name="javascript_files"/>
	         <xsl:with-param name="trap_script_errors"/>
	      </ xsl:call-template >

	      <!-- Custom script functionality here -->
	</ xsl:template>

Notice the new javascript_files property. If the purpose of your custom script Weblet is to load some extra JavaScript files, you may be able to use this new property and avoid the need for the custom Weblet. See the documentation for more details.

Be careful with the template name. If you named the template of your custom Weblet "script", then you will need to rename it to avoid an infinite loop. You will then need to update your layouts to make sure they call the new name (otherwise they will call "script" in std_script.xsl bypassing your custom code).

Style:

The std_style.css/std_style_base.css mechanism used prior to V11 SP4 is no longer used. This mechanism allowed for localization by placing all the required styles in std_style_base.css and locale specific styles in std_style.css. Std_style.css also contained an @import instruction to load std_style_base.css. Locale specific versions of std_style.css (such as std_style_jpn.css) could be created, each one importing std_style_base.css and then adding it’s locale specific styles.

The new mechanism consists of a single std_style.css file which the style Weblet always loads first and a locale specific overlay (std_style_jpn.css) which the style Weblet then loads is required. In other words, instead of linking CSS files together with @import instructions, the style Weblet takes care of loading the CSS files required in the right order.

The new std_style_v2.xsl Weblet extends this mechanism further providing a number of properties for specifying extra CSS files to load. The std_style Weblet is deprecated but has been modified internally to map the old properties into the new mechanism, ensuring backwards compatibility.

If you have created your own CSS file and supplied it to the std_style Weblet via the relative_css_link_filename property, then your application should continue to work without problem after installing this EPC. If you have created a custom style Weblet that does not call std_style.xsl, then you may experience problems after installing this EPC.

As with the script Weblet, it is likely that you have implemented the original std_style functionality yourself. We recommend that you remove this code and replace it with a call to the style template in std_style_v2.xsl:

<xsl:template name="my_style">
  <xsl:call-template name="style">
     <xsl:param name="theme_css_filename"/>
     <xsl:param name="css_files"/>
  </xsl:call-template>

  <!-- Custom style functionality here -->
</xsl:template>

Be careful with the template name. If you named the template of your custom Weblet "style" then you will need to rename it to avoid an infinite loop. You will then need to update your layouts to make sure they call the new name (otherwise they will call "style" in std_style_v2.xsl bypassing your custom code).