Package org.opencms.workplace.editors
Class CmsWorkplaceEditorManager
- java.lang.Object
-
- org.opencms.workplace.editors.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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EDITOR_CONFIGURATION_FILENAME
The filename of the editor configuration XML file.static java.lang.String
EDITOR_FILENAME
The filename of the editor JSP.
-
Constructor Summary
Constructors Constructor Description CmsWorkplaceEditorManager(CmsObject cms)
Creates a new editor manager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
checkAcaciaEditorAvailable(CmsObject cms, CmsResource resource)
Checks whether GWT widgets are available for all fields of a content.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.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.CmsWorkplaceEditorConfiguration
getEditorConfiguration(java.lang.String name)
Gets the editor configuration with the given name.protected java.util.List<CmsWorkplaceEditorConfiguration>
getEditorConfigurations()
Returns the editor configuration objects.java.lang.String
getEditorParameter(CmsObject cms, java.lang.String editor, java.lang.String param)
Gets the value of a global editor configuration parameter.protected java.lang.String
getEditorUri(CmsRequestContext context, java.lang.String resourceType, java.lang.String userAgent)
Returns the editor URI for the current resource type.java.lang.String
getWidgetEditor(CmsRequestContext context, java.lang.String userAgent)
Returns the editor URI for the current resource type.boolean
isEditorAvailableForResource(CmsResource res)
Checks if there is an editor which can process the given resource.
-
-
-
Field Detail
-
EDITOR_CONFIGURATION_FILENAME
public static final java.lang.String EDITOR_CONFIGURATION_FILENAME
The filename of the editor configuration XML file.- See Also:
- Constant Field Values
-
EDITOR_FILENAME
public static final java.lang.String EDITOR_FILENAME
The filename of the editor JSP.- See Also:
- Constant Field Values
-
-
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 contextresource
- 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
-
getEditorConfiguration
public CmsWorkplaceEditorConfiguration getEditorConfiguration(java.lang.String name)
Gets the editor configuration with the given name.- Parameters:
name
- the name of the editor configuration- Returns:
- the editor configuration
-
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 contexteditor
- the editor nameparam
- 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 contextuserAgent
- 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 contextresourceType
- the current resource typeuserAgent
- the user agent String that identifies the browser- Returns:
- a valid default editor URI for the resource type or null, if no editor matches
-
getEditorConfigurations
protected java.util.List<CmsWorkplaceEditorConfiguration> getEditorConfigurations()
Returns the editor configuration objects.- Returns:
- the editor configuration objects
-
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 contextresourceType
- the current resource typeuserAgent
- the user agent String that identifies the browser- Returns:
- a valid editor URI for the resource type or null, if no editor matches
-
-