org.opencms.workplace.editors
Class CmsWorkplaceEditorConfiguration

java.lang.Object
  extended byorg.opencms.workplace.editors.CmsWorkplaceEditorConfiguration

public class CmsWorkplaceEditorConfiguration
extends java.lang.Object

Single editor configuration object.

Holds all necessary information about an OpenCms editor which is stored in the "editor_configuration.xml" file in each editor folder.

Provides methods to get the editor information for the editor manager.

Since:
6.0.0
Version:
$Revision: 1.17 $
Author:
Andreas Zahner

Field Summary
static java.lang.String DOCUMENT_NODE
          Name of the root document node.
protected static java.lang.String N_AGENT
          Name of the single user agent node.
protected static java.lang.String N_CLASS
          Name of the resource type class node.
protected static java.lang.String N_LABEL
          Name of the editor label node.
protected static java.lang.String N_MAPTO
          Name of the resource type subnode mapto.
protected static java.lang.String N_NAME
          Name of the resource type subnode name.
protected static java.lang.String N_RANKING
          Name of the resource type subnode ranking.
protected static java.lang.String N_RESOURCETYPES
          Name of the resourcetypes node.
protected static java.lang.String N_TYPE
          Name of the resource type node.
protected static java.lang.String N_USERAGENTS
          Name of the useragents node.
protected static java.lang.String N_WIDGETEDITOR
          Name of the widgeteditor node.
 
Constructor Summary
CmsWorkplaceEditorConfiguration(byte[] xmlData, java.lang.String editorUri)
          Constructor with xml data String.
 
Method Summary
 java.util.List getBrowserPattern()
          Returns the list of compiled browser patterns.
 java.lang.String getEditorLabel()
          Returns the editor label key used for the localized nice name.
 java.lang.String getEditorUri()
          Returns the editor workplace URI.
 java.lang.String getMappingForResourceType(java.lang.String resourceType)
          Returns the mapping for the given resource type.
 float getRankingForResourceType(java.lang.String resourceType)
          Returns the ranking value for the given resource type.
 java.util.Map getResourceTypes()
          Returns the valid resource types of the editor.
 java.util.List getUserAgentsRegEx()
          Returns the valid user agents regular expressions of the editor.
 java.lang.String getWidgetEditor()
          Returns the widget editor class for rich text editing.
 boolean isValidConfiguration()
          Returns if the current configuration is valid.
 boolean isWidgetEditor()
          Returns if the editor is usable as a widget editor for rich text editing.
 boolean matchesBrowser(java.lang.String currentBrowser)
          Tests if the current browser is matching the configuration.
 boolean matchesResourceType(java.lang.String resourceType)
          Returns if the configuration is suitable for the given resource type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_NODE

public static final java.lang.String DOCUMENT_NODE
Name of the root document node.

See Also:
Constant Field Values

N_AGENT

protected static final java.lang.String N_AGENT
Name of the single user agent node.

See Also:
Constant Field Values

N_CLASS

protected static final java.lang.String N_CLASS
Name of the resource type class node.

See Also:
Constant Field Values

N_LABEL

protected static final java.lang.String N_LABEL
Name of the editor label node.

See Also:
Constant Field Values

N_MAPTO

protected static final java.lang.String N_MAPTO
Name of the resource type subnode mapto.

See Also:
Constant Field Values

N_NAME

protected static final java.lang.String N_NAME
Name of the resource type subnode name.

See Also:
Constant Field Values

N_RANKING

protected static final java.lang.String N_RANKING
Name of the resource type subnode ranking.

See Also:
Constant Field Values

N_RESOURCETYPES

protected static final java.lang.String N_RESOURCETYPES
Name of the resourcetypes node.

See Also:
Constant Field Values

N_TYPE

protected static final java.lang.String N_TYPE
Name of the resource type node.

See Also:
Constant Field Values

N_USERAGENTS

protected static final java.lang.String N_USERAGENTS
Name of the useragents node.

See Also:
Constant Field Values

N_WIDGETEDITOR

protected static final java.lang.String N_WIDGETEDITOR
Name of the widgeteditor node.

See Also:
Constant Field Values
Constructor Detail

CmsWorkplaceEditorConfiguration

public CmsWorkplaceEditorConfiguration(byte[] xmlData,
                                       java.lang.String editorUri)
Constructor with xml data String.

Parameters:
xmlData - the XML data String containing the information about the editor
editorUri - the editor workplace URI
Method Detail

getBrowserPattern

public java.util.List getBrowserPattern()
Returns the list of compiled browser patterns.

Returns:
the list of compiled browser patterns

getEditorLabel

public java.lang.String getEditorLabel()
Returns the editor label key used for the localized nice name.

Returns:
the editor label key used for the localized nice name

getEditorUri

public java.lang.String getEditorUri()
Returns the editor workplace URI.

Returns:
the editor workplace URI

getMappingForResourceType

public java.lang.String getMappingForResourceType(java.lang.String resourceType)
Returns the mapping for the given resource type.

Parameters:
resourceType - the resource type name to check
Returns:
the mapping or null, if no mapping is specified

getRankingForResourceType

public float getRankingForResourceType(java.lang.String resourceType)
Returns the ranking value for the given resource type.

Parameters:
resourceType - the current resource type
Returns:
the ranking (the higher the better)

getResourceTypes

public java.util.Map getResourceTypes()
Returns the valid resource types of the editor.

A single map item has the resource type name as key, the value is a String array with two entries:

Returns:
the valid resource types of the editor

getUserAgentsRegEx

public java.util.List getUserAgentsRegEx()
Returns the valid user agents regular expressions of the editor.

Returns:
the valid user agents regular expressions of the editor

getWidgetEditor

public java.lang.String getWidgetEditor()
Returns the widget editor class for rich text editing.

Returns:
the widget editor class for rich text editing

isValidConfiguration

public boolean isValidConfiguration()
Returns if the current configuration is valid.

Returns:
true if no configuration errors were found, otherwise false

isWidgetEditor

public boolean isWidgetEditor()
Returns if the editor is usable as a widget editor for rich text editing.

Returns:
true if the editor is usable as a widget editor for rich text editing, otherwise false

matchesBrowser

public boolean matchesBrowser(java.lang.String currentBrowser)
Tests if the current browser is matching the configuration.

Parameters:
currentBrowser - the users browser String to test
Returns:
true if the browser matches the configuration, otherwise false

matchesResourceType

public boolean matchesResourceType(java.lang.String resourceType)
Returns if the configuration is suitable for the given resource type.

Parameters:
resourceType - the resource type to check
Returns:
true if the configuration matches the resource type