textbender.o.rhinohide.core
Class RhiNode

java.lang.Object
  extended by Rhinohide
      extended by RhiEventTarget
          extended by RhiNode
All Implemented Interfaces:
EventTarget, Node
Direct Known Subclasses:
RhiAttr, RhiCharacterData, RhiDocument, RhiDocumentFragment, RhiDocumentType, RhiElement, RhiEntity, RhiEntityReference, RhiNotation, RhiProcessingInstruction

@ThreadSafe
public abstract class RhiNode
extends RhiEventTarget
implements Node

A node implemented as an overlay of a JavaScript node.

BUG: flaky-insert

http://zelea.com/var/cache/textbender-javadoc/textbender/o/rhinohide/core/RhiNode.html#flaky-insert

Affects IE and particular orderings of node insert/append. When populating a newly created node, you may have to insert/append its children prior to inserting the new node in its own, higher parent. Otherwise the insert/append may throw a JSException, "Unexpected call to method or property access." See for example the source code of populateAndInsert, in RhiDocumentFragment_1.

Suspect Java Plug-In bug, specific to IE.


Field Summary
 
Fields inherited from class Rhinohide
window
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
RhiNode(RhiWindow window, netscape.javascript.JSObject jsObject)
           
 
Method Summary
 Node appendChild(Node newChild)
           
 Node cloneNode(boolean deep)
           
 short compareDocumentPosition(Node other)
          Not yet coded.
protected static void ensureNodeType(Rhinohide rhinohide, short nodeType)
           
 boolean equals(Object o)
          Returns true iff o is a RhiNode, and wraps the same JavaScript node, according to Node.isSameNode().
 NamedNodeMap getAttributes()
           
 String getBaseURI()
          Untested.
 NodeList getChildNodes()
           
 Object getFeature(String feature, String version)
          Not yet coded.
 Node getFirstChild()
           
 Node getLastChild()
           
 String getLocalName()
           
 String getNamespaceURI()
           
 Node getNextSibling()
           
 String getNodeName()
           
 short getNodeType()
           
static short getNodeType(Rhinohide rhinohide)
          Returns the node type of a JavaScript node.
 String getNodeValue()
           
 Document getOwnerDocument()
           
 Node getParentNode()
           
 String getPrefix()
          Untested.
 Node getPreviousSibling()
           
 String getTextContent()
          Untested.
 Object getUserData(String key)
          Not yet coded.
 boolean hasAttributes()
          Untested.
 boolean hasChildNodes()
           
 int hashCode()
          Not yet coded, non-trivial.
 Node insertBefore(Node newChild, Node refChild)
           
 boolean isDefaultNamespace(String namespaceURI)
           
 boolean isEqualNode(Node arg)
          Untested.
 boolean isSameNode(Node other)
           
 boolean isSupported(String feature, String version)
           
 String lookupNamespaceURI(String prefix)
          Untested.
 String lookupPrefix(String namespaceURI)
           
 void normalize()
           
 Node removeChild(Node oldChild)
           
 Node replaceChild(Node newChild, Node oldChild)
           
 void setNodeValue(String value)
           
 void setPrefix(String prefix)
          Not yet coded.
 void setTextContent(String textContent)
          Not yet coded.
 Object setUserData(String key, Object data, UserDataHandler handler)
          Not yet coded.
static RhiNode wrapNode(RhiWindow window, netscape.javascript.JSObject jsObject)
          Creates a RhiNode.
static RhiNode wrapNode(RhiWindow window, netscape.javascript.JSObject jsObject, short nodeType)
          Creates a RhiNode of a specified node type.
 
Methods inherited from class RhiEventTarget
addEventListener, dispatchEvent, removeEventListener, wrapEventTarget
 
Methods inherited from class Rhinohide
call, callV, checkV, eval, evalV, getMember, getMemberV, jsObject, setMember, toJSObject, toString, window
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RhiNode

RhiNode(RhiWindow window,
        netscape.javascript.JSObject jsObject)
Method Detail

wrapNode

public static RhiNode wrapNode(RhiWindow window,
                               netscape.javascript.JSObject jsObject)
Creates a RhiNode.

Parameters:
window - global object
jsObject - bridge to underlying JavaScript node, per jsObject()
Returns:
node, or null if jsObject is null
Throws:
StunnedRhinoException - if jsObject is non-null, and has no 'nodeType' property

wrapNode

public static RhiNode wrapNode(RhiWindow window,
                               netscape.javascript.JSObject jsObject,
                               short nodeType)
Creates a RhiNode of a specified node type.

Parameters:
window - global object
jsObject - bridge to underlying JavaScript node, per jsObject()
nodeType - jsObject's node type

appendChild

public final Node appendChild(Node newChild)
Specified by:
appendChild in interface Node

cloneNode

public final Node cloneNode(boolean deep)
Specified by:
cloneNode in interface Node

compareDocumentPosition

public final short compareDocumentPosition(Node other)
Not yet coded.

Specified by:
compareDocumentPosition in interface Node
Throws:
UnsupportedOperationException

getAttributes

public final NamedNodeMap getAttributes()
Specified by:
getAttributes in interface Node

getBaseURI

public final String getBaseURI()
Untested.

Specified by:
getBaseURI in interface Node

getChildNodes

public final NodeList getChildNodes()
Specified by:
getChildNodes in interface Node

getFeature

public final Object getFeature(String feature,
                               String version)
Not yet coded.

Specified by:
getFeature in interface Node
Throws:
UnsupportedOperationException

getFirstChild

public final Node getFirstChild()
Specified by:
getFirstChild in interface Node

getLastChild

public final Node getLastChild()
Specified by:
getLastChild in interface Node

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node

getNamespaceURI

public final String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node

getNodeName

public final String getNodeName()
Specified by:
getNodeName in interface Node

getNodeType

public final short getNodeType()
Specified by:
getNodeType in interface Node

getNodeType

public static short getNodeType(Rhinohide rhinohide)
Returns the node type of a JavaScript node.

Parameters:
rhinohide - of JavaScript node
Throws:
StunnedRhinoException - if jsObject is non-null, and has no 'nodeType' property

getNodeValue

public final String getNodeValue()
Specified by:
getNodeValue in interface Node

setNodeValue

public final void setNodeValue(String value)
Specified by:
setNodeValue in interface Node

getOwnerDocument

public final Document getOwnerDocument()
Specified by:
getOwnerDocument in interface Node

getParentNode

public final Node getParentNode()
Specified by:
getParentNode in interface Node

getPrefix

public final String getPrefix()
Untested.

Specified by:
getPrefix in interface Node

setPrefix

public final void setPrefix(String prefix)
Not yet coded.

Specified by:
setPrefix in interface Node
Throws:
UnsupportedOperationException

getPreviousSibling

public final Node getPreviousSibling()
Specified by:
getPreviousSibling in interface Node

getNextSibling

public final Node getNextSibling()
Specified by:
getNextSibling in interface Node

getTextContent

public final String getTextContent()
Untested.

Specified by:
getTextContent in interface Node

setTextContent

public final void setTextContent(String textContent)
Not yet coded.

Specified by:
setTextContent in interface Node
Throws:
UnsupportedOperationException

hasAttributes

public final boolean hasAttributes()
Untested.

Specified by:
hasAttributes in interface Node

hasChildNodes

public final boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node

insertBefore

public final Node insertBefore(Node newChild,
                               Node refChild)
Specified by:
insertBefore in interface Node

isDefaultNamespace

public final boolean isDefaultNamespace(String namespaceURI)
Specified by:
isDefaultNamespace in interface Node

isEqualNode

public final boolean isEqualNode(Node arg)
Untested.

Specified by:
isEqualNode in interface Node

isSameNode

public final boolean isSameNode(Node other)
Specified by:
isSameNode in interface Node

isSupported

public final boolean isSupported(String feature,
                                 String version)
Specified by:
isSupported in interface Node

lookupNamespaceURI

public final String lookupNamespaceURI(String prefix)
Untested.

Specified by:
lookupNamespaceURI in interface Node

lookupPrefix

public final String lookupPrefix(String namespaceURI)
Specified by:
lookupPrefix in interface Node

normalize

public final void normalize()
Specified by:
normalize in interface Node

removeChild

public final Node removeChild(Node oldChild)
Specified by:
removeChild in interface Node

replaceChild

public final Node replaceChild(Node newChild,
                               Node oldChild)
Specified by:
replaceChild in interface Node

getUserData

public final Object getUserData(String key)
Not yet coded.

Specified by:
getUserData in interface Node
Throws:
UnsupportedOperationException

setUserData

public final Object setUserData(String key,
                                Object data,
                                UserDataHandler handler)
Not yet coded.

Specified by:
setUserData in interface Node
Throws:
UnsupportedOperationException

equals

public boolean equals(Object o)
Returns true iff o is a RhiNode, and wraps the same JavaScript node, according to Node.isSameNode().

Overrides:
equals in class Rhinohide

hashCode

public int hashCode()
Not yet coded, non-trivial. Needs a reasonably efficient algorithm, compatible with equals().

Overrides:
hashCode in class Rhinohide
Throws:
UnsupportedOperationException

ensureNodeType

protected static void ensureNodeType(Rhinohide rhinohide,
                                     short nodeType)
Throws:
IllegalArgumentException - if jsObject is not a DOM node of nodeType