com.atlassian.renderer.wysiwyg
Class WysiwygMacroHelper

java.lang.Object
  extended by com.atlassian.renderer.wysiwyg.WysiwygMacroHelper

public class WysiwygMacroHelper
extends Object

Class responsible for the Rendering and Conversion of Macros, between wiki markup and wysiwyg xhtml.


Field Summary
static String MACRO_CLASS
           
static String MACRO_HAS_BODY_ATTRIBUTE
           
static String MACRO_HAS_NEWLINE_AFTER_BODY_ATTRIBUTE
           
static String MACRO_HAS_NEWLINE_BEFORE_BODY_ATTRIBUTE
           
static String MACRO_HAS_PRECEDING_NEWLINE_ATTRIBUTE
           
static String MACRO_HAS_TRAILING_NEWLINE_ATTRIBUTE
           
static String MACRO_NAME_ATTRIBUTE
           
static String MACRO_PADDING_CLASS
          Class given to paragraphs whose purpose is to allow somewhere for the cursor to go after a macro.
static String MACRO_START_TAG_ATTRIBUTE
           
static String MACRO_TAG_PARAM
           
 
Constructor Summary
WysiwygMacroHelper(MacroRendererComponent macroRendererComponent)
           
 
Method Summary
static String convertMacroFromNode(NodeContext nodeContext, DefaultWysiwygConverter defaultWysiwygConverter, Macro macro)
          Converts a macro node back to wiki markup.
static String getMacroName(Node node)
          Retrieves the macro name from the given node.
static boolean isMacroBody(Node node)
          Returns true if the node is a macro body node.
static boolean isMacroTag(Node node)
          Returns true if the node is a macro body node.
 void renderMacro(MacroTag startTag, Macro macro, String body, Map params, RenderContext context, StringBuffer buffer)
          Renders a macro with the given information and outputs the XHTML into the given buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MACRO_TAG_PARAM

public static final String MACRO_TAG_PARAM
See Also:
Constant Field Values

MACRO_CLASS

public static final String MACRO_CLASS
See Also:
Constant Field Values

MACRO_NAME_ATTRIBUTE

public static final String MACRO_NAME_ATTRIBUTE
See Also:
Constant Field Values

MACRO_START_TAG_ATTRIBUTE

public static final String MACRO_START_TAG_ATTRIBUTE
See Also:
Constant Field Values

MACRO_HAS_BODY_ATTRIBUTE

public static final String MACRO_HAS_BODY_ATTRIBUTE
See Also:
Constant Field Values

MACRO_HAS_NEWLINE_BEFORE_BODY_ATTRIBUTE

public static final String MACRO_HAS_NEWLINE_BEFORE_BODY_ATTRIBUTE
See Also:
Constant Field Values

MACRO_HAS_NEWLINE_AFTER_BODY_ATTRIBUTE

public static final String MACRO_HAS_NEWLINE_AFTER_BODY_ATTRIBUTE
See Also:
Constant Field Values

MACRO_HAS_PRECEDING_NEWLINE_ATTRIBUTE

public static final String MACRO_HAS_PRECEDING_NEWLINE_ATTRIBUTE
See Also:
Constant Field Values

MACRO_HAS_TRAILING_NEWLINE_ATTRIBUTE

public static final String MACRO_HAS_TRAILING_NEWLINE_ATTRIBUTE
See Also:
Constant Field Values

MACRO_PADDING_CLASS

public static final String MACRO_PADDING_CLASS
Class given to paragraphs whose purpose is to allow somewhere for the cursor to go after a macro.

See Also:
Constant Field Values
Constructor Detail

WysiwygMacroHelper

public WysiwygMacroHelper(MacroRendererComponent macroRendererComponent)
Method Detail

renderMacro

public void renderMacro(MacroTag startTag,
                        Macro macro,
                        String body,
                        Map params,
                        RenderContext context,
                        StringBuffer buffer)
Renders a macro with the given information and outputs the XHTML into the given buffer.

Parameters:
startTag - the start tag of the macro
macro - the macro to render. Note that this could be null.
body - the wiki markup body of the macro. This can also be null.
params - a map of macro parameters
context - the render context in which the macro is rendered
buffer - the buffer to which the rendered output is appended

getMacroName

public static String getMacroName(Node node)
Retrieves the macro name from the given node.


isMacroBody

public static boolean isMacroBody(Node node)
Returns true if the node is a macro body node.


isMacroTag

public static boolean isMacroTag(Node node)
Returns true if the node is a macro body node.


convertMacroFromNode

public static String convertMacroFromNode(NodeContext nodeContext,
                                          DefaultWysiwygConverter defaultWysiwygConverter,
                                          Macro macro)
Converts a macro node back to wiki markup.

Parameters:
nodeContext - the context the node is currently in
defaultWysiwygConverter - the converter that is calling this method
macro - the macro that is being converted
Returns:
wiki markup string of the macro


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.