org.apache.wiki.ui
Class EditorManager

java.lang.Object
  extended by org.apache.wiki.modules.ModuleManager
      extended by org.apache.wiki.ui.EditorManager

public class EditorManager
extends ModuleManager

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:

  
   
       Janne Jalkanen
       
       foo.css
       editors/myeditor.jsp
   
  
  

Since:
2.4

Field Summary
static String ATTR_EDITEDTEXT
          Known attribute name for storing the user edited text inside a session or a page context
static String EDITOR_PLAIN
          Known name for the plain wikimarkup editor.
static String EDITOR_PREVIEW
          Known name for the preview editor component.
static String PARA_EDITOR
          Parameter for changing editors at run-time
static String PROP_EDITORTYPE
          The property name for setting the editor.
static String REQ_EDITEDTEXT
          Known attribute name for storing the user edited text inside a HTTP parameter.
 
Fields inherited from class org.apache.wiki.modules.ModuleManager
m_engine, PLUGIN_RESOURCE_LOCATION
 
Constructor Summary
EditorManager(WikiEngine engine)
           
 
Method Summary
static String getEditedText(javax.servlet.jsp.PageContext ctx)
          Convenience function which examines the current context and attempts to figure out whether the edited text is in the HTTP request parameters or somewhere in the session.
 String[] getEditorList()
          Returns a list of editors as Strings of editor names.
 String getEditorName(WikiContext context)
          Returns an editor for the current context.
 String getEditorPath(WikiContext context)
          Convenience method for getting the path to the editor JSP file.
 void initialize(Properties props)
          Initializes the EditorManager.
 Collection modules()
          Returns a collection of modules currently managed by this ModuleManager.
 
Methods inherited from class org.apache.wiki.modules.ModuleManager
checkCompatibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_EDITORTYPE

public static final String PROP_EDITORTYPE
The property name for setting the editor. Current value is "jspwiki.editor"

See Also:
Constant Field Values

PARA_EDITOR

public static final String PARA_EDITOR
Parameter for changing editors at run-time

See Also:
Constant Field Values

EDITOR_PLAIN

public static final String EDITOR_PLAIN
Known name for the plain wikimarkup editor.

See Also:
Constant Field Values

EDITOR_PREVIEW

public static final String EDITOR_PREVIEW
Known name for the preview editor component.

See Also:
Constant Field Values

REQ_EDITEDTEXT

public static final String REQ_EDITEDTEXT
Known attribute name for storing the user edited text inside a HTTP parameter.

See Also:
Constant Field Values

ATTR_EDITEDTEXT

public static final String ATTR_EDITEDTEXT
Known attribute name for storing the user edited text inside a session or a page context

See Also:
Constant Field Values
Constructor Detail

EditorManager

public EditorManager(WikiEngine engine)
Method Detail

initialize

public void initialize(Properties props)
Initializes the EditorManager. It also registers any editors it can find.

Parameters:
props - Properties for setup.

getEditorName

public String getEditorName(WikiContext 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.

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.

Returns:
the list of available editors

getEditorPath

public String getEditorPath(WikiContext context)
Convenience method for getting the path to the editor JSP file.

Parameters:
context -
Returns:
e.g. "editors/plain.jsp"

getEditedText

public static String getEditedText(javax.servlet.jsp.PageContext ctx)
Convenience function which examines the current context and attempts to figure out whether the edited text is in the HTTP request parameters or somewhere in the session.

Parameters:
ctx - the JSP page context
Returns:
the edited text, if present in the session page context or as a parameter

modules

public Collection modules()
Description copied from class: ModuleManager
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 class ModuleManager
Returns:
A Collection of WikiModuleInfo instances.


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.