- java.lang.Object
-
- org.omnifaces.el.functions.Components
-
public final class Components extends Object
Collection of EL functions for working with components.- Since:
- 2.0
- Author:
- Arjan Tijms
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
evalAttribute(UIComponent component, String name)
Evaluates an attribute of a component by first checking if there's a value expression associated with it, and only if there isn't one look at a component property with that name.static String
graphicImageURL(String expression)
Returns@GraphicImageBean
URL based on given expression string.static String
graphicImageURLWithType(String expression, String type)
Returns@GraphicImageBean
URL based on given expression string and image type.static String
graphicImageURLWithTypeAndLastModified(String expression, String type, Object lastModified)
Returns@GraphicImageBean
URL based on given expression string, image type and last modified.
-
-
-
Method Detail
-
evalAttribute
public static Object evalAttribute(UIComponent component, String name)
Evaluates an attribute of a component by first checking if there's a value expression associated with it, and only if there isn't one look at a component property with that name.The regular attribute collection (
UIComponent.getAttributes()
) does exactly the reverse; it looks at a component property first, then at the attribute collection and only looks at a value binding as the last option.- Parameters:
component
- The component for which the attribute is to be evaluatedname
- Name of attribute that is to be evaluated- Returns:
- The value of the attribute, or null if either the component is null or if there's isn't an attribute by that name
-
graphicImageURL
public static String graphicImageURL(String expression)
Returns
@GraphicImageBean
URL based on given expression string.Usage example:
<a href="#{of:graphicImageURL('images.full(product.imageId)')}"> <o:graphicImage value="#{images.thumb(product.imageId)}" /> </a>
- Parameters:
expression
- Expression string representing the same value as you would use in<o:graphicImage>
. It must be a quoted string. Any nested quotes can be escaped with backslash.- Returns:
@GraphicImageBean
URL based on given expression string.- Since:
- 2.5
- See Also:
GraphicImageBean
,GraphicImage
-
graphicImageURLWithType
public static String graphicImageURLWithType(String expression, String type)
Returns
@GraphicImageBean
URL based on given expression string and image type.Usage example:
<a href="#{of:graphicImageURLWithType('images.full(product.imageId)', 'png')}"> <o:graphicImage value="#{images.thumb(product.imageId)}" type="png" /> </a>
- Parameters:
expression
- Expression string representing the same value as you would use in<o:graphicImage>
. It must be a quoted string. Any nested quotes can be escaped with backslash.type
- The image type, represented as file extension. E.g. "webp", "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc. This may benull
.- Returns:
@GraphicImageBean
URL based on given expression string and image type.- Since:
- 2.5
- See Also:
GraphicImageBean
,GraphicImage
-
graphicImageURLWithTypeAndLastModified
public static String graphicImageURLWithTypeAndLastModified(String expression, String type, Object lastModified)
Returns
@GraphicImageBean
URL based on given expression string, image type and last modified.Usage example:
<a href="#{of:graphicImageURLWithTypeAndLastModified('images.full(product.imageId)', 'png', product.lastModified)}"> <o:graphicImage value="#{images.thumb(product.imageId)}" type="png" lastModified="#{product.lastModified}" /> </a>
- Parameters:
expression
- Expression string representing the same value as you would use in<o:graphicImage>
. It must be a quoted string. Any nested quotes can be escaped with backslash.type
- The image type, represented as file extension. E.g. "webp", "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc. This may benull
.lastModified
- The "last modified" timestamp, can be either aLong
,Date
, orString
which is parseable asLong
. This may benull
.- Returns:
@GraphicImageBean
URL based on given expression string, image type and last modified.- Since:
- 2.5
- See Also:
GraphicImageBean
,GraphicImage
-
-