Package org.apache.wiki.ui
Class DefaultEditorManager
java.lang.Object
org.apache.wiki.modules.BaseModuleManager
org.apache.wiki.ui.DefaultEditorManager
- All Implemented Interfaces:
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_engineFields inherited from interface org.apache.wiki.ui.EditorManager
ATTR_EDITEDTEXT, EDITOR_PLAIN, EDITOR_PREVIEW, PARA_EDITOR, PROP_EDITORTYPE, REQ_EDITEDTEXTFields inherited from interface org.apache.wiki.modules.ModuleManager
PLUGIN_RESOURCE_LOCATION -
Constructor Summary
Constructors Constructor Description DefaultEditorManager(Engine engine) -
Method Summary
Modifier and Type Method Description java.lang.String[]getEditorList()Returns a list of editors as Strings of editor names.java.lang.StringgetEditorName(Context context)Returns an editor for the current context.java.lang.StringgetEditorPath(Context context)Convenience method for getting the path to the editor JSP file.org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfogetModuleInfo(java.lang.String moduleName)Returns theWikiModuleInfoinformation about the provided moduleName.voidinitialize(Engine engine, java.util.Properties props)Initializes this Engine component.java.util.Collection<WikiModuleInfo>modules()Returns a collection of modules currently managed by this ModuleManager.Methods inherited from class org.apache.wiki.modules.BaseModuleManager
checkCompatibility, modulesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.wiki.modules.ModuleManager
checkCompatibility
-
Constructor Details
-
DefaultEditorManager
-
-
Method Details
-
initialize
Initializes this Engine component. Note that the engine is not fully initialized at this point, so don't do anything fancy here - use lazy init, if you have to.
Initializes the EditorManager. It also registers any editors it can find.
- Specified by:
initializein interfaceInitializable- Parameters:
engine- Engine performing the initialization.props- Properties for setup.
-
getEditorName
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:
getEditorNamein interfaceEditorManager- 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
Returns a list of editors as Strings of editor names.- Specified by:
getEditorListin interfaceEditorManager- Returns:
- the list of available editors
-
getEditorPath
Convenience method for getting the path to the editor JSP file.- Specified by:
getEditorPathin interfaceEditorManager- Parameters:
context- WikiContext from where the editor name is retrieved.- Returns:
- e.g. "editors/plain.jsp"
-
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:
modulesin interfaceModuleManager- Returns:
- A Collection of WikiModuleInfo instances.
-
getModuleInfo
public org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo getModuleInfo(java.lang.String moduleName)Returns theWikiModuleInfoinformation about the provided moduleName.- Specified by:
getModuleInfoin interfaceModuleManager- Returns:
- The wikiModuleInfo
-