org.apache.wiki.parser
Class PluginContent

java.lang.Object
  extended by org.jdom2.Content
      extended by org.jdom2.Text
          extended by org.apache.wiki.parser.PluginContent
All Implemented Interfaces:
Serializable, Cloneable, org.jdom2.NamespaceAware

public class PluginContent
extends org.jdom2.Text

Stores the contents of a plugin in a WikiDocument DOM tree.

If the RenderingManager.WYSIWYG_EDITOR_MODE is set to Boolean.TRUE in the context, then the plugin is rendered as WikiMarkup. This allows an HTML editor to work without rendering the plugin each time as well.

If RenderingManager.VAR_EXECUTE_PLUGINS is set to Boolean.FALSE, then the plugin is not executed.

Since:
2.4
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdom2.Content
org.jdom2.Content.CType
 
Field Summary
 
Fields inherited from class org.jdom2.Text
value
 
Fields inherited from class org.jdom2.Content
ctype, parent
 
Constructor Summary
PluginContent(String pluginName, Map<String,String> parameters)
          Creates a new DOM element with the given plugin name and a map of parameters.
 
Method Summary
 void executeParse(WikiContext context)
          Executes the executeParse() method.
 String getParameter(String name)
          Returns a parameter value from the parameter map.
 Map<String,String> getParameters()
          Returns the parameter map given in the constructor.
 String getPluginName()
          Returns the name of the plugin invoked by the DOM element.
 String getText()
          The main invocation for the plugin.
 String getValue()
          Returns the rendered plugin.
static PluginContent parsePluginLine(WikiContext context, String commandline, int pos)
          Parses a plugin invocation and returns a DOM element.
 
Methods inherited from class org.jdom2.Text
append, append, clone, detach, getParent, getTextNormalize, getTextTrim, normalizeString, setParent, setText, toString
 
Methods inherited from class org.jdom2.Content
equals, getCType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParentElement, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PluginContent

public PluginContent(String pluginName,
                     Map<String,String> parameters)
Creates a new DOM element with the given plugin name and a map of parameters.

Parameters:
pluginName - The FQN of a plugin.
parameters - A Map of parameters.
Method Detail

getPluginName

public String getPluginName()
Returns the name of the plugin invoked by the DOM element.

Returns:
Name of the plugin
Since:
2.5.7

getParameter

public String getParameter(String name)
Returns a parameter value from the parameter map.

Parameters:
name - the name of the parameter.
Returns:
The value from the map, or null, if no such parameter exists.

getParameters

public Map<String,String> getParameters()
Returns the parameter map given in the constructor.

Returns:
The parameter map.

getValue

public String getValue()
Returns the rendered plugin. Only calls getText().

Overrides:
getValue in class org.jdom2.Text
Returns:
HTML

getText

public String getText()
The main invocation for the plugin. When the getText() is called, it invokes the plugin and returns its contents. If there is no Document yet, only returns the plugin name itself.

Overrides:
getText in class org.jdom2.Text
Returns:
The plugin rendered according to the options set in the WikiContext.

executeParse

public void executeParse(WikiContext context)
                  throws PluginException
Executes the executeParse() method.

Parameters:
context - The WikiContext
Throws:
PluginException - If something goes wrong.

parsePluginLine

public static PluginContent parsePluginLine(WikiContext context,
                                            String commandline,
                                            int pos)
                                     throws PluginException
Parses a plugin invocation and returns a DOM element.

Parameters:
context - The WikiContext
commandline - The line to parse
pos - The position in the stream parsing.
Returns:
A DOM element
Throws:
PluginException - If plugin invocation is faulty
Since:
2.10.0


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