Class CmsVaadinUtils


  • public final class CmsVaadinUtils
    extends java.lang.Object
    Vaadin utility functions.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String BOOTSTRAP_SCRIPT
      The Vaadin bootstrap script, with some macros to be dynamically replaced later.
      static com.vaadin.v7.data.Container.Filter FILTER_NO_FOLDERS
      Container filter for the resource type container to show not folder types only.
      static com.vaadin.v7.data.Container.Filter FILTER_XML_CONTENTS
      Container filter for the resource type container to show XML content types only.
      static java.lang.String PROPERTY_LABEL
      The combo box label item property id.
      static java.lang.String PROPERTY_VALUE
      The combo box value item property id.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.vaadin.v7.data.util.IndexedContainer buildContainerFromMap​(java.lang.String captionProperty, java.util.Map<java.lang.String,​java.lang.String> map)
      Builds a container for use in combo boxes from a map of key/value pairs, where the keys are options and the values are captions.
      static void centerWindow​(com.vaadin.ui.Component component)
      Centers the parent window of given component.
      static void closeWindow​(com.vaadin.ui.Component component)
      Closes the window containing the given component.
      static com.vaadin.ui.Button.ClickListener createClickListener​(java.lang.Runnable action)
      Creates a click listener which calls a Runnable when activated.
      static <T> void defaultHandleContextMenuForMultiselect​(com.vaadin.v7.ui.Table table, CmsContextMenu menu, com.vaadin.v7.event.ItemClickEvent event, java.util.List<I_CmsSimpleContextMenuEntry<java.util.Collection<T>>> entries)
      Simple context menu handler for multi-select tables.
      static java.io.InputStream filterUtf8ResourceStream​(java.io.InputStream stream, com.google.common.base.Function<java.lang.String,​java.lang.String> transformation)
      Reads the content of an input stream into a string (using UTF-8 encoding), performs a function on the string, and returns the result again as an input stream.
      static com.vaadin.v7.data.util.IndexedContainer getAvailableGroupsContainerWithout​(CmsObject cms, java.lang.String ouFqn, java.lang.String propCaption, java.lang.String propIcon, java.lang.String propOu, java.util.List<CmsGroup> blackList, java.util.function.Function<CmsGroup,​CmsCssIcon> iconProvider)
      Get all groups with blacklist.
      static java.util.List<CmsProject> getAvailableProjects​(CmsObject cms)
      Returns the available projects.
      static com.vaadin.v7.data.util.IndexedContainer getAvailableSitesContainer​(CmsObject cms, java.lang.String captionPropertyName)
      Builds an IndexedContainer containing the sites selectable by the current user.
      static java.util.LinkedHashMap<java.lang.String,​java.lang.String> getAvailableSitesMap​(CmsObject cms)
      Gets available sites as a LinkedHashMap, with site roots as keys and site labels as values.
      static java.lang.String getBootstrapScript​(CmsObject cms, java.lang.String elementId, java.lang.String servicePath)
      Returns the Javascript code to use for initializing a Vaadin UI.
      static java.lang.String getDefaultDesignPath​(com.vaadin.ui.Component component)
      Returns the path to the design template file of the given component.
      static com.vaadin.v7.data.util.IndexedContainer getGroupsOfUser​(CmsObject cms, CmsUser user, java.lang.String caption, java.lang.String iconProp, java.lang.String ou, java.lang.String propStatus, com.google.common.base.Function<CmsGroup,​CmsCssIcon> iconProvider)
      Gets container with alls groups of a certain user.
      static com.vaadin.v7.ui.VerticalLayout getInfoLayout​(java.lang.String messageString)
      Creates a layout with info panel.
      static com.vaadin.v7.data.util.IndexedContainer getLanguageContainer​(java.lang.String captionPropertyName)
      Get container with languages.
      static java.lang.String getMessageText​(java.lang.String key, java.lang.Object... args)
      Gets the workplace message for the current locale and the given key and arguments.
      static java.lang.String getMessageText​(I_CmsMessageBundle messages, java.lang.String key, java.lang.Object... args)
      Gets the message for the current locale and the given key and arguments.
      static com.vaadin.v7.ui.ComboBox getOUComboBox​(CmsObject cms, java.lang.String baseOu, org.apache.commons.logging.Log log)
      Creates the ComboBox for OU selection.
      static com.vaadin.v7.ui.ComboBox getOUComboBox​(CmsObject cms, java.lang.String baseOu, org.apache.commons.logging.Log log, boolean includeWebOU)
      Creates the ComboBox for OU selection.
      static java.lang.String getPathItemId​(com.vaadin.v7.data.Container cnt, java.lang.String path)
      Gives item id from path.
      static com.vaadin.v7.data.util.IndexedContainer getPrincipalContainer​(CmsObject cms, java.util.List<? extends I_CmsPrincipal> list, java.lang.String captionID, java.lang.String descID, java.lang.String iconID, java.lang.String ouID, java.lang.String icon, java.util.List<com.vaadin.server.FontIcon> iconList)
      Get container for principal.
      static com.vaadin.v7.data.util.IndexedContainer getProjectsContainer​(CmsObject cms, java.lang.String captionPropertyName)
      Returns the selectable projects container.
      static java.util.LinkedHashMap<CmsUUID,​java.lang.String> getProjectsMap​(CmsObject cms)
      Gets the available projects for the current user as a map, wth project ids as keys and project names as values.
      static javax.servlet.http.HttpServletRequest getRequest()
      Gets the current Vaadin request, cast to a HttpServletRequest.
      static java.util.List<I_CmsResourceType> getResourceTypes()
      Gets list of resource types.
      static com.vaadin.v7.data.util.IndexedContainer getResourceTypesContainer()
      Returns the available resource types container.
      static com.vaadin.v7.data.util.IndexedContainer getRoleContainerForUser​(CmsObject cms, CmsUser user, java.lang.String captionPropertyName)
      Returns the roles available for a given user.
      static com.vaadin.ui.Window getWindow​(com.vaadin.ui.Component component)
      Gets the window which contains a given component.
      static java.lang.String getWorkplaceLink()
      Gets the link to the (new) workplace.
      static java.lang.String getWorkplaceLink​(java.lang.String appId)
      Returns the workplace link for the given app.
      static java.lang.String getWorkplaceLink​(java.lang.String appId, java.lang.String appState)
      Returns the workplace link to the given app with the given state.
      static java.lang.String getWorkplaceLink​(java.lang.String appId, java.lang.String appState, java.util.Map<java.lang.String,​java.lang.String[]> requestParameters)
      Returns the workplace link to the given app with the given state including the given request parameters.
      static com.vaadin.server.ExternalResource getWorkplaceResource​(java.lang.String subPath)
      Gets external resource from workplace resource folder.
      static CmsMessages getWpMessagesForCurrentLocale()
      Gets the workplace messages for the current locale.
      static boolean hasPathAsItemId​(com.vaadin.v7.data.Container cnt, java.lang.String path)
      Checks if path is itemid in container.
      static boolean isButtonPressed​(com.vaadin.ui.Button button)
      Checks if a button is pressed.
      static java.lang.String localizeString​(java.lang.String baseString)
      Uses the currently set locale to resolve localization macros in the input string using workplace message bundles.
      static java.lang.String messageCancel()
      Message accessior function.
      static java.lang.String messageClose()
      Message accessior function.
      static java.lang.String messageOk()
      Message accessor function.
      static void prepareComboBox​(com.vaadin.v7.ui.ComboBox box, java.util.Map<?,​java.lang.String> options)
      Generates the options items for the combo box using the map entry keys as values and the values as labels.
      protected static void readAndLocalizeDesign​(com.vaadin.ui.Component component, java.io.InputStream designStream, CmsMessages messages, java.util.Map<java.lang.String,​java.lang.String> macros)
      Reads the given design and resolves the given macros and localizations.
      static void readAndLocalizeDesign​(com.vaadin.ui.Component component, CmsMessages messages, java.util.Map<java.lang.String,​java.lang.String> macros)
      Reads the declarative design for a component and localizes it using a messages object.
      static java.io.InputStream readCustomLayout​(java.lang.Class<? extends com.vaadin.ui.Component> layoutClass, java.lang.String relativeName)
      Reads a layout from a resource, applies basic i18n macro substitution on the contained text, and returns a stream of the transformed data.
      static void replaceComponent​(com.vaadin.ui.Component component, com.vaadin.ui.Component replacement)
      Replaces component with new component.
      static void setFilterBoxStyle​(com.vaadin.ui.TextField searchBox)
      Configures a text field to look like a filter box for a table.
      static <T> void setReadonlyValue​(com.vaadin.v7.ui.AbstractField<T> field, T value)
      Sets the value of a text field which may be set to read-only mode.
      static void showAlert​(java.lang.String title, java.lang.String message, java.lang.Runnable callback)
      Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.
      static CmsVaadinUtils.OptionGroupBuilder startOptionGroup()
      Creates a new option group builder.
      static void toggleButton​(com.vaadin.ui.Button button)
      Sets style of a toggle button depending on its current state.
      static boolean updateComponentError​(com.vaadin.ui.AbstractComponent component, com.vaadin.server.ErrorMessage error)
      Updates the component error of a component, but only if it differs from the currently set error.
      static void visitDescendants​(com.vaadin.ui.Component component, com.google.common.base.Predicate<com.vaadin.ui.Component> handler)
      Visits all descendants of a given component (including the component itself) and applies a predicate to each.
      static void waggleMeOnce​(com.vaadin.ui.Component component)
      Waggle the component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FILTER_NO_FOLDERS

        public static final com.vaadin.v7.data.Container.Filter FILTER_NO_FOLDERS
        Container filter for the resource type container to show not folder types only.
      • FILTER_XML_CONTENTS

        public static final com.vaadin.v7.data.Container.Filter FILTER_XML_CONTENTS
        Container filter for the resource type container to show XML content types only.
      • BOOTSTRAP_SCRIPT

        protected static final java.lang.String BOOTSTRAP_SCRIPT
        The Vaadin bootstrap script, with some macros to be dynamically replaced later.
        See Also:
        Constant Field Values
    • Method Detail

      • buildContainerFromMap

        public static com.vaadin.v7.data.util.IndexedContainer buildContainerFromMap​(java.lang.String captionProperty,
                                                                                     java.util.Map<java.lang.String,​java.lang.String> map)
        Builds a container for use in combo boxes from a map of key/value pairs, where the keys are options and the values are captions.

        Parameters:
        captionProperty - the property name to use for captions
        map - the map
        Returns:
        the new container
      • centerWindow

        public static void centerWindow​(com.vaadin.ui.Component component)
        Centers the parent window of given component.

        Parameters:
        component - Component as child of window
      • closeWindow

        public static void closeWindow​(com.vaadin.ui.Component component)
        Closes the window containing the given component.
        Parameters:
        component - a component
      • createClickListener

        public static com.vaadin.ui.Button.ClickListener createClickListener​(java.lang.Runnable action)
        Creates a click listener which calls a Runnable when activated.

        Parameters:
        action - the Runnable to execute on a click
        Returns:
        the click listener
      • defaultHandleContextMenuForMultiselect

        public static <T> void defaultHandleContextMenuForMultiselect​(com.vaadin.v7.ui.Table table,
                                                                      CmsContextMenu menu,
                                                                      com.vaadin.v7.event.ItemClickEvent event,
                                                                      java.util.List<I_CmsSimpleContextMenuEntry<java.util.Collection<T>>> entries)
        Simple context menu handler for multi-select tables.
        Parameters:
        table - the table
        menu - the table's context menu
        event - the click event
        entries - the context menu entries
      • filterUtf8ResourceStream

        public static java.io.InputStream filterUtf8ResourceStream​(java.io.InputStream stream,
                                                                   com.google.common.base.Function<java.lang.String,​java.lang.String> transformation)
        Reads the content of an input stream into a string (using UTF-8 encoding), performs a function on the string, and returns the result again as an input stream.

        Parameters:
        stream - the stream producing the input data
        transformation - the function to apply to the input
        Returns:
        the stream producing the transformed input data
      • getAvailableGroupsContainerWithout

        public static com.vaadin.v7.data.util.IndexedContainer getAvailableGroupsContainerWithout​(CmsObject cms,
                                                                                                  java.lang.String ouFqn,
                                                                                                  java.lang.String propCaption,
                                                                                                  java.lang.String propIcon,
                                                                                                  java.lang.String propOu,
                                                                                                  java.util.List<CmsGroup> blackList,
                                                                                                  java.util.function.Function<CmsGroup,​CmsCssIcon> iconProvider)
        Get all groups with blacklist.

        Parameters:
        cms - CmsObject
        ouFqn - ou name
        propCaption - property
        propIcon - property for icon
        propOu - organizational unit
        blackList - blacklist
        iconProvider - the icon provider
        Returns:
        indexed container
      • getAvailableProjects

        public static java.util.List<CmsProjectgetAvailableProjects​(CmsObject cms)
        Returns the available projects.

        Parameters:
        cms - the CMS context
        Returns:
        the available projects
      • getAvailableSitesContainer

        public static com.vaadin.v7.data.util.IndexedContainer getAvailableSitesContainer​(CmsObject cms,
                                                                                          java.lang.String captionPropertyName)
        Builds an IndexedContainer containing the sites selectable by the current user.

        Parameters:
        cms - the CMS context
        captionPropertyName - the name of the property used to store captions
        Returns:
        the container with the available sites
      • getAvailableSitesMap

        public static java.util.LinkedHashMap<java.lang.String,​java.lang.String> getAvailableSitesMap​(CmsObject cms)
        Gets available sites as a LinkedHashMap, with site roots as keys and site labels as values.
        Parameters:
        cms - the current CMS context
        Returns:
        the map of available sites
      • getBootstrapScript

        public static java.lang.String getBootstrapScript​(CmsObject cms,
                                                          java.lang.String elementId,
                                                          java.lang.String servicePath)
                                                   throws java.lang.Exception
        Returns the Javascript code to use for initializing a Vaadin UI.

        Parameters:
        cms - the CMS context
        elementId - the id of the DOM element in which to initialize the UI
        servicePath - the UI servlet path
        Returns:
        the Javascript code to initialize Vaadin
        Throws:
        java.lang.Exception - if something goes wrong
      • getDefaultDesignPath

        public static java.lang.String getDefaultDesignPath​(com.vaadin.ui.Component component)
        Returns the path to the design template file of the given component.

        Parameters:
        component - the component
        Returns:
        the path
      • getGroupsOfUser

        public static com.vaadin.v7.data.util.IndexedContainer getGroupsOfUser​(CmsObject cms,
                                                                               CmsUser user,
                                                                               java.lang.String caption,
                                                                               java.lang.String iconProp,
                                                                               java.lang.String ou,
                                                                               java.lang.String propStatus,
                                                                               com.google.common.base.Function<CmsGroup,​CmsCssIcon> iconProvider)
        Gets container with alls groups of a certain user.
        Parameters:
        cms - cmsobject
        user - to find groups for
        caption - caption property
        iconProp - property
        ou - ou
        propStatus - status property
        iconProvider - the icon provider
        Returns:
        Indexed Container
      • getInfoLayout

        public static com.vaadin.v7.ui.VerticalLayout getInfoLayout​(java.lang.String messageString)
        Creates a layout with info panel.

        Parameters:
        messageString - Message to be displayed
        Returns:
        layout
      • getLanguageContainer

        public static com.vaadin.v7.data.util.IndexedContainer getLanguageContainer​(java.lang.String captionPropertyName)
        Get container with languages.

        Parameters:
        captionPropertyName - name
        Returns:
        indexed container
      • getMessageText

        public static java.lang.String getMessageText​(I_CmsMessageBundle messages,
                                                      java.lang.String key,
                                                      java.lang.Object... args)
        Gets the message for the current locale and the given key and arguments.

        Parameters:
        messages - the messages instance
        key - the message key
        args - the message arguments
        Returns:
        the message text for the current locale
      • getMessageText

        public static java.lang.String getMessageText​(java.lang.String key,
                                                      java.lang.Object... args)
        Gets the workplace message for the current locale and the given key and arguments.

        Parameters:
        key - the message key
        args - the message arguments
        Returns:
        the message text for the current locale
      • getOUComboBox

        public static com.vaadin.v7.ui.ComboBox getOUComboBox​(CmsObject cms,
                                                              java.lang.String baseOu,
                                                              org.apache.commons.logging.Log log)
        Creates the ComboBox for OU selection.

        Parameters:
        cms - CmsObject
        baseOu - OU
        log - Logger object
        Returns:
        ComboBox
      • getOUComboBox

        public static com.vaadin.v7.ui.ComboBox getOUComboBox​(CmsObject cms,
                                                              java.lang.String baseOu,
                                                              org.apache.commons.logging.Log log,
                                                              boolean includeWebOU)
        Creates the ComboBox for OU selection.

        Parameters:
        cms - CmsObject
        baseOu - OU
        log - Logger object
        includeWebOU - include webou?
        Returns:
        ComboBox
      • getPathItemId

        public static java.lang.String getPathItemId​(com.vaadin.v7.data.Container cnt,
                                                     java.lang.String path)
        Gives item id from path.

        Parameters:
        cnt - to be used
        path - to obtain item id from
        Returns:
        item id
      • getPrincipalContainer

        public static com.vaadin.v7.data.util.IndexedContainer getPrincipalContainer​(CmsObject cms,
                                                                                     java.util.List<? extends I_CmsPrincipal> list,
                                                                                     java.lang.String captionID,
                                                                                     java.lang.String descID,
                                                                                     java.lang.String iconID,
                                                                                     java.lang.String ouID,
                                                                                     java.lang.String icon,
                                                                                     java.util.List<com.vaadin.server.FontIcon> iconList)
        Get container for principal.
        Parameters:
        cms - cmsobject
        list - of principals
        captionID - caption id
        descID - description id
        iconID - icon id
        ouID - ou id
        icon - icon
        iconList - iconlist
        Returns:
        indexedcontainer
      • getProjectsContainer

        public static com.vaadin.v7.data.util.IndexedContainer getProjectsContainer​(CmsObject cms,
                                                                                    java.lang.String captionPropertyName)
        Returns the selectable projects container.

        Parameters:
        cms - the CMS context
        captionPropertyName - the name of the property used to store captions
        Returns:
        the projects container
      • getProjectsMap

        public static java.util.LinkedHashMap<CmsUUID,​java.lang.String> getProjectsMap​(CmsObject cms)
        Gets the available projects for the current user as a map, wth project ids as keys and project names as values.
        Parameters:
        cms - the current CMS context
        Returns:
        the map of projects
      • getRequest

        public static javax.servlet.http.HttpServletRequest getRequest()
        Gets the current Vaadin request, cast to a HttpServletRequest.

        Returns:
        the current request
      • getResourceTypesContainer

        public static com.vaadin.v7.data.util.IndexedContainer getResourceTypesContainer()
        Returns the available resource types container.

        Returns:
        the resource types container
      • getRoleContainerForUser

        public static com.vaadin.v7.data.util.IndexedContainer getRoleContainerForUser​(CmsObject cms,
                                                                                       CmsUser user,
                                                                                       java.lang.String captionPropertyName)
        Returns the roles available for a given user.

        Parameters:
        cms - CmsObject
        user - to get available roles for
        captionPropertyName - name of caption property
        Returns:
        indexed container
      • getWindow

        public static com.vaadin.ui.Window getWindow​(com.vaadin.ui.Component component)
        Gets the window which contains a given component.

        Parameters:
        component - the component
        Returns:
        the window containing the component, or null if no component is found
      • getWorkplaceLink

        public static java.lang.String getWorkplaceLink()
        Gets the link to the (new) workplace.

        Returns:
        the link to the workplace
      • getWorkplaceLink

        public static java.lang.String getWorkplaceLink​(java.lang.String appId)
        Returns the workplace link for the given app.

        Parameters:
        appId - the app id
        Returns:
        the workplace link
      • getWorkplaceLink

        public static java.lang.String getWorkplaceLink​(java.lang.String appId,
                                                        java.lang.String appState)
        Returns the workplace link to the given app with the given state.

        Parameters:
        appId - the app id
        appState - the app state
        Returns:
        the workplace link
      • getWorkplaceLink

        public static java.lang.String getWorkplaceLink​(java.lang.String appId,
                                                        java.lang.String appState,
                                                        java.util.Map<java.lang.String,​java.lang.String[]> requestParameters)
        Returns the workplace link to the given app with the given state including the given request parameters.

        Parameters:
        appId - the app id
        appState - the app state
        requestParameters - the request parameters
        Returns:
        the workplace link
      • getWorkplaceResource

        public static com.vaadin.server.ExternalResource getWorkplaceResource​(java.lang.String subPath)
        Gets external resource from workplace resource folder.

        Parameters:
        subPath - path relative to workplace resource folder
        Returns:
        the external resource
      • hasPathAsItemId

        public static boolean hasPathAsItemId​(com.vaadin.v7.data.Container cnt,
                                              java.lang.String path)
        Checks if path is itemid in container.

        Parameters:
        cnt - to be checked
        path - as itemid
        Returns:
        true id path is itemid in container
      • isButtonPressed

        public static boolean isButtonPressed​(com.vaadin.ui.Button button)
        Checks if a button is pressed.

        Parameters:
        button - the button
        Returns:
        true if the button is pressed
      • localizeString

        public static java.lang.String localizeString​(java.lang.String baseString)
        Uses the currently set locale to resolve localization macros in the input string using workplace message bundles.

        Parameters:
        baseString - the string to localize
        Returns:
        the localized string
      • messageCancel

        public static java.lang.String messageCancel()
        Message accessior function.

        Returns:
        the message for Cancel buttons
      • messageClose

        public static java.lang.String messageClose()
        Message accessior function.

        Returns:
        the message for Cancel buttons
      • messageOk

        public static java.lang.String messageOk()
        Message accessor function.

        Returns:
        the message for OK buttons
      • prepareComboBox

        public static void prepareComboBox​(com.vaadin.v7.ui.ComboBox box,
                                           java.util.Map<?,​java.lang.String> options)
        Generates the options items for the combo box using the map entry keys as values and the values as labels.

        Parameters:
        box - the combo box to prepare
        options - the box options
      • readAndLocalizeDesign

        public static void readAndLocalizeDesign​(com.vaadin.ui.Component component,
                                                 CmsMessages messages,
                                                 java.util.Map<java.lang.String,​java.lang.String> macros)
        Reads the declarative design for a component and localizes it using a messages object.

        The design will need to be located in the same directory as the component's class and have '.html' as a file extension.

        Parameters:
        component - the component for which to read the design
        messages - the message bundle to use for localization
        macros - the macros to use on the HTML template
      • readCustomLayout

        public static java.io.InputStream readCustomLayout​(java.lang.Class<? extends com.vaadin.ui.Component> layoutClass,
                                                           java.lang.String relativeName)
        Reads a layout from a resource, applies basic i18n macro substitution on the contained text, and returns a stream of the transformed data.

        Parameters:
        layoutClass - the class relative to which the layout resource will be looked up
        relativeName - the file name of the layout file
        Returns:
        an input stream which produces the transformed layout resource html
      • replaceComponent

        public static void replaceComponent​(com.vaadin.ui.Component component,
                                            com.vaadin.ui.Component replacement)
        Replaces component with new component.

        Parameters:
        component - to be replaced
        replacement - new component
      • setFilterBoxStyle

        public static void setFilterBoxStyle​(com.vaadin.ui.TextField searchBox)
        Configures a text field to look like a filter box for a table.
        Parameters:
        searchBox - the text field to configure
      • setReadonlyValue

        public static <T> void setReadonlyValue​(com.vaadin.v7.ui.AbstractField<T> field,
                                                T value)
        Sets the value of a text field which may be set to read-only mode.

        When setting a Vaadin field to read-only, you also can't set its value programmatically anymore. So we need to temporarily disable read-only mode, set the value, and then switch back to read-only mode.

        Parameters:
        field - the field
        value - the value to set
      • showAlert

        public static void showAlert​(java.lang.String title,
                                     java.lang.String message,
                                     java.lang.Runnable callback)
        Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.

        Parameters:
        title - the title
        message - the message
        callback - the callback to execute after clicking OK
      • toggleButton

        public static void toggleButton​(com.vaadin.ui.Button button)
        Sets style of a toggle button depending on its current state.

        Parameters:
        button - the button to update
      • updateComponentError

        public static boolean updateComponentError​(com.vaadin.ui.AbstractComponent component,
                                                   com.vaadin.server.ErrorMessage error)
        Updates the component error of a component, but only if it differs from the currently set error.

        Parameters:
        component - the component
        error - the error
        Returns:
        true if the error was changed
      • visitDescendants

        public static void visitDescendants​(com.vaadin.ui.Component component,
                                            com.google.common.base.Predicate<com.vaadin.ui.Component> handler)
        Visits all descendants of a given component (including the component itself) and applies a predicate to each.

        If the predicate returns false for a component, no further descendants will be processed.

        Parameters:
        component - the component
        handler - the predicate
      • waggleMeOnce

        public static void waggleMeOnce​(com.vaadin.ui.Component component)
        Waggle the component.

        Parameters:
        component - to be waggled
      • readAndLocalizeDesign

        protected static void readAndLocalizeDesign​(com.vaadin.ui.Component component,
                                                    java.io.InputStream designStream,
                                                    CmsMessages messages,
                                                    java.util.Map<java.lang.String,​java.lang.String> macros)
        Reads the given design and resolves the given macros and localizations.

        Parameters:
        component - the component whose design to read
        designStream - stream to read the design from
        messages - the message bundle to use for localization in the design (may be null)
        macros - other macros to substitute in the macro design (may be null)