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 java.lang.Object
implements WysiwygConverter


Field Summary
static java.lang.String CURSOR_PLACEMENT_CLASS
          Class given to paragraphs whose purpose is to allow somewhere for the cursor to go after a macro.
static java.lang.String CURSOR_PLACEMENT_PARAGRAPH
          A Cursor placement paragraph provides a place to put the cursor after the final macro or table on a page, or before the first macro or table on a page.
protected static boolean debug
           
protected  java.util.Set<java.lang.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 java.lang.String TEXT_SEPARATOR
           
static java.lang.String TEXT_SEPERATOR
          Deprecated. use #TEXT_SEPARATOR
static java.lang.String VALID_END
           
static java.lang.String VALID_START
           
 
Constructor Summary
DefaultWysiwygConverter()
           
DefaultWysiwygConverter(java.util.List<TextConverter> textConverterComponents)
           
 
Method Summary
 java.lang.String convertChildren(NodeContext nodeContext)
          Converts the children nodes of the given node in the node context to wiki markup.
 java.lang.String convertChildren(org.w3c.dom.Node node, Styles styles, ListContext listContext, boolean inTable, boolean inListItem, boolean ignoreText, boolean escapeWikiMarkup, org.w3c.dom.Node previousSibling)
          Deprecated. Since 5.0. Use convertChildren(NodeContext) instead.
 java.lang.String convertNode(NodeContext nodeContext)
          Converts the node in the given node context to wiki markup.
 java.lang.String convertWikiMarkupToXHtml(RenderContext ctx, java.lang.String wikiMarkup)
           
 java.lang.String convertXHtmlToWikiMarkup(java.lang.String xhtml)
           
 java.lang.String getAttribute(org.w3c.dom.Node node, java.lang.String name)
          Deprecated. As of release 4.1, use NodeUtil.getAttribute(org.w3c.dom.Node, String).
 java.lang.String getMacroInfoHtml(RenderContext context, java.lang.String name, int xOffset, int yOffset)
          Deprecated. This method seems unused in renderer and will probably be removed in a future version.
static java.lang.String getRawChildText(org.w3c.dom.Node node, boolean stripNewlines)
          Return the text content of a node, adding newlines for <br> and <p> tags
static java.lang.String getRawChildTextWithoutReplacement(org.w3c.dom.Node node)
          Return the text content of a node, WITHOUT adding newlines for <br> and <p> tags
 java.lang.String getSep(org.w3c.dom.Node previous, java.lang.String current, boolean inTable, boolean inList)
          Deprecated. Since 5.0. Use getSeparator(String, NodeContext) instead. This method is quite broken in 6.0 since it does not respect NodeContext.isInHeading().
 java.lang.String getSeparator(java.lang.String current, NodeContext nodeContext)
          Determine the appropriate separation string to place between the wiki markup for the previous node and the current node based on their type and the current table/list/heading (etc.) context.
protected  java.util.List<TextConverter> getTextConverterComponents()
          Can be overridden to provide a different list of content escapers.
static boolean isUserNewline(org.w3c.dom.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 java.lang.String TEXT_SEPARATOR
See Also:
Constant Field Values

TEXT_SEPERATOR

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

CURSOR_PLACEMENT_CLASS

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

See Also:
Constant Field Values

CURSOR_PLACEMENT_PARAGRAPH

public static final java.lang.String CURSOR_PLACEMENT_PARAGRAPH
A Cursor placement paragraph provides a place to put the cursor after the final macro or table on a page, or before the first macro or table on a page. Most cursor placement paragraphs are stripped out as being redundant by convertWikiMarkupToXHtml(RenderContext, String).

See Also:
Constant Field Values

debug

protected static boolean debug

renderer

protected WikiStyleRenderer renderer

macrosToIgnore

protected java.util.Set<java.lang.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 java.lang.String VALID_START
See Also:
Constant Field Values

VALID_END

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

DefaultWysiwygConverter

public DefaultWysiwygConverter()

DefaultWysiwygConverter

public DefaultWysiwygConverter(java.util.List<TextConverter> textConverterComponents)
Method Detail

setWikiStyleRenderer

public void setWikiStyleRenderer(WikiStyleRenderer renderer)

setMacroManager

public void setMacroManager(MacroManager macroManager)

getSeparator

public java.lang.String getSeparator(java.lang.String current,
                                     NodeContext nodeContext)
Determine the appropriate separation string to place between the wiki markup for the previous node and the current node based on their type and the current table/list/heading (etc.) context.

Parameters:
current - the "type" of the current node, see TypeBasedSeparation
nodeContext - the current nodeContext.
Returns:
the separation string to place between the nodes' wiki markup. May be empty.

getSep

public java.lang.String getSep(org.w3c.dom.Node previous,
                               java.lang.String current,
                               boolean inTable,
                               boolean inList)
Deprecated. Since 5.0. Use getSeparator(String, NodeContext) instead. This method is quite broken in 6.0 since it does not respect NodeContext.isInHeading().

Specified by:
getSep in interface WysiwygConverter

convertChildren

public java.lang.String convertChildren(NodeContext nodeContext)
Description copied from interface: WysiwygConverter
Converts the children nodes of the given node in the node context to wiki markup.

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

convertChildren

public java.lang.String convertChildren(org.w3c.dom.Node node,
                                        Styles styles,
                                        ListContext listContext,
                                        boolean inTable,
                                        boolean inListItem,
                                        boolean ignoreText,
                                        boolean escapeWikiMarkup,
                                        org.w3c.dom.Node previousSibling)
Deprecated. Since 5.0. Use convertChildren(NodeContext) instead.

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

convertNode

public java.lang.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(org.w3c.dom.Node node)

getRawChildText

public static java.lang.String getRawChildText(org.w3c.dom.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.
Returns:
the converted text as a string. This may be empty but will not be null.

getRawChildTextWithoutReplacement

public static java.lang.String getRawChildTextWithoutReplacement(org.w3c.dom.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 java.lang.String getMacroInfoHtml(RenderContext context,
                                         java.lang.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 java.lang.String convertXHtmlToWikiMarkup(java.lang.String xhtml)
Specified by:
convertXHtmlToWikiMarkup in interface WysiwygConverter

convertWikiMarkupToXHtml

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

getAttribute

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

Specified by:
getAttribute in interface WysiwygConverter

getTextConverterComponents

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

Returns:
the current list of text converter components.


Copyright © 2012 Atlassian. All Rights Reserved.