com.atlassian.renderer.wysiwyg
Class NodeContext

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

public class NodeContext
extends java.lang.Object

The context in which the node is being converted from xhtml to wiki markup. This class is only used in the WysiwygMacroHelper at the moment and should be eventually used in DefaultWysiwygConverter instead of passing so many parameters around.


Nested Class Summary
static class NodeContext.Builder
          Builder to help construct new NodeContexts.
 
Constructor Summary
NodeContext(org.w3c.dom.Node node, org.w3c.dom.Node previousSibling, Styles styles, ListContext listContext, boolean inTable, boolean inListItem, boolean ignoreText, boolean escapeWikiMarkup)
          Deprecated. Since 6.0 use NodeContext#Builder to build NodeContexts instead. This constructor does not allow setting the inHeading.
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Retrieve the attribute value from the node.
 boolean getBooleanAttributeValue(java.lang.String attributeName, boolean defaultValue)
          Retrieve the value of an attribute from the node as a boolean.
 NodeContext getFirstChildNodeContext()
           
 NodeContext getFirstChildNodeContextPreservingPreviousSibling()
           
 ListContext getListContext()
           
 org.w3c.dom.Node getNode()
           
 NodeContext getNodeContextForNextChild(NodeContext child)
          Get a node context for the child of this context after the given one.
 NodeContext getNodeContextForNextChildPreservingPreviousSibling(NodeContext child)
          Get a node context for the child after the given one, but keep the previous sibling set in the child context.
 java.lang.String getNodeName()
          Returns the name of the node in all lower case.
 org.w3c.dom.Node getPreviousSibling()
           
 Styles getStyles()
           
 boolean hasClass(java.lang.String className)
          Check the "class" attribute for a specific class
 boolean hasNodeName(java.lang.String nodeName)
          Return true if the node name matches the given string.
 java.lang.String invokeConvert(WysiwygNodeConverter wysiwygNodeConverter, WysiwygConverter wysiwygConverter)
           
 boolean isEscapeWikiMarkup()
           
 boolean isIgnoreText()
           
 boolean isInHeading()
           
 boolean isInListItem()
           
 boolean isInTable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeContext

public NodeContext(org.w3c.dom.Node node,
                   org.w3c.dom.Node previousSibling,
                   Styles styles,
                   ListContext listContext,
                   boolean inTable,
                   boolean inListItem,
                   boolean ignoreText,
                   boolean escapeWikiMarkup)
Deprecated. Since 6.0 use NodeContext#Builder to build NodeContexts instead. This constructor does not allow setting the inHeading.

Method Detail

getFirstChildNodeContext

public NodeContext getFirstChildNodeContext()
Returns:
a NodeContext for the first child node of this context. Returns null if there is no first child.

getFirstChildNodeContextPreservingPreviousSibling

public NodeContext getFirstChildNodeContextPreservingPreviousSibling()
Returns:
a NodeContext for the first child node of this context. Returns null if there is no first child. Copies the previous sibling down from the current nodeContext.

getNodeContextForNextChild

public NodeContext getNodeContextForNextChild(NodeContext child)
Get a node context for the child of this context after the given one. The new context will have most of the settings of the parent context.

Parameters:
child - a childContext of this object.
Returns:
a NodeContext for the next sibling node of the given child context. Returns null if there is no next sibling.

getNodeContextForNextChildPreservingPreviousSibling

public NodeContext getNodeContextForNextChildPreservingPreviousSibling(NodeContext child)
Get a node context for the child after the given one, but keep the previous sibling set in the child context. This is used to skip the given child in terms of separation detection.

Parameters:
child - a childContext of this object.
Returns:
a NodeContext for the next sibling node of the given child context. Returns null if there is no next sibling.

invokeConvert

public java.lang.String invokeConvert(WysiwygNodeConverter wysiwygNodeConverter,
                                      WysiwygConverter wysiwygConverter)

hasClass

public boolean hasClass(java.lang.String className)
Check the "class" attribute for a specific class

Returns:
true if the given class is found

getNode

public org.w3c.dom.Node getNode()

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()

getStyles

public Styles getStyles()

getListContext

public ListContext getListContext()

isInTable

public boolean isInTable()

isInListItem

public boolean isInListItem()

isInHeading

public boolean isInHeading()

isIgnoreText

public boolean isIgnoreText()

isEscapeWikiMarkup

public boolean isEscapeWikiMarkup()

getBooleanAttributeValue

public boolean getBooleanAttributeValue(java.lang.String attributeName,
                                        boolean defaultValue)
Retrieve the value of an attribute from the node as a boolean. If the value is not present, or not readily convertible to a boolean return the requested defaultValue.

Parameters:
attributeName - the attribute to find the value of
defaultValue - the value to return if no boolean value is found.
Returns:
the value of an attribute

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Retrieve the attribute value from the node.

Returns:
the value of an attribute. Null if attribute isn't present.

getNodeName

public java.lang.String getNodeName()
Returns the name of the node in all lower case.

Returns:
lower case version of the node name.

hasNodeName

public boolean hasNodeName(java.lang.String nodeName)
Return true if the node name matches the given string. The check is case insensitive.



Copyright © 2012 Atlassian. All Rights Reserved.