com.atlassian.renderer.wysiwyg.converter
Class DefaultWysiwygConverter

java.lang.Object
  extended by com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter
All Implemented Interfaces:
WysiwygConverter
Direct Known Subclasses:
PluggableWysiwygConverter

public class DefaultWysiwygConverter
extends Object
implements WysiwygConverter


Field Summary
protected static boolean debug
           
protected  Set<String> macrosToIgnore
          This contains a set of macro names which we don't add to the markup, because they are handled in other ways.
protected  WikiStyleRenderer renderer
           
static String TEXT_SEPARATOR
           
static String TEXT_SEPERATOR
          Deprecated. use #TEXT_SEPARATOR
static String VALID_END
           
static String VALID_START
           
 
Constructor Summary
DefaultWysiwygConverter()
           
DefaultWysiwygConverter(List<TextConverter> textConverterComponents)
           
 
Method Summary
 String convertChildren(NodeContext nodeContext)
          Converts the children of the node in the given node context.
 String convertChildren(Node node, Styles styles, ListContext listContext, boolean inTable, boolean inListItem, boolean ignoreText, boolean escapeWikiMarkup, Node previousSibling)
           
 String convertNode(NodeContext nodeContext)
          Converts the node in the given node context to wiki markup.
 String convertWikiMarkupToXHtml(RenderContext ctx, String wikiMarkup)
           
 String convertXHtmlToWikiMarkup(String xhtml)
           
 String getAttribute(Node node, String name)
          Deprecated. As of release 4.1, use NodeUtil.getAttribute(org.w3c.dom.Node, String).
 String getMacroInfoHtml(RenderContext context, String name, int xOffset, int yOffset)
          Deprecated. This method seems unused in renderer and will probably be removed in a future version.
static String getRawChildText(Node node, boolean stripNewlines)
          Return the text content of a node, adding newlines for <br> and <p> tags
static String getRawChildTextWithoutReplacement(Node node)
          Return the text content of a node, WITHOUT adding newlines for <br> and <p> tags
 String getSep(Node previous, String current, boolean inTable, boolean inList)
          Deprecated. Since 5.0. Use getSeparator(String, NodeContext) instead.
 String getSeparator(String current, NodeContext nodeContext)
           
protected  List<TextConverter> getTextConverterComponents()
          Can be overridden to provide a different list of content escapers.
static boolean isUserNewline(Node node)
           
 void setIconManager(IconManager iconManager)
           
 void setMacroManager(MacroManager macroManager)
           
 void setWikiStyleRenderer(WikiStyleRenderer renderer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_SEPARATOR

public static final String TEXT_SEPARATOR
See Also:
Constant Field Values

TEXT_SEPERATOR

public static final String TEXT_SEPERATOR
Deprecated. use #TEXT_SEPARATOR
See Also:
Constant Field Values

debug

protected static boolean debug

renderer

protected WikiStyleRenderer renderer

macrosToIgnore

protected Set<String> macrosToIgnore
This contains a set of macro names which we don't add to the markup, because they are handled in other ways.


VALID_START

public static final String VALID_START
See Also:
Constant Field Values

VALID_END

public static final String VALID_END
See Also:
Constant Field Values
Constructor Detail

DefaultWysiwygConverter

public DefaultWysiwygConverter()

DefaultWysiwygConverter

public DefaultWysiwygConverter(List<TextConverter> textConverterComponents)
Method Detail

setWikiStyleRenderer

public void setWikiStyleRenderer(WikiStyleRenderer renderer)

setMacroManager

public void setMacroManager(MacroManager macroManager)

getSeparator

public String getSeparator(String current,
                           NodeContext nodeContext)

getSep

public String getSep(Node previous,
                     String current,
                     boolean inTable,
                     boolean inList)
Deprecated. Since 5.0. Use getSeparator(String, NodeContext) instead.

Specified by:
getSep in interface WysiwygConverter

convertChildren

public String convertChildren(Node node,
                              Styles styles,
                              ListContext listContext,
                              boolean inTable,
                              boolean inListItem,
                              boolean ignoreText,
                              boolean escapeWikiMarkup,
                              Node previousSibling)
Specified by:
convertChildren in interface WysiwygConverter

convertChildren

public String convertChildren(NodeContext nodeContext)
Converts the children of the node in the given node context. It cascades the styles and nulls out the previous sibling before calling convertChildren(Node, Styles, ListContext, boolean, boolean, boolean, boolean, Node).

Specified by:
convertChildren in interface WysiwygConverter
Returns:
the wiki markup of the children nodes

convertNode

public String convertNode(NodeContext nodeContext)
Converts the node in the given node context to wiki markup.

Specified by:
convertNode in interface WysiwygConverter
Returns:
the wiki markup of the node

isUserNewline

public static boolean isUserNewline(Node node)

getRawChildText

public static String getRawChildText(Node node,
                                     boolean stripNewlines)
Return the text content of a node, adding newlines for <br> and <p> tags

Parameters:
node - the node to get the text content from
stripNewlines - if this is true then strip any newlines from the raw text, but still add newlines for br and p.

getRawChildTextWithoutReplacement

public static String getRawChildTextWithoutReplacement(Node node)
Return the text content of a node, WITHOUT adding newlines for <br> and <p> tags

Parameters:
node - the node to get the text content from

setIconManager

public void setIconManager(IconManager iconManager)

getMacroInfoHtml

public String getMacroInfoHtml(RenderContext context,
                               String name,
                               int xOffset,
                               int yOffset)
Deprecated. This method seems unused in renderer and will probably be removed in a future version.

Specified by:
getMacroInfoHtml in interface WysiwygConverter

convertXHtmlToWikiMarkup

public String convertXHtmlToWikiMarkup(String xhtml)
Specified by:
convertXHtmlToWikiMarkup in interface WysiwygConverter

convertWikiMarkupToXHtml

public String convertWikiMarkupToXHtml(RenderContext ctx,
                                       String wikiMarkup)
Specified by:
convertWikiMarkupToXHtml in interface WysiwygConverter

getAttribute

public String getAttribute(Node node,
                           String name)
Deprecated. As of release 4.1, use NodeUtil.getAttribute(org.w3c.dom.Node, String).

Specified by:
getAttribute in interface WysiwygConverter

getTextConverterComponents

protected List<TextConverter> getTextConverterComponents()
Can be overridden to provide a different list of content escapers.

Returns:
the current list of text converter components.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.