Class CompositeComponentELUtils
java.lang.Object
org.apache.myfaces.view.facelets.el.CompositeComponentELUtils
Utility class for composite components when used in EL Expressions --> #{cc}
- Version:
- $Revision$ $Date$
- Author:
- Jakob Korherr (latest modification by $Author$)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pattern
A regular expression used to determine if cc.attrs is used as a method expression in an expression String.static final Pattern
A regular expression used to determine if cc is used in an expression String.static final String
static final String
The key under which the current composite component is stored in the attribute map of the FacesContext.static final String
Indicates the nesting level where the composite component was created, working as reference point to all EL expressions created in that point from Facelets engine.static final String
The key under which the Location of the composite componente is stored in the attributes map of the component by InterfaceHandler. -
Method Summary
Modifier and TypeMethodDescriptionstatic UIComponent
getCompositeComponentBasedOnLocation
(FacesContext facesContext, UIComponent baseComponent, Location location) static UIComponent
getCompositeComponentBasedOnLocation
(FacesContext facesContext, Location location) Try to find a composite component on the composite component stack and using UIComponent.getCurrentCompositeComponent() based on the location of the facelet page that generated the composite component.static UIComponent
getCompositeComponentBasedOnLocation
(FacesContext facesContext, Location location, int ccLevel) Same as getCompositeComponentBasedOnLocation(final FacesContext facesContext, final Location location), but takes into account the ccLevel to resolve the composite component.static boolean
isCompositeComponentAttrsMethodExpression
(String expression) Tests if cc.attrs is used as a method expression in an expression String.static boolean
isCompositeComponentExpression
(String expression) Tests if the expression refers to the current composite component: #{cc}static void
removeCompositeComponentForResolver
(FacesContext facesContext) Removes the composite component from the attribute map of the FacesContext.static void
saveCompositeComponentForResolver
(FacesContext facesContext, Location location, int ccLevel) Trys to get the composite component using getCompositeComponentBasedOnLocation() and saves it in an attribute on the FacesContext, which is then used by CompositeComponentImplicitObject.
-
Field Details
-
CURRENT_COMPOSITE_COMPONENT_KEY
The key under which the current composite component is stored in the attribute map of the FacesContext.- See Also:
-
LOCATION_KEY
The key under which the Location of the composite componente is stored in the attributes map of the component by InterfaceHandler.- See Also:
-
LEVEL_KEY
Indicates the nesting level where the composite component was created, working as reference point to all EL expressions created in that point from Facelets engine.- See Also:
-
CC_EXPRESSION_REGEX
A regular expression used to determine if cc is used in an expression String. -
CC_ATTRS_METHOD_EXPRESSION_REGEX
A regular expression used to determine if cc.attrs is used as a method expression in an expression String. This means cc.attrs must occur, must stand before a '(', because otherwise it would be a method parameter (EL 2.2), and there must be no '.' after cc.attrs unless there is a left parenthesis before it (e.g. #{cc.attrs.method(bean.parameter)}). Explanation of the parts: - [^\\(]* - There can be any character except a '(' before cc.attrs - [^\\w\\.\\(] - There must be no word character, dot, or left parenthesis directly before cc.attrs - cc\\.attrs\\. - "cc.attrs." must occur - [^\\.]* - There must be no dot after cc.attrs to indicate a method invocation on cc.attrs - (\\(.*)? - If there is a left paranthesis after cc.attrs, a dot is allowed again -
CC_FIND_COMPONENT_EXPRESSION
- See Also:
-
-
Method Details
-
getCompositeComponentBasedOnLocation
public static UIComponent getCompositeComponentBasedOnLocation(FacesContext facesContext, Location location) Try to find a composite component on the composite component stack and using UIComponent.getCurrentCompositeComponent() based on the location of the facelet page that generated the composite component.- Parameters:
facesContext
-location
-- Returns:
-
getCompositeComponentBasedOnLocation
public static UIComponent getCompositeComponentBasedOnLocation(FacesContext facesContext, UIComponent baseComponent, Location location) -
getCompositeComponentBasedOnLocation
public static UIComponent getCompositeComponentBasedOnLocation(FacesContext facesContext, Location location, int ccLevel) Same as getCompositeComponentBasedOnLocation(final FacesContext facesContext, final Location location), but takes into account the ccLevel to resolve the composite component.- Parameters:
facesContext
-location
-ccLevel
-- Returns:
-
saveCompositeComponentForResolver
public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location, int ccLevel) Trys to get the composite component using getCompositeComponentBasedOnLocation() and saves it in an attribute on the FacesContext, which is then used by CompositeComponentImplicitObject.- Parameters:
facesContext
-location
-
-
removeCompositeComponentForResolver
Removes the composite component from the attribute map of the FacesContext.- Parameters:
facesContext
-
-
isCompositeComponentExpression
Tests if the expression refers to the current composite component: #{cc}- Returns:
-
isCompositeComponentAttrsMethodExpression
Tests if cc.attrs is used as a method expression in an expression String. This means cc.attrs must occur, must stand before a '(', because otherwise it would be a method parameter (EL 2.2), and there must be no '.' after cc.attrs unless there is a left parenthesis before it (e.g. #{cc.attrs.method(bean.parameter)}).- Parameters:
expression
-- Returns:
-