Class FormThemeUiHelper

    • Method Detail

      • checkHasNonStandardCssFiles

        public static boolean checkHasNonStandardCssFiles​(List<ClientFormThemeFile> files)
        Checks if any of the given files is a non-standard CSS file. Standard CSS files are the CSS files that the user can edit in the simple edit mode UI of the client form theme UI.
        Parameters:
        files - The list of files to check.
        Returns:
        True if any of the files is a non-standard CSS file, false otherwise.
      • createFormThemeOptions

        public static List<javax.faces.model.SelectItem> createFormThemeOptions​(IEntityContext ec,
                                                                                Mandant client,
                                                                                Locale locale)
        Creates a list of options representing the available form themes that can be selected. Includes all system themes, client form theme and plugin themes.
        Parameters:
        ec - The entity context to use for accessing the database.
        client - Client scope for finding available form themes, can be null. In that case, only form theme plugins installed as system plugins are considered.
        locale - The locale to use for the display names of the themes.
        Returns:
        A list of select items that can be used for the UI.
      • createParentThemeOptions

        public static List<javax.faces.model.SelectItem> createParentThemeOptions​(IEntityContext ec,
                                                                                  Mandant client,
                                                                                  Locale locale,
                                                                                  ClientFormTheme targetTheme)
        Creates a list of options representing the parent themes that can be selected for the current theme. Includes all system themes, client form theme and plugin themes, but excludes the current theme and themes that would result in a cyclic reference when selected as the parent.
        Parameters:
        ec - The entity context to use for accessing the database.
        client - Client scope for finding available form themes, can be null. In that case, only form theme plugins installed as system plugins are considered.
        locale - The locale to use for the display names of the themes.
        targetTheme - The theme for which to find parent themes, not null.
        Returns:
        A list of select items that can be used for the UI.
      • createParentThemeOptionsJson

        public static List<com.alibaba.fastjson.JSONObject> createParentThemeOptionsJson​(IEntityContext ec,
                                                                                         Mandant client,
                                                                                         Locale locale,
                                                                                         ClientFormTheme targetTheme)
        Creates a list of options representing the parent themes that can be selected for the current theme. Includes all system themes, client form theme and plugin themes, but excludes the current theme and themes that would result in a cyclic reference when selected as the parent.
        Parameters:
        ec - The entity context to use for accessing the database.
        client - Client scope for finding available form themes, can be null. In that case, only form theme plugins installed as system plugins are considered.
        locale - The locale to use for the display names of the themes.
        targetTheme - The theme for which to find parent themes, not null.
        Returns:
        A list of JSON object that can be used e.g. for remote command return values.
      • getClientFormThemeFileAsPlainText

        public static String getClientFormThemeFileAsPlainText​(IEntityContext ec,
                                                               List<ClientFormThemeFile> files,
                                                               EFormThemeResourceContext resourceContext,
                                                               String fileName)
        Gets the text content of the given client form theme file. Returns empty string if the file does not exist or could not be read. Uses the UTF-8 encoding to decode the file content as plain text.
        Parameters:
        ec - The entity context to use for accessing the database.
        files - The list of files to search for the file.
        resourceContext - The resource context of the file.
        fileName - The name of the file.
        Returns:
        The text content of the file, or an empty string if the file does not exist or could not be read.