Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.forms.layout.facelets
Class FaceletHandlerHelper

java.lang.Object
  extended by org.nuxeo.ecm.platform.forms.layout.facelets.FaceletHandlerHelper

public final class FaceletHandlerHelper
extends Object

Helpers for layout/widget handlers.

Helps generating custom tag handlers and custom tag attributes.

Author:
Anahide Tchertchian

Field Summary
static String LAYOUT_ID_PREFIX
           
static String MESSAGE_ID_SUFFIX
           
static String WIDGET_ID_PREFIX
           
 
Constructor Summary
FaceletHandlerHelper(com.sun.facelets.FaceletContext context, com.sun.facelets.tag.TagConfig tagConfig)
           
 
Method Summary
static com.sun.facelets.tag.TagAttributes addTagAttribute(com.sun.facelets.tag.TagAttributes orig, com.sun.facelets.tag.TagAttribute newAttr)
           
 com.sun.facelets.tag.TagAttributes copyTagAttributes(String id, String... names)
          Copies tag attributes with given names from the tag config, using given id as base for the id attribute.
 com.sun.facelets.tag.TagAttribute createAttribute(String name, String value)
          Creates an attribute with given name and value.
 com.sun.facelets.tag.TagAttribute createIdAttribute(String base)
          Creates a unique id and returns corresponding attribute, using given string id as base.
 String generateLayoutId(String layoutName)
           
 String generateMessageId(String widgetName)
           
 String generateUniqueId()
          Returns a id unique within the facelet context.
 String generateUniqueId(String base)
          Returns a id unique within the facelet context using given id as base.
 String generateValidIdString(String base)
           
 String generateWidgetId(String widgetName)
           
 com.sun.facelets.FaceletHandler getAliasTagHandler(Map<String,ValueExpression> variables, com.sun.facelets.FaceletHandler nextHandler)
          Deprecated. since 5.4.2, use getAliasTagHandler(String, Map, FaceletHandler) instead.
 com.sun.facelets.FaceletHandler getAliasTagHandler(String tagConfigId, Map<String,ValueExpression> variables, com.sun.facelets.FaceletHandler nextHandler)
           
 com.sun.facelets.tag.jsf.ConvertHandler getConvertHandler(String tagConfigId, com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String converterId)
          Returns a convert handler for this configuration.
 com.sun.facelets.tag.jsf.ConvertHandler getConvertHandler(com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String converterId)
          Deprecated. since 5.4.2, use getConvertHandler(String, TagAttributes, FaceletHandler, String) instead.
 com.sun.facelets.tag.jsf.ComponentHandler getErrorComponentHandler(String errorMessage)
          Deprecated. since 5.4.2, use getErrorComponentHandler(String, String) instead.
 com.sun.facelets.tag.jsf.ComponentHandler getErrorComponentHandler(String tagConfigId, String errorMessage)
          Component handler that displays an error on interface
 com.sun.facelets.tag.jsf.ComponentHandler getHtmlComponentHandler(String tagConfigId, com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String componentType, String rendererType)
          Returns an html component handler for this configuration.
 com.sun.facelets.tag.jsf.ComponentHandler getHtmlComponentHandler(com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String componentType, String rendererType)
          Deprecated. since 5.4.2, use getHtmlComponentHandler(String, TagAttributes, FaceletHandler, String, String) instead.
 com.sun.facelets.tag.jsf.ComponentHandler getMessageComponentHandler(String id, String forId, String styleClass)
          Deprecated. since 5.4.2, use getMessageComponentHandler(String, String, String, String) instead.
 com.sun.facelets.tag.jsf.ComponentHandler getMessageComponentHandler(String tagConfigId, String id, String forId, String styleClass)
          Returns a message component handler with given attributes.
 Map<String,Serializable> getSelectOptionProperties(WidgetSelectOption selectOption)
           
static com.sun.facelets.tag.TagAttributes getTagAttributes(List<com.sun.facelets.tag.TagAttribute> attributes)
           
 List<com.sun.facelets.tag.TagAttribute> getTagAttributes(Map<String,Serializable> properties, boolean useReferenceProperties)
           
 com.sun.facelets.tag.TagAttributes getTagAttributes(String id, Widget widget)
          Creates tag attributes using given widget properties and field definitions.
static com.sun.facelets.tag.TagAttributes getTagAttributes(com.sun.facelets.tag.TagAttribute... attributes)
           
 com.sun.facelets.tag.TagAttributes getTagAttributes(Widget widget)
           
 com.sun.facelets.tag.TagAttributes getTagAttributes(WidgetSelectOption selectOption)
           
 com.sun.facelets.tag.jsf.ValidateHandler getValidateHandler(String tagConfigId, com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String validatorId)
          Returns a validate handler for this configuration.
 com.sun.facelets.tag.jsf.ValidateHandler getValidateHandler(com.sun.facelets.tag.TagAttributes attributes, com.sun.facelets.FaceletHandler nextHandler, String validatorId)
          Deprecated. since 5.4.2, use getValidateHandler(String, TagAttributes, FaceletHandler, String) instead.
 boolean shouldCreateReferenceAttribute(String key, Serializable value)
          Returns true if a reference tag attribute should be created for given property value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAYOUT_ID_PREFIX

public static final String LAYOUT_ID_PREFIX
See Also:
Constant Field Values

WIDGET_ID_PREFIX

public static final String WIDGET_ID_PREFIX
See Also:
Constant Field Values

MESSAGE_ID_SUFFIX

public static final String MESSAGE_ID_SUFFIX
See Also:
Constant Field Values
Constructor Detail

FaceletHandlerHelper

public FaceletHandlerHelper(com.sun.facelets.FaceletContext context,
                            com.sun.facelets.tag.TagConfig tagConfig)
Method Detail

generateUniqueId

public String generateUniqueId()
Returns a id unique within the facelet context.


generateUniqueId

public String generateUniqueId(String base)
Returns a id unique within the facelet context using given id as base.


generateValidIdString

public String generateValidIdString(String base)

generateWidgetId

public String generateWidgetId(String widgetName)

generateLayoutId

public String generateLayoutId(String layoutName)

generateMessageId

public String generateMessageId(String widgetName)

createIdAttribute

public com.sun.facelets.tag.TagAttribute createIdAttribute(String base)
Creates a unique id and returns corresponding attribute, using given string id as base.


createAttribute

public com.sun.facelets.tag.TagAttribute createAttribute(String name,
                                                         String value)
Creates an attribute with given name and value.

The attribute namespace is assumed to be empty.


shouldCreateReferenceAttribute

public boolean shouldCreateReferenceAttribute(String key,
                                              Serializable value)
Returns true if a reference tag attribute should be created for given property value.

Reference tag attributes are using a non-literal EL expression so that this property value is not kept (cached) in the component on ajax refresh.

Of course property values already representing an expression cannot be mapped as is because they would need to be resolved twice.

Converters and validators cannot be referenced either because components expect corresponding value expressions to resolve to a Converter or Validator instance (instead of the converter of validator id).


getTagAttributes

public static com.sun.facelets.tag.TagAttributes getTagAttributes(com.sun.facelets.tag.TagAttribute... attributes)

getTagAttributes

public static com.sun.facelets.tag.TagAttributes getTagAttributes(List<com.sun.facelets.tag.TagAttribute> attributes)

addTagAttribute

public static com.sun.facelets.tag.TagAttributes addTagAttribute(com.sun.facelets.tag.TagAttributes orig,
                                                                 com.sun.facelets.tag.TagAttribute newAttr)

copyTagAttributes

public com.sun.facelets.tag.TagAttributes copyTagAttributes(String id,
                                                            String... names)
Copies tag attributes with given names from the tag config, using given id as base for the id attribute.


getTagAttributes

public com.sun.facelets.tag.TagAttributes getTagAttributes(String id,
                                                           Widget widget)
Creates tag attributes using given widget properties and field definitions.

Assumes the "value" attribute has to be computed from the first field definition, using the "value" expression (see widget type tag handler exposed values).


getTagAttributes

public com.sun.facelets.tag.TagAttributes getTagAttributes(Widget widget)

getTagAttributes

public List<com.sun.facelets.tag.TagAttribute> getTagAttributes(Map<String,Serializable> properties,
                                                                boolean useReferenceProperties)

getTagAttributes

public com.sun.facelets.tag.TagAttributes getTagAttributes(WidgetSelectOption selectOption)

getSelectOptionProperties

public Map<String,Serializable> getSelectOptionProperties(WidgetSelectOption selectOption)

getHtmlComponentHandler

@Deprecated
public com.sun.facelets.tag.jsf.ComponentHandler getHtmlComponentHandler(com.sun.facelets.tag.TagAttributes attributes,
                                                                                    com.sun.facelets.FaceletHandler nextHandler,
                                                                                    String componentType,
                                                                                    String rendererType)
Deprecated. since 5.4.2, use getHtmlComponentHandler(String, TagAttributes, FaceletHandler, String, String) instead.


getHtmlComponentHandler

public com.sun.facelets.tag.jsf.ComponentHandler getHtmlComponentHandler(String tagConfigId,
                                                                         com.sun.facelets.tag.TagAttributes attributes,
                                                                         com.sun.facelets.FaceletHandler nextHandler,
                                                                         String componentType,
                                                                         String rendererType)
Returns an html component handler for this configuration.

Next handler cannot be null, use LeafFaceletHandler if no next handler is needed.


getErrorComponentHandler

@Deprecated
public com.sun.facelets.tag.jsf.ComponentHandler getErrorComponentHandler(String errorMessage)
Deprecated. since 5.4.2, use getErrorComponentHandler(String, String) instead.


getErrorComponentHandler

public com.sun.facelets.tag.jsf.ComponentHandler getErrorComponentHandler(String tagConfigId,
                                                                          String errorMessage)
Component handler that displays an error on interface


getConvertHandler

@Deprecated
public com.sun.facelets.tag.jsf.ConvertHandler getConvertHandler(com.sun.facelets.tag.TagAttributes attributes,
                                                                            com.sun.facelets.FaceletHandler nextHandler,
                                                                            String converterId)
Deprecated. since 5.4.2, use getConvertHandler(String, TagAttributes, FaceletHandler, String) instead.


getConvertHandler

public com.sun.facelets.tag.jsf.ConvertHandler getConvertHandler(String tagConfigId,
                                                                 com.sun.facelets.tag.TagAttributes attributes,
                                                                 com.sun.facelets.FaceletHandler nextHandler,
                                                                 String converterId)
Returns a convert handler for this configuration.

Next handler cannot be null, use LeafFaceletHandler if no next handler is needed.


getValidateHandler

@Deprecated
public com.sun.facelets.tag.jsf.ValidateHandler getValidateHandler(com.sun.facelets.tag.TagAttributes attributes,
                                                                              com.sun.facelets.FaceletHandler nextHandler,
                                                                              String validatorId)
Deprecated. since 5.4.2, use getValidateHandler(String, TagAttributes, FaceletHandler, String) instead.


getValidateHandler

public com.sun.facelets.tag.jsf.ValidateHandler getValidateHandler(String tagConfigId,
                                                                   com.sun.facelets.tag.TagAttributes attributes,
                                                                   com.sun.facelets.FaceletHandler nextHandler,
                                                                   String validatorId)
Returns a validate handler for this configuration.

Next handler cannot be null, use LeafFaceletHandler if no next handler is needed.


getMessageComponentHandler

@Deprecated
public com.sun.facelets.tag.jsf.ComponentHandler getMessageComponentHandler(String id,
                                                                                       String forId,
                                                                                       String styleClass)
Deprecated. since 5.4.2, use getMessageComponentHandler(String, String, String, String) instead.


getMessageComponentHandler

public com.sun.facelets.tag.jsf.ComponentHandler getMessageComponentHandler(String tagConfigId,
                                                                            String id,
                                                                            String forId,
                                                                            String styleClass)
Returns a message component handler with given attributes.

Uses component type "javax.faces.HtmlMessage" and renderer type "javax.faces.Message".


getAliasTagHandler

@Deprecated
public com.sun.facelets.FaceletHandler getAliasTagHandler(Map<String,ValueExpression> variables,
                                                                     com.sun.facelets.FaceletHandler nextHandler)
Deprecated. since 5.4.2, use getAliasTagHandler(String, Map, FaceletHandler) instead.


getAliasTagHandler

public com.sun.facelets.FaceletHandler getAliasTagHandler(String tagConfigId,
                                                          Map<String,ValueExpression> variables,
                                                          com.sun.facelets.FaceletHandler nextHandler)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.