Package org.lobobrowser.html.domimpl
Class NodeImpl
- java.lang.Object
-
- org.lobobrowser.js.AbstractScriptableDelegate
-
- org.lobobrowser.html.domimpl.NodeImpl
-
- All Implemented Interfaces:
ModelNode,ScriptableDelegate,org.w3c.dom.Node
- Direct Known Subclasses:
AttrImpl,CharacterDataImpl,DocumentFragmentImpl,DocumentTypeImpl,ElementImpl,HTMLDocumentImpl,HTMLProcessingInstruction
public abstract class NodeImpl extends AbstractScriptableDelegate implements org.w3c.dom.Node, ModelNode
-
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.dom.Documentdocumentprotected static java.util.logging.Loggerloggerprotected java.util.ArrayListnodeListprotected booleannotificationsSuspendedprotected org.w3c.dom.NodeparentNodeprotected java.lang.ObjecttreeLockA tree lock is less deadlock-prone than a node-level lock.protected UINodeuiNode-
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
Constructors Constructor Description NodeImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.NodeappendChild(org.w3c.dom.Node newChild)protected voidappendInnerHTMLImpl(java.lang.StringBuffer buffer)protected voidappendInnerTextImpl(java.lang.StringBuffer buffer)org.w3c.dom.NodecloneNode(boolean deep)shortcompareDocumentPosition(org.w3c.dom.Node other)protected RenderStatecreateRenderState(RenderState prevRenderState)protected abstract org.w3c.dom.NodecreateSimilarNode()Should create a node with some cloned properties, like the node name, but not attributes or children.booleanequalAttributes(org.w3c.dom.Node arg)UINodefindUINode()Tries to get a UINode associated with the current node.protected voidforgetRenderState()floatgetAlignmentX()floatgetAlignmentY()org.w3c.dom.NamedNodeMapgetAttributes()java.lang.StringgetBaseURI()org.w3c.dom.NodeListgetChildNodes()ChildHTMLCollectiongetChildren()NodeImpl[]getChildrenArray()java.util.ArrayListgetDescendents(NodeFilter filter, boolean nestIntoMatchingNodes)Creates anArrayListof descendent nodes that the given filter condition.java.lang.ObjectgetDocumentItem(java.lang.String name)java.net.URLgetDocumentURL()java.lang.ObjectgetFeature(java.lang.String feature, java.lang.String version)org.w3c.dom.NodegetFirstChild()java.net.URLgetFullURL(java.lang.String spec)HtmlRendererContextgetHtmlRendererContext()java.lang.StringgetInnerHTML()java.lang.StringgetInnerText()Attempts to convert the subtree starting at this point to a close text representation.org.w3c.dom.NodegetLastChild()abstract java.lang.StringgetLocalName()java.lang.StringgetNamespaceURI()org.w3c.dom.NodegetNextSibling()protected org.w3c.dom.NodeListgetNodeList(NodeFilter filter)abstract java.lang.StringgetNodeName()abstract shortgetNodeType()abstract java.lang.StringgetNodeValue()org.w3c.dom.DocumentgetOwnerDocument()ModelNodegetParentModelNode()org.w3c.dom.NodegetParentNode()protected RenderStategetParentRenderState(java.lang.Object parent)java.lang.StringgetPrefix()org.w3c.dom.NodegetPreviousSibling()RenderStategetRenderState()java.lang.StringgetTextContent()Gets the text content of this node and its descendents.UINodegetUINode()UserAgentContextgetUserAgentContext()java.lang.ObjectgetUserData(java.lang.String key)booleanhasAttributes()booleanhasChildNodes()protected java.lang.StringhtmlEncodeChildText(java.lang.String text)voidinformDocumentInvalid()protected voidinformExternalScriptLoading()voidinformInvalid()voidinformLayoutInvalid()voidinformLookInvalid()protected voidinformNodeLoaded()voidinformPositionInvalid()voidinformSizeInvalid()voidinformStructureInvalid()org.w3c.dom.NodeinsertAfter(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)protected org.w3c.dom.NodeinsertAt(org.w3c.dom.Node newChild, int idx)org.w3c.dom.NodeinsertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)booleanisDefaultNamespace(java.lang.String namespaceURI)booleanisEqualNode(org.w3c.dom.Node arg)booleanisEqualOrDescendentOf(ModelNode otherContext)booleanisSameNode(org.w3c.dom.Node other)booleanisSupported(java.lang.String feature, java.lang.String version)java.lang.StringlookupNamespaceURI(java.lang.String prefix)java.lang.StringlookupPrefix(java.lang.String namespaceURI)voidnormalize()protected voidremoveAllChildren()protected voidremoveAllChildrenImpl()org.w3c.dom.NoderemoveChild(org.w3c.dom.Node oldChild)org.w3c.dom.NoderemoveChildAt(int index)protected voidremoveChildren(NodeFilter filter)protected voidremoveChildrenImpl(NodeFilter filter)org.w3c.dom.TextreplaceAdjacentTextNodes(org.w3c.dom.Text node)org.w3c.dom.TextreplaceAdjacentTextNodes(org.w3c.dom.Text node, java.lang.String textContent)org.w3c.dom.NodereplaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)voidsetDocumentItem(java.lang.String name, java.lang.Object value)Sets a document item.abstract voidsetNodeValue(java.lang.String nodeValue)voidsetPrefix(java.lang.String prefix)voidsetTextContent(java.lang.String textContent)voidsetUINode(UINode uiNode)java.lang.ObjectsetUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)java.lang.StringtoString()voidwarn(java.lang.String message)voidwarn(java.lang.String message, java.lang.Throwable err)-
Methods inherited from class org.lobobrowser.js.AbstractScriptableDelegate
getScriptable, setScriptable
-
-
-
-
Field Detail
-
logger
protected static final java.util.logging.Logger logger
-
uiNode
protected UINode uiNode
-
nodeList
protected java.util.ArrayList nodeList
-
document
protected volatile org.w3c.dom.Document document
-
treeLock
protected volatile java.lang.Object treeLock
A tree lock is less deadlock-prone than a node-level lock. This is assigned in setOwnerDocument.
-
notificationsSuspended
protected volatile boolean notificationsSuspended
-
parentNode
protected volatile org.w3c.dom.Node parentNode
-
-
Method Detail
-
setUINode
public void setUINode(UINode uiNode)
-
getUINode
public UINode getUINode()
-
findUINode
public UINode findUINode()
Tries to get a UINode associated with the current node. Failing that, it tries ancestors recursively. This method will return the closest block-level renderer node, if any.
-
appendChild
public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMException- Specified by:
appendChildin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
removeAllChildren
protected void removeAllChildren()
-
removeAllChildrenImpl
protected void removeAllChildrenImpl()
-
getNodeList
protected org.w3c.dom.NodeList getNodeList(NodeFilter filter)
-
getChildrenArray
public NodeImpl[] getChildrenArray()
-
getChildren
public ChildHTMLCollection getChildren()
-
getDescendents
public java.util.ArrayList getDescendents(NodeFilter filter, boolean nestIntoMatchingNodes)
Creates anArrayListof descendent nodes that the given filter condition.
-
createSimilarNode
protected abstract org.w3c.dom.Node createSimilarNode()
Should create a node with some cloned properties, like the node name, but not attributes or children.
-
cloneNode
public org.w3c.dom.Node cloneNode(boolean deep)
- Specified by:
cloneNodein interfaceorg.w3c.dom.Node
-
compareDocumentPosition
public short compareDocumentPosition(org.w3c.dom.Node other) throws org.w3c.dom.DOMException- Specified by:
compareDocumentPositionin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
getAttributes
public org.w3c.dom.NamedNodeMap getAttributes()
- Specified by:
getAttributesin interfaceorg.w3c.dom.Node
-
getOwnerDocument
public org.w3c.dom.Document getOwnerDocument()
- Specified by:
getOwnerDocumentin interfaceorg.w3c.dom.Node
-
insertBefore
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException- Specified by:
insertBeforein interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
insertAt
protected org.w3c.dom.Node insertAt(org.w3c.dom.Node newChild, int idx) throws org.w3c.dom.DOMException- Throws:
org.w3c.dom.DOMException
-
replaceChild
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException- Specified by:
replaceChildin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
removeChild
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException- Specified by:
removeChildin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
removeChildAt
public org.w3c.dom.Node removeChildAt(int index) throws org.w3c.dom.DOMException- Throws:
org.w3c.dom.DOMException
-
hasChildNodes
public boolean hasChildNodes()
- Specified by:
hasChildNodesin interfaceorg.w3c.dom.Node
-
getBaseURI
public java.lang.String getBaseURI()
- Specified by:
getBaseURIin interfaceorg.w3c.dom.Node
-
getChildNodes
public org.w3c.dom.NodeList getChildNodes()
- Specified by:
getChildNodesin interfaceorg.w3c.dom.Node
-
getFirstChild
public org.w3c.dom.Node getFirstChild()
- Specified by:
getFirstChildin interfaceorg.w3c.dom.Node
-
getLastChild
public org.w3c.dom.Node getLastChild()
- Specified by:
getLastChildin interfaceorg.w3c.dom.Node
-
getPreviousSibling
public org.w3c.dom.Node getPreviousSibling()
- Specified by:
getPreviousSiblingin interfaceorg.w3c.dom.Node
-
getNextSibling
public org.w3c.dom.Node getNextSibling()
- Specified by:
getNextSiblingin interfaceorg.w3c.dom.Node
-
getFeature
public java.lang.Object getFeature(java.lang.String feature, java.lang.String version)- Specified by:
getFeaturein interfaceorg.w3c.dom.Node
-
setUserData
public java.lang.Object setUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)- Specified by:
setUserDatain interfaceorg.w3c.dom.Node
-
getUserData
public java.lang.Object getUserData(java.lang.String key)
- Specified by:
getUserDatain interfaceorg.w3c.dom.Node
-
getLocalName
public abstract java.lang.String getLocalName()
- Specified by:
getLocalNamein interfaceorg.w3c.dom.Node
-
hasAttributes
public boolean hasAttributes()
- Specified by:
hasAttributesin interfaceorg.w3c.dom.Node
-
getNamespaceURI
public java.lang.String getNamespaceURI()
- Specified by:
getNamespaceURIin interfaceorg.w3c.dom.Node
-
getNodeName
public abstract java.lang.String getNodeName()
- Specified by:
getNodeNamein interfaceorg.w3c.dom.Node
-
getNodeValue
public abstract java.lang.String getNodeValue() throws org.w3c.dom.DOMException- Specified by:
getNodeValuein interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
getPrefix
public java.lang.String getPrefix()
- Specified by:
getPrefixin interfaceorg.w3c.dom.Node
-
setPrefix
public void setPrefix(java.lang.String prefix) throws org.w3c.dom.DOMException- Specified by:
setPrefixin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
setNodeValue
public abstract void setNodeValue(java.lang.String nodeValue) throws org.w3c.dom.DOMException- Specified by:
setNodeValuein interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
getNodeType
public abstract short getNodeType()
- Specified by:
getNodeTypein interfaceorg.w3c.dom.Node
-
getTextContent
public java.lang.String getTextContent() throws org.w3c.dom.DOMExceptionGets the text content of this node and its descendents.- Specified by:
getTextContentin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
setTextContent
public void setTextContent(java.lang.String textContent) throws org.w3c.dom.DOMException- Specified by:
setTextContentin interfaceorg.w3c.dom.Node- Throws:
org.w3c.dom.DOMException
-
removeChildren
protected void removeChildren(NodeFilter filter)
-
removeChildrenImpl
protected void removeChildrenImpl(NodeFilter filter)
-
insertAfter
public org.w3c.dom.Node insertAfter(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
-
replaceAdjacentTextNodes
public org.w3c.dom.Text replaceAdjacentTextNodes(org.w3c.dom.Text node, java.lang.String textContent)
-
replaceAdjacentTextNodes
public org.w3c.dom.Text replaceAdjacentTextNodes(org.w3c.dom.Text node)
-
getParentNode
public org.w3c.dom.Node getParentNode()
- Specified by:
getParentNodein interfaceorg.w3c.dom.Node
-
isSameNode
public boolean isSameNode(org.w3c.dom.Node other)
- Specified by:
isSameNodein interfaceorg.w3c.dom.Node
-
isSupported
public boolean isSupported(java.lang.String feature, java.lang.String version)- Specified by:
isSupportedin interfaceorg.w3c.dom.Node
-
lookupNamespaceURI
public java.lang.String lookupNamespaceURI(java.lang.String prefix)
- Specified by:
lookupNamespaceURIin interfaceorg.w3c.dom.Node
-
equalAttributes
public boolean equalAttributes(org.w3c.dom.Node arg)
-
isEqualNode
public boolean isEqualNode(org.w3c.dom.Node arg)
- Specified by:
isEqualNodein interfaceorg.w3c.dom.Node
-
isDefaultNamespace
public boolean isDefaultNamespace(java.lang.String namespaceURI)
- Specified by:
isDefaultNamespacein interfaceorg.w3c.dom.Node
-
lookupPrefix
public java.lang.String lookupPrefix(java.lang.String namespaceURI)
- Specified by:
lookupPrefixin interfaceorg.w3c.dom.Node
-
normalize
public void normalize()
- Specified by:
normalizein interfaceorg.w3c.dom.Node
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getUserAgentContext
public UserAgentContext getUserAgentContext()
-
getHtmlRendererContext
public HtmlRendererContext getHtmlRendererContext()
-
getAlignmentX
public float getAlignmentX()
-
getAlignmentY
public float getAlignmentY()
-
getFullURL
public java.net.URL getFullURL(java.lang.String spec) throws java.net.MalformedURLException- Specified by:
getFullURLin interfaceModelNode- Throws:
java.net.MalformedURLException
-
getDocumentURL
public java.net.URL getDocumentURL()
-
getDocumentItem
public java.lang.Object getDocumentItem(java.lang.String name)
- Specified by:
getDocumentItemin interfaceModelNode
-
setDocumentItem
public void setDocumentItem(java.lang.String name, java.lang.Object value)Description copied from interface:ModelNodeSets a document item. A radio button, for example, can use this to set button group state.- Specified by:
setDocumentItemin interfaceModelNode
-
isEqualOrDescendentOf
public final boolean isEqualOrDescendentOf(ModelNode otherContext)
- Specified by:
isEqualOrDescendentOfin interfaceModelNode
-
getParentModelNode
public final ModelNode getParentModelNode()
- Specified by:
getParentModelNodein interfaceModelNode
-
warn
public void warn(java.lang.String message, java.lang.Throwable err)
-
warn
public void warn(java.lang.String message)
-
informSizeInvalid
public void informSizeInvalid()
-
informLookInvalid
public void informLookInvalid()
-
informPositionInvalid
public void informPositionInvalid()
-
informInvalid
public void informInvalid()
-
informStructureInvalid
public void informStructureInvalid()
-
informNodeLoaded
protected void informNodeLoaded()
-
informExternalScriptLoading
protected void informExternalScriptLoading()
-
informLayoutInvalid
public void informLayoutInvalid()
-
informDocumentInvalid
public void informDocumentInvalid()
-
getRenderState
public RenderState getRenderState()
- Specified by:
getRenderStatein interfaceModelNode
-
getParentRenderState
protected final RenderState getParentRenderState(java.lang.Object parent)
-
createRenderState
protected RenderState createRenderState(RenderState prevRenderState)
-
forgetRenderState
protected void forgetRenderState()
-
getInnerHTML
public java.lang.String getInnerHTML()
-
appendInnerHTMLImpl
protected void appendInnerHTMLImpl(java.lang.StringBuffer buffer)
-
htmlEncodeChildText
protected java.lang.String htmlEncodeChildText(java.lang.String text)
-
getInnerText
public java.lang.String getInnerText()
Attempts to convert the subtree starting at this point to a close text representation. BR elements are converted to line breaks, and so forth.
-
appendInnerTextImpl
protected void appendInnerTextImpl(java.lang.StringBuffer buffer)
-
-