Class Components


  • public final class Components
    extends Object
    Collection of EL functions for working with components.
    Since:
    2.0
    Author:
    Arjan Tijms
    • 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 evaluated
        name - 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. "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc. This may be null.
        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. "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc. This may be null.
        lastModified - The "last modified" timestamp, can be either a Long, Date, or String which is parseable as Long. This may be null.
        Returns:
        @GraphicImageBean URL based on given expression string, image type and last modified.
        Since:
        2.5
        See Also:
        GraphicImageBean, GraphicImage