org.opencms.workplace.editors
Class CmsWorkplaceEditorManager

java.lang.Object
  extended by 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:

Since:
6.0.0

Field Summary
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
CmsWorkplaceEditorManager(CmsObject cms)
          Creates a new editor manager.
 
Method Summary
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.
protected  java.util.List<CmsWorkplaceEditorConfiguration> getEditorConfigurations()
          Returns the editor configuration objects.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
                                          throws CmsException
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
Throws:
CmsException - if something goes wrong

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

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

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

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 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