public final class FaceletHandlerHelper extends Object
Helps generating custom tag handlers and custom tag attributes.
Modifier and Type | Field and Description |
---|---|
static String |
DEV_CONTAINER_ID_SUFFIX |
static String |
DEV_MODE_DISABLED_VARIABLE |
static String |
DEV_REGION_ID_SUFFIX |
static String |
DIR_AUTO |
static String |
DIR_PROPERTY |
static String |
LAYOUT_ID_PREFIX |
static String |
MESSAGE_ID_SUFFIX |
static String |
WIDGET_ID_PREFIX |
Constructor and Description |
---|
FaceletHandlerHelper(javax.faces.view.facelets.TagConfig tagConfig) |
Modifier and Type | Method and Description |
---|---|
static javax.faces.view.facelets.TagAttributes |
addTagAttribute(javax.faces.view.facelets.TagAttributes orig,
javax.faces.view.facelets.TagAttribute newAttr) |
javax.faces.view.facelets.TagAttributes |
copyTagAttributes(javax.faces.view.facelets.FaceletContext context,
String id,
String... names)
Copies tag attributes with given names from the tag config, using given id as base for the id attribute.
|
javax.faces.view.facelets.TagAttribute |
createAttribute(String name,
String value)
Creates an attribute with given name and value.
|
javax.faces.view.facelets.TagAttribute |
createIdAttribute(javax.faces.view.facelets.FaceletContext context,
String base)
Creates a unique id and returns corresponding attribute, using given string id as base.
|
static String |
generateDevContainerId(javax.faces.view.facelets.FaceletContext context,
String widgetName) |
static String |
generateDevRegionId(javax.faces.view.facelets.FaceletContext context,
String widgetName) |
static String |
generateLayoutId(javax.faces.view.facelets.FaceletContext context,
String layoutName) |
static String |
generateMessageId(javax.faces.view.facelets.FaceletContext context,
String widgetName) |
String |
generateUniqueId(javax.faces.view.facelets.FaceletContext context)
Returns a id unique within the facelet context.
|
static String |
generateUniqueId(javax.faces.view.facelets.FaceletContext context,
String base)
Returns a id unique within the facelet context using given id as base.
|
static String |
generateUniqueId(javax.faces.context.FacesContext faces,
String base)
Returns a id unique within the faces context using given id as base.
|
protected static String |
generateValidIdString(String base) |
static String |
generateWidgetId(javax.faces.view.facelets.FaceletContext context,
String widgetName) |
javax.faces.view.facelets.FaceletHandler |
getAliasFaceletHandler(String tagConfigId,
Map<String,javax.el.ValueExpression> variables,
List<String> blockedPatterns,
javax.faces.view.facelets.FaceletHandler nextHandler) |
javax.faces.view.facelets.TagHandler |
getAliasTagHandler(String tagConfigId,
Map<String,javax.el.ValueExpression> variables,
List<String> blockedPatterns,
javax.faces.view.facelets.TagHandler nextHandler) |
protected javax.faces.view.facelets.TagHandler |
getBareAliasTagHandler(String tagConfigId,
Map<String,javax.el.ValueExpression> variables,
List<String> blockedPatterns,
javax.faces.view.facelets.FaceletHandler nextHandler) |
javax.faces.view.facelets.ConverterHandler |
getConvertHandler(String tagConfigId,
javax.faces.view.facelets.TagAttributes attributes,
javax.faces.view.facelets.FaceletHandler nextHandler,
String converterId)
Returns a convert handler for this configuration.
|
javax.faces.view.facelets.FaceletHandler |
getDisableDevModeTagHandler(String tagConfigId,
javax.faces.view.facelets.FaceletHandler nextHandler) |
javax.faces.view.facelets.ComponentHandler |
getErrorComponentHandler(String tagConfigId,
String errorMessage)
Component handler that displays an error on interface
|
javax.faces.view.facelets.ComponentHandler |
getHtmlComponentHandler(String tagConfigId,
javax.faces.view.facelets.TagAttributes attributes,
javax.faces.view.facelets.FaceletHandler nextHandler,
String componentType,
String rendererType)
Returns an html component handler for this configuration.
|
javax.faces.view.facelets.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 javax.faces.view.facelets.TagAttributes |
getTagAttributes(List<javax.faces.view.facelets.TagAttribute> attributes) |
List<javax.faces.view.facelets.TagAttribute> |
getTagAttributes(Map<String,Serializable> properties,
List<String> excludedProperties,
boolean useReferenceProperties,
String widgetType,
String widgetTypeCategory,
String widgetMode) |
javax.faces.view.facelets.TagAttributes |
getTagAttributes(String id,
Widget widget)
Creates tag attributes using given widget properties and field definitions.
|
static javax.faces.view.facelets.TagAttributes |
getTagAttributes(javax.faces.view.facelets.TagAttribute... attributes) |
javax.faces.view.facelets.TagAttributes |
getTagAttributes(Widget widget) |
javax.faces.view.facelets.TagAttributes |
getTagAttributes(Widget widget,
List<String> excludedProperties,
boolean bindFirstFieldDefinition) |
javax.faces.view.facelets.TagAttributes |
getTagAttributes(Widget widget,
List<String> excludedProperties,
boolean bindFirstFieldDefinition,
boolean defaultToValue)
Return tag attributes for this widget, including value mapping from field definitions and properties
|
javax.faces.view.facelets.TagAttributes |
getTagAttributes(WidgetSelectOption selectOption) |
javax.faces.view.facelets.TagAttributes |
getTagAttributes(WidgetSelectOption selectOption,
Map<String,Serializable> additionalProps) |
javax.faces.view.facelets.ValidatorHandler |
getValidateHandler(String tagConfigId,
javax.faces.view.facelets.TagAttributes attributes,
javax.faces.view.facelets.FaceletHandler nextHandler,
String validatorId)
Returns a validate handler for this configuration.
|
static boolean |
isAliasOptimEnabled() |
static boolean |
isDevModeEnabled(javax.faces.view.facelets.FaceletContext ctx) |
protected static NuxeoLayoutManagerBean |
lookupBean(javax.faces.context.FacesContext ctx) |
protected static NuxeoLayoutIdManagerBean |
lookupIdBean(javax.faces.context.FacesContext ctx) |
boolean |
shouldCreateReferenceAttribute(String key,
Serializable value)
Returns true if a reference tag attribute should be created for given property value.
|
protected static String |
stripUniqueIdBase(String base)
Strips given base of any ending counter that would conflict with potential already generated unique ids
|
public static final String LAYOUT_ID_PREFIX
public static final String WIDGET_ID_PREFIX
public static final String MESSAGE_ID_SUFFIX
public static final String DEV_CONTAINER_ID_SUFFIX
public static final String DEV_REGION_ID_SUFFIX
public static String DEV_MODE_DISABLED_VARIABLE
public static final String DIR_PROPERTY
public static final String DIR_AUTO
public FaceletHandlerHelper(javax.faces.view.facelets.TagConfig tagConfig)
public String generateUniqueId(javax.faces.view.facelets.FaceletContext context)
public static String generateUniqueId(javax.faces.view.facelets.FaceletContext context, String base)
public static String generateUniqueId(javax.faces.context.FacesContext faces, String base)
protected static NuxeoLayoutIdManagerBean lookupIdBean(javax.faces.context.FacesContext ctx)
protected static String stripUniqueIdBase(String base)
protected static String generateValidIdString(String base)
IllegalArgumentException
- if the given string is null or empty.public static String generateWidgetId(javax.faces.view.facelets.FaceletContext context, String widgetName)
public static String generateLayoutId(javax.faces.view.facelets.FaceletContext context, String layoutName)
public static String generateMessageId(javax.faces.view.facelets.FaceletContext context, String widgetName)
public static String generateDevRegionId(javax.faces.view.facelets.FaceletContext context, String widgetName)
public static String generateDevContainerId(javax.faces.view.facelets.FaceletContext context, String widgetName)
public javax.faces.view.facelets.TagAttribute createIdAttribute(javax.faces.view.facelets.FaceletContext context, String base)
public javax.faces.view.facelets.TagAttribute createAttribute(String name, String value)
The attribute namespace is assumed to be empty.
public boolean shouldCreateReferenceAttribute(String key, Serializable 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).
public static javax.faces.view.facelets.TagAttributes getTagAttributes(javax.faces.view.facelets.TagAttribute... attributes)
public static javax.faces.view.facelets.TagAttributes getTagAttributes(List<javax.faces.view.facelets.TagAttribute> attributes)
public static javax.faces.view.facelets.TagAttributes addTagAttribute(javax.faces.view.facelets.TagAttributes orig, javax.faces.view.facelets.TagAttribute newAttr)
public javax.faces.view.facelets.TagAttributes copyTagAttributes(javax.faces.view.facelets.FaceletContext context, String id, String... names)
public javax.faces.view.facelets.TagAttributes getTagAttributes(String id, Widget widget)
Assumes the "value" attribute has to be computed from the first field definition, using the "value" expression (see widget type tag handler exposed values).
public javax.faces.view.facelets.TagAttributes getTagAttributes(Widget widget)
public javax.faces.view.facelets.TagAttributes getTagAttributes(Widget widget, List<String> excludedProperties, boolean bindFirstFieldDefinition)
public javax.faces.view.facelets.TagAttributes getTagAttributes(Widget widget, List<String> excludedProperties, boolean bindFirstFieldDefinition, boolean defaultToValue)
widget
- the widget to generate tag attributes forexcludedProperties
- the properties to exclude from tag attributesbindFirstFieldDefinition
- if true, the first field definition will be bound to the tag attribute named
"value"defaultToValue
- if true, and there are no field definitions, tag attribute named "value" will be mapped to
the current widget value name (e.g the layout value in most cases, or the parent widget value if
widget is a sub widget)public List<javax.faces.view.facelets.TagAttribute> getTagAttributes(Map<String,Serializable> properties, List<String> excludedProperties, boolean useReferenceProperties, String widgetType, String widgetTypeCategory, String widgetMode)
public javax.faces.view.facelets.TagAttributes getTagAttributes(WidgetSelectOption selectOption, Map<String,Serializable> additionalProps)
public javax.faces.view.facelets.TagAttributes getTagAttributes(WidgetSelectOption selectOption)
public Map<String,Serializable> getSelectOptionProperties(WidgetSelectOption selectOption)
public javax.faces.view.facelets.ComponentHandler getHtmlComponentHandler(String tagConfigId, javax.faces.view.facelets.TagAttributes attributes, javax.faces.view.facelets.FaceletHandler nextHandler, String componentType, String rendererType)
Next handler cannot be null, use LeafFaceletHandler
if no next
handler is needed.
public javax.faces.view.facelets.ComponentHandler getErrorComponentHandler(String tagConfigId, String errorMessage)
public javax.faces.view.facelets.ConverterHandler getConvertHandler(String tagConfigId, javax.faces.view.facelets.TagAttributes attributes, javax.faces.view.facelets.FaceletHandler nextHandler, String converterId)
Next handler cannot be null, use LeafFaceletHandler
if no next
handler is needed.
public javax.faces.view.facelets.ValidatorHandler getValidateHandler(String tagConfigId, javax.faces.view.facelets.TagAttributes attributes, javax.faces.view.facelets.FaceletHandler nextHandler, String validatorId)
Next handler cannot be null, use LeafFaceletHandler
if no next
handler is needed.
public javax.faces.view.facelets.ComponentHandler getMessageComponentHandler(String tagConfigId, String id, String forId, String styleClass)
Uses component type "javax.faces.HtmlMessage" and renderer type "javax.faces.Message".
public javax.faces.view.facelets.FaceletHandler getAliasFaceletHandler(String tagConfigId, Map<String,javax.el.ValueExpression> variables, List<String> blockedPatterns, javax.faces.view.facelets.FaceletHandler nextHandler)
public javax.faces.view.facelets.TagHandler getAliasTagHandler(String tagConfigId, Map<String,javax.el.ValueExpression> variables, List<String> blockedPatterns, javax.faces.view.facelets.TagHandler nextHandler)
protected javax.faces.view.facelets.TagHandler getBareAliasTagHandler(String tagConfigId, Map<String,javax.el.ValueExpression> variables, List<String> blockedPatterns, javax.faces.view.facelets.FaceletHandler nextHandler)
public static boolean isDevModeEnabled(javax.faces.view.facelets.FaceletContext ctx)
protected static NuxeoLayoutManagerBean lookupBean(javax.faces.context.FacesContext ctx)
public javax.faces.view.facelets.FaceletHandler getDisableDevModeTagHandler(String tagConfigId, javax.faces.view.facelets.FaceletHandler nextHandler)
public static boolean isAliasOptimEnabled()
Copyright © 2018 Nuxeo. All rights reserved.