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
  • Constructor Details

  • Method Details

    • 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 interface Initializable
      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 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 java.lang.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 java.lang.String getEditorPath​(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 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 interface ModuleManager
      Returns:
      A Collection of WikiModuleInfo instances.
    • getModuleInfo

      public org.apache.wiki.ui.DefaultEditorManager.WikiEditorInfo getModuleInfo​(java.lang.String moduleName)
      Returns the WikiModuleInfo information about the provided moduleName.
      Specified by:
      getModuleInfo in interface ModuleManager
      Returns:
      The wikiModuleInfo