Class HTMLDocumentImpl
java.lang.Object
org.loboevolution.js.AbstractScriptableDelegate
org.loboevolution.html.dom.nodeimpl.event.EventTargetImpl
org.loboevolution.html.dom.nodeimpl.NodeImpl
org.loboevolution.html.dom.nodeimpl.DocumentImpl
org.loboevolution.html.dom.domimpl.HTMLDocumentImpl
- All Implemented Interfaces:
Cloneable
,EventTarget
,HTMLDocument
,ModelNode
,Document
,Node
,NonElementParentNode
,ParentNode
,DocumentRange
,XPathEvaluator
,ScriptableDelegate
,DocumentTraversal
,DocumentView
Implementation of the W3C HTMLDocument interface.
-
Field Summary
Fields inherited from class org.loboevolution.html.dom.nodeimpl.DocumentImpl
reader
Fields inherited from class org.loboevolution.html.dom.nodeimpl.NodeImpl
document, nodeList, notificationsSuspended, parentNode, uiNode
Fields inherited from interface org.loboevolution.html.node.Document
HTML_NAMESPACE_URI, NAMESPACE_SVG, XML_NAMESPACE_URI, XMLNS_NAMESPACE_URI
Fields inherited from interface org.loboevolution.html.node.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, NONE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
ConstructorDescriptionHTMLDocumentImpl
(HtmlRendererContext rcontext) Constructor for HTMLDocumentImpl.HTMLDocumentImpl
(UserAgentContext ucontext) Constructor for HTMLDocumentImpl.HTMLDocumentImpl
(UserAgentContext ucontext, HtmlRendererContext rcontext, HtmlRendererConfig config, WritableLineReader reader, String documentURI) Constructor for HTMLDocumentImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a document notification listener, which is informed about changes to the document.void
Informs listeners that the whole document has been invalidated.void
allInvalidated
(boolean forgetRenderStates) allInvalidated.protected RenderState
createRenderState
(RenderState prevRenderState) createRenderState.void
externalScriptLoading.Returns node's node document's document base URL.getBody()
Specifies the beginning and end of the document body.Returns document's encoding.Gets or sets the character set used to encode the object.Returns the HTTP cookies that apply to the Document.getDocumentURL.final URL
getFullURL
(String uri) getFullURL.final URL
getFullURL
(String relativeUrl, String baseURI) getFullURL.getHead()
Returns the head element.final HtmlRendererContext
getHtmlRendererContext.Returns the character encoding used to create the webpage that is loaded into the document object.Getter for the field styleSheets.getTextContent.getURL()
Sets or gets the URL for the current document.getUserAgentContext.void
invalidated
(NodeImpl node) This is called when the node has changed, but it is unclear if it's a size change or a look change.void
load()
Loads the document from the reader provided when the current instance of HTMLDocumentImpl was constructed.void
lookInvalidated
(NodeImpl node) Called if something such as a color or decoration has changed.namedItem.void
nodeLoaded
(NodeImpl node) nodeLoaded.void
normalizeDocument.void
Changed if the position of the node in a parent has changed.void
removeDocumentNotificationListener.void
removeNamedItem
(String name) void
setBody
(HTMLElement body) setBody.void
setCookie.void
setElementById
(String id, Element element) Caller should synchronize on document.void
setNamedItem
(String name, Element element) void
setTextContent
(String textContent) setTextContent.setUserData
(String key, Object data, UserDataHandler handler) setUserData.void
sizeInvalidated
(NodeImpl node) sizeInvalidated.void
structureInvalidated
(NodeImpl node) This is called when children of the node might have changed.Methods inherited from class org.loboevolution.html.dom.nodeimpl.DocumentImpl
adoptNode, caretRangeFromPoint, clear, close, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createElementNS, createEntityReference, createEvent, createExpression, createExpression, createNodeIterator, createNodeIterator, createNodeIterator, createNodeIterator, createNSResolver, createProcessingInstruction, createRange, createTextNode, createTreeWalker, createTreeWalker, createTreeWalker, createTreeWalker, elementFromPoint, evaluate, execCommand, execCommand, execCommand, getActiveElement, getall, getAnchors, getApplets, getBgColor, getChildElementCount, getCommands, getCompatMode, getContentType, getCurrentScript, getDefaultView, getDesignMode, getDir, getDoctype, getDocumentElement, getDocumentURI, getDomain, getDomConfig, getElementById, getElementsByClassName, getElementsByName, getElementsByTagName, getElementsByTagNameNS, getEmbeds, getFgColor, getFirstElementChild, getForms, getImages, getImplementation, getLastElementChild, getLastModified, getLinks, getLocalName, getLocation, getNodeName, getNodeType, getNodeValue, getOrigin, getPlugins, getReadyState, getScripts, getScrollingElement, getSelection, getStrictErrorChecking, getTitle, getVisibilityState, getXmlEncoding, getXmlStandalone, getXmlVersion, hasAttributes, hasFocus, importNode, isFullscreen, isFullscreenEnabled, isHidden, isXml, open, open, open, open, open, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue, querySelector, querySelectorAll, releaseEvents, removeAllChildrenImpl, renameNode, setBgColor, setDesignMode, setDir, setDoctype, setDocumentURI, setDomain, setFgColor, setLocation, setNodeValue, setStrictErrorChecking, setTitle, setWindow, setXml, setXmlStandalone, setXmlVersion, write, writeln
Methods inherited from class org.loboevolution.html.dom.nodeimpl.NodeImpl
appendChild, appendInnerHTMLImpl, appendInnerTextImpl, clone, cloneNode, cloneNode, compareDocumentPosition, contains, findUINode, forgetRenderState, getATTRIBUTE_NODE, getAttributes, getCDATA_SECTION_NODE, getChildIndex, getChildNodes, getChildren, getCOMMENT_NODE, getDescendents, getDOCUMENT_FRAGMENT_NODE, getDOCUMENT_NODE, getDOCUMENT_POSITION_CONTAINED_BY, getDOCUMENT_POSITION_CONTAINS, getDOCUMENT_POSITION_DISCONNECTED, getDOCUMENT_POSITION_FOLLOWING, getDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, getDOCUMENT_POSITION_PRECEDING, getDOCUMENT_TYPE_NODE, getDocumentItem, getDocumentNode, getELEMENT_NODE, getENTITY_NODE, getENTITY_REFERENCE_NODE, getFeature, getFirstChild, getFirstChildByFilter, getHtmlRendererConfig, getLastChild, getNamespaceURI, getNextElementSibling, getNextSibling, getNodeList, getNONE, getNOTATION_NODE, getOwnerDocument, getParentElement, getParentModelNode, getParentNode, getParentRenderState, getPrefix, getPreviousElementSibling, getPreviousSibling, getPROCESSING_INSTRUCTION_NODE, getRenderState, getRootNode, getTEXT_NODE, getUINode, getUserData, hasChildNodes, htmlEncodeChildText, informInvalid, informLayoutInvalid, informLookInvalid, informNodeLoaded, informPositionInvalid, informSizeInvalid, informStructureInvalid, insertAfter, insertAt, insertBefore, isDefaultNamespace, isEqualNode, isEqualOrDescendentOf, isIsConnected, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, prepend, prependChild, removeChild, removeChildAt, removeChildrenImpl, removeTableChildren, replaceAdjacentTextNodes, replaceChild, setDocumentItem, setOwnerDocument, setOwnerDocument, setParentImpl, setPrefix, setUINode, toString, visit, visitImpl, warn, warn
Methods inherited from class org.loboevolution.html.dom.nodeimpl.event.EventTargetImpl
addEventListener, addEventListener, dispatchEvent, dispatchEvent, getFunction, removeEventListener, removeEventListener
Methods inherited from class org.loboevolution.js.AbstractScriptableDelegate
getScriptable, setScriptable
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.loboevolution.html.node.Document
adoptNode, caretRangeFromPoint, clear, close, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createElementNS, createEntityReference, createEvent, createExpression, createNSResolver, createProcessingInstruction, createTextNode, elementFromPoint, evaluate, execCommand, execCommand, execCommand, getActiveElement, getall, getAnchors, getApplets, getBgColor, getCommands, getCompatMode, getContentType, getCurrentScript, getDefaultView, getDesignMode, getDir, getDoctype, getDocumentElement, getDocumentURI, getDomain, getDomConfig, getElementById, getElementsByClassName, getElementsByName, getElementsByTagName, getElementsByTagNameNS, getEmbeds, getFgColor, getForms, getImages, getImplementation, getLastModified, getLinks, getLocation, getOrigin, getPlugins, getReadyState, getReferrer, getScripts, getScrollingElement, getSelection, getStrictErrorChecking, getTitle, getVisibilityState, getXmlEncoding, getXmlStandalone, getXmlVersion, hasFocus, importNode, isFullscreen, isFullscreenEnabled, isHidden, isXml, open, open, open, open, open, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue, releaseEvents, renameNode, setBgColor, setDesignMode, setDir, setDocumentURI, setDomain, setFgColor, setLocation, setStrictErrorChecking, setTitle, setXml, setXmlStandalone, setXmlVersion, write, writeln
Methods inherited from interface org.loboevolution.html.node.ranges.DocumentRange
createRange
Methods inherited from interface org.loboevolution.traversal.DocumentTraversal
createNodeIterator, createNodeIterator, createNodeIterator, createNodeIterator, createTreeWalker, createTreeWalker, createTreeWalker, createTreeWalker
Methods inherited from interface org.loboevolution.views.DocumentView
getDefaultView
Methods inherited from interface org.loboevolution.events.EventTarget
addEventListener, addEventListener, dispatchEvent, dispatchEvent, removeEventListener, removeEventListener
Methods inherited from interface org.loboevolution.html.node.Node
appendChild, cloneNode, cloneNode, compareDocumentPosition, contains, getAttributes, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getRootNode, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isIsConnected, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, prepend, prependChild, removeChild, replaceChild, setNodeValue, setOwnerDocument, setPrefix
Methods inherited from interface org.loboevolution.html.node.ParentNode
getChildElementCount, getChildren, getFirstElementChild, getLastElementChild, querySelector, querySelectorAll
-
Constructor Details
-
HTMLDocumentImpl
Constructor for HTMLDocumentImpl.
- Parameters:
rcontext
- aHtmlRendererContext
object.
-
HTMLDocumentImpl
Constructor for HTMLDocumentImpl.
- Parameters:
ucontext
- aUserAgentContext
object.
-
HTMLDocumentImpl
public HTMLDocumentImpl(UserAgentContext ucontext, HtmlRendererContext rcontext, HtmlRendererConfig config, WritableLineReader reader, String documentURI) Constructor for HTMLDocumentImpl.
- Parameters:
ucontext
- aUserAgentContext
object.rcontext
- aHtmlRendererContext
object.config
- aHtmlRendererConfig
object.reader
- aWritableLineReader
object.documentURI
- aString
object.
-
-
Method Details
-
addDocumentNotificationListener
Adds a document notification listener, which is informed about changes to the document.- Parameters:
listener
- An instance ofDocumentNotificationListener
.
-
allInvalidated
public void allInvalidated()Informs listeners that the whole document has been invalidated. -
allInvalidated
public void allInvalidated(boolean forgetRenderStates) allInvalidated.
- Parameters:
forgetRenderStates
- a boolean.
-
createRenderState
createRenderState.
- Overrides:
createRenderState
in classNodeImpl
- Parameters:
prevRenderState
- aRenderState
object.- Returns:
- a
RenderState
object.
-
externalScriptLoading
externalScriptLoading.
- Parameters:
node
- aNodeImpl
object.
-
getBaseURI
Returns node's node document's document base URL.- Specified by:
getBaseURI
in interfaceNode
- Overrides:
getBaseURI
in classDocumentImpl
- Returns:
- a
String
object.
-
getCookie
Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned.Can be set, to add a new cookie to the element's set of HTTP cookies.
If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting.
- Specified by:
getCookie
in interfaceDocument
- Overrides:
getCookie
in classDocumentImpl
- Returns:
- a
String
object.
-
getDocumentURL
getDocumentURL.
- Overrides:
getDocumentURL
in classNodeImpl
- Returns:
- a
URL
object.
-
getFullURL
getFullURL.
- Specified by:
getFullURL
in interfaceModelNode
- Overrides:
getFullURL
in classNodeImpl
- Parameters:
uri
- aString
object.- Returns:
- a
URL
object.
-
getFullURL
getFullURL.
-
getHtmlRendererContext
getHtmlRendererContext.
- Overrides:
getHtmlRendererContext
in classNodeImpl
- Returns:
- a
HtmlRendererContext
object.
-
getInputEncoding
Returns the character encoding used to create the webpage that is loaded into the document object.- Specified by:
getInputEncoding
in interfaceDocument
- Overrides:
getInputEncoding
in classDocumentImpl
- Returns:
- a
String
object.
-
getCharacterSet
Returns document's encoding.- Specified by:
getCharacterSet
in interfaceDocument
- Overrides:
getCharacterSet
in classDocumentImpl
- Returns:
- a
String
object.
-
getCharset
Gets or sets the character set used to encode the object.- Specified by:
getCharset
in interfaceDocument
- Overrides:
getCharset
in classDocumentImpl
- Returns:
- a
String
object.
-
getHead
Returns the head element.- Specified by:
getHead
in interfaceDocument
- Overrides:
getHead
in classDocumentImpl
- Returns:
- a
HTMLHeadElement
object.
-
getBody
Specifies the beginning and end of the document body.- Specified by:
getBody
in interfaceDocument
- Overrides:
getBody
in classDocumentImpl
- Returns:
- a
HTMLElement
object.
-
getStyleSheets
Getter for the field styleSheets.
- Returns:
- a
StyleSheetList
object.
-
getTextContent
getTextContent.
Gets the text content of this node and its descendents.- Specified by:
getTextContent
in interfaceNode
- Overrides:
getTextContent
in classNodeImpl
- Returns:
- a
String
object.
-
getURL
Sets or gets the URL for the current document.- Specified by:
getURL
in interfaceDocument
- Overrides:
getURL
in classDocumentImpl
- Returns:
- a
String
object.
-
getUserAgentContext
getUserAgentContext.
- Overrides:
getUserAgentContext
in classNodeImpl
- Returns:
- a
UserAgentContext
object.
-
invalidated
This is called when the node has changed, but it is unclear if it's a size change or a look change. An attribute change should trigger this.- Parameters:
node
- aNodeImpl
object.
-
load
Loads the document from the reader provided when the current instance of HTMLDocumentImpl was constructed.- Throws:
IOException
- if any.SAXException
- if any.UnsupportedEncodingException
- if any.
-
lookInvalidated
Called if something such as a color or decoration has changed. This would be something which does not affect the rendered size, and can be revalidated with a simple repaint.- Parameters:
node
- aNodeImpl
object.
-
namedItem
namedItem.
-
nodeLoaded
nodeLoaded.
- Parameters:
node
- aNodeImpl
object.
-
normalizeDocument
public void normalizeDocument()normalizeDocument.
- Specified by:
normalizeDocument
in interfaceDocument
- Overrides:
normalizeDocument
in classDocumentImpl
-
positionInParentInvalidated
Changed if the position of the node in a parent has changed.- Parameters:
node
- aNodeImpl
object.
-
removeDocumentNotificationListener
removeDocumentNotificationListener.
- Parameters:
listener
- aDocumentNotificationListener
object.
-
removeNamedItem
-
setBody
setBody.
- Specified by:
setBody
in interfaceDocument
- Overrides:
setBody
in classDocumentImpl
- Parameters:
body
- aHTMLElement
object.
-
setCookie
setCookie.
- Specified by:
setCookie
in interfaceDocument
- Overrides:
setCookie
in classDocumentImpl
- Parameters:
cookie
- aString
object.
-
setElementById
Caller should synchronize on document. -
setNamedItem
-
setTextContent
setTextContent.
- Specified by:
setTextContent
in interfaceNode
- Overrides:
setTextContent
in classNodeImpl
- Parameters:
textContent
- aString
object.
-
setUserData
setUserData.
- Specified by:
setUserData
in interfaceNode
- Overrides:
setUserData
in classNodeImpl
- Parameters:
key
- aString
object.data
- aObject
object.handler
- aUserDataHandler
object.- Returns:
- a
Object
object.
-
sizeInvalidated
sizeInvalidated.
- Parameters:
node
- aNodeImpl
object.
-
structureInvalidated
This is called when children of the node might have changed.- Parameters:
node
- aNodeImpl
object.
-