Package org.apache.wiki.ui

# Class DefaultEditorManager

java.lang.Object
org.apache.wiki.modules.BaseModuleManager
org.apache.wiki.ui.DefaultEditorManager

All Implemented Interfaces:
  `org.apache.wiki.api.engine.Initializable`, `ModuleManager`, `EditorManager`

public class DefaultEditorManager extends BaseModuleManager implements EditorManager
Defines an editor manager. An editor can be added by adding a suitable JSP file under templates/default/editors If you want your editor to include any scripts or something, you can simply request it by adding the following in your `ini/jspwiki_module.xml`:

      <modules>
       <editor name="myeditor">
           <author>Janne Jalkanen</author>
           <script>foo.js</script>
           <stylesheet>foo.css</stylesheet>
           <path>editors/myeditor.jsp</path>
       </editor>
      </modules>

Since:
  2.4

## Field Summary

### Fields inherited from class org.apache.wiki.modules.BaseModuleManager

`m_engine`

### Fields inherited from interface org.apache.wiki.ui.EditorManager

`ATTR_EDITEDTEXT, EDITOR_PLAIN, EDITOR_PREVIEW, PARA_EDITOR, PROP_EDITORTYPE, REQ_EDITEDTEXT`

### Fields inherited from interface org.apache.wiki.modules.ModuleManager

`PLUGIN_I18N_RESOURCE, PLUGIN_RESOURCE_LOCATION`

## Constructor Summary

Constructors
Constructor
Description
`DefaultEditorManager(org.apache.wiki.api.core.Engine engine)`

## Method Summary

Modifier and Type
Method
Description
`String[]`
`getEditorList()`
Returns a list of editors as Strings of editor names.
`String`
`getEditorName(org.apache.wiki.api.core.Context context)`
Returns an editor for the current context.
`String`
`getEditorPath(org.apache.wiki.api.core.Context context)`
Convenience method for getting the path to the editor JSP file.
`org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo`
`getModuleInfo(String moduleName)`
Returns the `WikiModuleInfo` information about the provided moduleName.
`void`
`initialize(org.apache.wiki.api.core.Engine engine, Properties props)`
Initializes the EditorManager.
`Collection<WikiModuleInfo>`
`modules()`
Returns a collection of modules currently managed by this ModuleManager.

### Methods inherited from class org.apache.wiki.modules.BaseModuleManager

`checkCompatibility, modules`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.wiki.modules.ModuleManager

`checkCompatibility`

## Constructor Details

### DefaultEditorManager

public DefaultEditorManager(org.apache.wiki.api.core.Engine engine)

## Method Details

### initialize

public void initialize(org.apache.wiki.api.core.Engine engine, Properties props)
Initializes the EditorManager. It also registers any editors it can find.

Specified by:
  `initialize` in interface `org.apache.wiki.api.engine.Initializable`

### getEditorName

public String getEditorName(org.apache.wiki.api.core.Context context)
Returns an editor for the current context. The editor names are matched in a case insensitive manner. At the moment, the only place that this method looks in is the property file, but in the future this will also look at user preferences.

Determines the editor to use by the following order of conditions: 1. Editor set in User Preferences 2. Default Editor set in jspwiki.properties

For the PREVIEW context, this method returns the "preview" editor.

Specified by:
  `getEditorName` in interface `EditorManager`
Parameters:
  `context` - The context that is chosen.
Returns:
  The name of the chosen editor. If no match could be found, will revert to the default "plain" editor.

### getEditorList

public String[] getEditorList()
Returns a list of editors as Strings of editor names.

Specified by:
  `getEditorList` in interface `EditorManager`
Returns:
  the list of available editors

### getEditorPath

public String getEditorPath(org.apache.wiki.api.core.Context context)
Convenience method for getting the path to the editor JSP file.

Specified by:
  `getEditorPath` in interface `EditorManager`
Parameters:
  `context` - WikiContext from where the editor name is retrieved.
Returns:
  e.g. "editors/plain.jsp"

### modules

public Collection<WikiModuleInfo> modules()
Returns a collection of modules currently managed by this ModuleManager. Each entry is an instance of the WikiModuleInfo class. This method should return something which is safe to iterate over, even if the underlying collection changes.

Specified by:
  `modules` in interface `ModuleManager`
Returns:
  A Collection of WikiModuleInfo instances.

### getModuleInfo

public org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo getModuleInfo(String moduleName)
Returns the `WikiModuleInfo` information about the provided moduleName.

Specified by:
  `getModuleInfo` in interface `ModuleManager`
Returns:
  The wikiModuleInfo