Class CmsWorkplaceEditorManager


  • public class CmsWorkplaceEditorManager
    extends java.lang.Object
    The editor manager stores information about all available configured editors in OpenCms.

    This class provides methods and constants to select the right editor according to:

    • the user preferences
    • the users current browser
    • the resource type
    • the editor rankings

    Since:
    6.0.0
    • Constructor Detail

      • CmsWorkplaceEditorManager

        public CmsWorkplaceEditorManager​(CmsObject cms)
        Creates a new editor manager.

        Parameters:
        cms - an OpenCms context object that must have been initialized with "Admin" permissions
    • Method Detail

      • checkAcaciaEditorAvailable

        public static boolean checkAcaciaEditorAvailable​(CmsObject cms,
                                                         CmsResource resource)
        Checks whether GWT widgets are available for all fields of a content.

        Parameters:
        cms - the current CMS context
        resource - the resource to check
        Returns:
        false if for some fields the new Acacia widgets are not available
      • getConfigurableEditors

        public java.util.Map<java.lang.String,​java.util.SortedMap<java.lang.Float,​CmsWorkplaceEditorConfiguration>> getConfigurableEditors()
        Returns a map of configurable editors for the workplace preferences dialog.

        This map has the resource type name as key, the value is a sorted map with the ranking as key and a CmsWorkplaceEditorConfiguration object as value.

        Returns:
        configurable editors for the workplace preferences dialog
      • getEditorParameter

        public java.lang.String getEditorParameter​(CmsObject cms,
                                                   java.lang.String editor,
                                                   java.lang.String param)
        Gets the value of a global editor configuration parameter.
        Parameters:
        cms - the CMS context
        editor - the editor name
        param - the name of the parameter
        Returns:
        the editor parameter value
      • getWidgetEditor

        public java.lang.String getWidgetEditor​(CmsRequestContext context,
                                                java.lang.String userAgent)
        Returns the editor URI for the current resource type.

        Parameters:
        context - the request context
        userAgent - the user agent String that identifies the browser
        Returns:
        a valid editor URI for the resource type or null, if no editor matches
      • isEditorAvailableForResource

        public boolean isEditorAvailableForResource​(CmsResource res)
        Checks if there is an editor which can process the given resource.

        Parameters:
        res - the resource
        Returns:
        true if the given resource can be edited with one of the configured editors
      • getDefaultEditorUri

        protected java.lang.String getDefaultEditorUri​(CmsRequestContext context,
                                                       java.lang.String resourceType,
                                                       java.lang.String userAgent)
        Returns the default editor URI for the current resource type.

        Parameters:
        context - the request context
        resourceType - the current resource type
        userAgent - the user agent String that identifies the browser
        Returns:
        a valid default editor URI for the resource type or null, if no editor matches
      • getEditorUri

        protected java.lang.String getEditorUri​(CmsRequestContext context,
                                                java.lang.String resourceType,
                                                java.lang.String userAgent)
        Returns the editor URI for the current resource type.

        Parameters:
        context - the request context
        resourceType - the current resource type
        userAgent - the user agent String that identifies the browser
        Returns:
        a valid editor URI for the resource type or null, if no editor matches