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 yourini/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_RESOURCE_LOCATION
-
-
Constructor Summary
Constructors Constructor Description DefaultEditorManager(Engine engine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getEditorList()
Returns a list of editors as Strings of editor names.java.lang.String
getEditorName(Context context)
Returns an editor for the current context.java.lang.String
getEditorPath(Context context)
Convenience method for getting the path to the editor JSP file.org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo
getModuleInfo(java.lang.String moduleName)
Returns theWikiModuleInfo
information about the provided moduleName.void
initialize(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, 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 Detail
-
DefaultEditorManager
public DefaultEditorManager(Engine engine)
-
-
Method Detail
-
initialize
public void initialize(Engine engine, java.util.Properties props)
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:
initialize
in interfaceInitializable
- Parameters:
engine
- Engine performing the initialization.props
- Properties for setup.
-
getEditorName
public java.lang.String getEditorName(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 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
public java.lang.String[] getEditorList()
Returns a list of editors as Strings of editor names.- Specified by:
getEditorList
in interfaceEditorManager
- Returns:
- the list of available editors
-
getEditorPath
public java.lang.String getEditorPath(Context context)
Convenience method for getting the path to the editor JSP file.- Specified by:
getEditorPath
in interfaceEditorManager
- Parameters:
context
- WikiContext from where the editor name is retrieved.- Returns:
- e.g. "editors/plain.jsp"
-
modules
public java.util.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 interfaceModuleManager
- Returns:
- A Collection of WikiModuleInfo instances.
-
getModuleInfo
public org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo getModuleInfo(java.lang.String moduleName)
Returns theWikiModuleInfo
information about the provided moduleName.- Specified by:
getModuleInfo
in interfaceModuleManager
- Returns:
- The wikiModuleInfo
-
-