Extended strings formatting

This document describes a custom JSF component for controlling the flow layout of controls based on localised strings. In other words it extends h:outputFormat to accept wider range of childrens so putting hyperlink or button or whatever as bundle parameter is possible now.

Implementation:

Based on: http://illegalargumentexception.blogspot.com/2009/08/jsf-custom-format-panel-control-for.html

See the following files for component configuration and references to Java classes:

web/faces-config.xml

<component>
    <display-name>formatPanel</display-name>
    <component-type>org.xlcloud.console.component.HtmlFormatPanel</component-type>
    <component-class>org.xlcloud.console.component.HtmlFormatPanel</component-class>
</component>

<render-kit>
    <renderer>
      <display-name>FormatPanelRenderer</display-name>
      <component-family>org.xlcloud.console.component.HtmlFormatPanel</component-family>
      <renderer-type>org.xlcloud.console.component.FormatPanelRenderer</renderer-type>
      <renderer-class>org.xlcloud.console.component.FormatPanelRenderer</renderer-class>
    </renderer>
 </render-kit>

xms-console-components.taglib.xml

<tag>
  <tag-name>formatPanel</tag-name>
  <component>
    <component-type>org.xlcloud.console.component.HtmlFormatPanel</component-type>
    <renderer-type>org.xlcloud.console.component.FormatPanelRenderer</renderer-type>
  </component>
</tag> 

Example of use:

stackDetails.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:xlc="http://xlcloud.org/xlcloud-console">

...

<xlc:formatPanel formatString="#{msg['stack.model.orgin.'.concat(stackBean.templateBasedObject.stackOrigin)]}">
    <h:link outcome="/stackBlueprint/stackBlueprint" value="#{stackBean.originBlueprint.name}"
        rendered="#{not empty stackBean.originBlueprint}" style="margin-left: 5px;">
        <f:param name="templateId" value="#{stackBean.originBlueprint.id}" />
    </h:link>
</xlc:formatPanel>

Messages_en.properties

...
stack.model.orgin.FROM_BLUEPRINT                    =This stack was created from {0} blueprint.
stack.model.orgin.CUSTOMIZED_FROM_BLUEPRINT         =This stack was created from {0} blueprint, but has been changed.
...

formatPanel.png


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 5.4.6 - Documentation - Legal Notice

Site maintained by