- All Implemented Interfaces:
CSSDocument
,CSSNode
,Document
,Node
,DocumentStyle
CSS-enabled wrapper for a DOM Document
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSDocument
CSSDocument.ComplianceMode
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionappendChild
(Node newChild) cloneNode
(boolean deep) short
compareDocumentPosition
(Node other) createAttribute
(String name) createAttributeNS
(String namespaceURI, String qualifiedName) createCDATASection
(String data) createComment
(String data) createElement
(String tagName) Creates an element of the type specified.createElementNS
(String namespaceURI, String qualifiedName) createEntityReference
(String name) createProcessingInstruction
(String target, String data) createTextNode
(String data) void
Enables a style sheet set.Gets the base URL of this Document.Gets the document's canvas for the current target medium.Get the compatibility mode (compatMode
) attribute.Get the compliance mode of this document.protected CSSNode
getCSSNode
(Node node) Get the child node which is the document element of this document.getElementById
(String elementId) getElementsByTagName
(String tagname) getElementsByTagNameNS
(String namespaceURI, String localName) Gets the document-level error handler.getFeature
(String feature, String version) Gets the style sheet set that was last selected.protected CSSNode
getMappedCSSNode
(Node node) short
Get the referrer policy obtained through the 'Referrer-Policy' header or a meta element.Gets the title of the currently selected style sheet set.boolean
Gets the style database currently used to apply specific styles to this document.Gets the merged style sheet that applies to this document, resulting from the merge of the document's default style sheet, the document linked or embedded style sheets, and the non-important part of the user style sheet.protected abstract DOMCSSStyleSheetFactory
A list containing all the style sheets explicitly linked into or embedded in a document.Gets the list of available alternate styles.This document's current target medium name.Gets an URL for the given URI, taking into account the Base URL if appropriate.getUserData
(String key) boolean
boolean
boolean
boolean
Has any of the linked or embedded style sheets any error or warning ?importNode
(Node importedNode, boolean deep) insertBefore
(Node newChild, Node refChild) boolean
isAuthorizedOrigin
(URL url) Determine whether the retrieval of the given URL is authorized.boolean
isDefaultNamespace
(String namespaceURI) boolean
isEqualNode
(Node arg) boolean
isSafeOrigin
(URL linkedURL) Is the provided URL a safe origin to load certain external resources?boolean
isSameNode
(Node other) boolean
isSupported
(String feature, String version) boolean
isVisitedURI
(String href) Has this URI been visited by the agent ?lookupNamespaceURI
(String prefix) lookupPrefix
(String namespaceURI) void
void
void
Forces the cascade to be rebuilt the next time that a computed style is obtained.void
registerProperty
(CSSPropertyDefinition definition) Registers the definition of a custom property.removeChild
(Node oldChild) renameNode
(Node n, String namespaceURI, String qualifiedName) replaceChild
(Node newChild, Node oldChild) void
setDocumentURI
(String documentURI) abstract void
setLoadingTime
(long time) Set the time at which this document was loaded from origin.void
setNodeValue
(String nodeValue) void
protected void
setReferrerPolicyHeader
(String policy) void
Selects a style sheet set, disabling the other non-persistent sheet sets.void
setStrictErrorChecking
(boolean strictErrorChecking) void
setTargetMedium
(String medium) Set the medium that will be used to compute the styles of this document.void
setTextContent
(String textContent) setUserData
(String key, Object data, UserDataHandler handler) void
setXmlStandalone
(boolean xmlStandalone) void
setXmlVersion
(String xmlVersion) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.sf.carte.doc.style.css.CSSDocument
openConnection
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getAttributes, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Field Details
-
rawnode
-
-
Constructor Details
-
StylableDocumentWrapper
-
-
Method Details
-
getStyleSheetFactory
-
getCompatMode
Get the compatibility mode (compatMode
) attribute.- Specified by:
getCompatMode
in interfaceCSSDocument
- Returns:
- the string "BackCompat" if document’s mode is
QUIRKS
, otherwise "CSS1Compat".
-
getComplianceMode
Description copied from interface:CSSDocument
Get the compliance mode of this document.The styling in this document operate under a compliance mode. Two modes are supported:
STRICT
andQUIRKS
.QUIRKS
andSTRICT
differ in the matching of class and ID selectors, and the default user agent sheet is slightly different.- Specified by:
getComplianceMode
in interfaceCSSDocument
- Returns:
- the compliance mode.
-
getOwnerDocument
Description copied from interface:CSSNode
- Specified by:
getOwnerDocument
in interfaceCSSNode
- Specified by:
getOwnerDocument
in interfaceNode
-
getMappedCSSNode
-
getCSSNode
-
getDoctype
- Specified by:
getDoctype
in interfaceDocument
-
getImplementation
- Specified by:
getImplementation
in interfaceDocument
-
isVisitedURI
Description copied from interface:CSSDocument
Has this URI been visited by the agent ?- Specified by:
isVisitedURI
in interfaceCSSDocument
- Parameters:
href
- the URI.- Returns:
true
if visited,false
if not visited or the agent does not support history.
-
setLoadingTime
public abstract void setLoadingTime(long time) Set the time at which this document was loaded from origin.- Parameters:
time
- the time of loading, in milliseconds.
-
getDocumentElement
Description copied from interface:CSSDocument
Get the child node which is the document element of this document.- Specified by:
getDocumentElement
in interfaceCSSDocument
- Specified by:
getDocumentElement
in interfaceDocument
- Returns:
- the document element.
-
createElement
Description copied from interface:CSSDocument
Creates an element of the type specified.The presence of
IMPLIED
attributes is implementation-dependent.- Specified by:
createElement
in interfaceCSSDocument
- Specified by:
createElement
in interfaceDocument
- Parameters:
tagName
- the tag name of the element to create.- Returns:
- the new
CSSElement
. - Throws:
DOMException
- INVALID_CHARACTER_ERR if the name is not an XML valid name.
-
createDocumentFragment
- Specified by:
createDocumentFragment
in interfaceDocument
-
createTextNode
- Specified by:
createTextNode
in interfaceDocument
-
createComment
- Specified by:
createComment
in interfaceDocument
-
createCDATASection
- Specified by:
createCDATASection
in interfaceDocument
- Throws:
DOMException
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException - Specified by:
createProcessingInstruction
in interfaceDocument
- Throws:
DOMException
-
createAttribute
- Specified by:
createAttribute
in interfaceDocument
- Throws:
DOMException
-
createEntityReference
- Specified by:
createEntityReference
in interfaceDocument
- Throws:
DOMException
-
importNode
- Specified by:
importNode
in interfaceDocument
- Throws:
DOMException
-
createElementNS
Description copied from interface:CSSDocument
- Specified by:
createElementNS
in interfaceCSSDocument
- Specified by:
createElementNS
in interfaceDocument
- Throws:
DOMException
-
createAttributeNS
- Specified by:
createAttributeNS
in interfaceDocument
- Throws:
DOMException
-
getElementsByTagName
- Specified by:
getElementsByTagName
in interfaceDocument
-
getElementsByTagNameNS
- Specified by:
getElementsByTagNameNS
in interfaceDocument
-
getElementById
Description copied from interface:CSSDocument
- Specified by:
getElementById
in interfaceCSSDocument
- Specified by:
getElementById
in interfaceDocument
-
getInputEncoding
- Specified by:
getInputEncoding
in interfaceDocument
-
getXmlEncoding
- Specified by:
getXmlEncoding
in interfaceDocument
-
getXmlStandalone
public boolean getXmlStandalone()- Specified by:
getXmlStandalone
in interfaceDocument
-
setXmlStandalone
- Specified by:
setXmlStandalone
in interfaceDocument
- Throws:
DOMException
-
getXmlVersion
- Specified by:
getXmlVersion
in interfaceDocument
-
setXmlVersion
- Specified by:
setXmlVersion
in interfaceDocument
- Throws:
DOMException
-
getStrictErrorChecking
public boolean getStrictErrorChecking()- Specified by:
getStrictErrorChecking
in interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking) - Specified by:
setStrictErrorChecking
in interfaceDocument
-
getDocumentURI
- Specified by:
getDocumentURI
in interfaceDocument
-
setDocumentURI
- Specified by:
setDocumentURI
in interfaceDocument
-
adoptNode
- Specified by:
adoptNode
in interfaceDocument
- Throws:
DOMException
-
cloneNode
-
getDomConfig
- Specified by:
getDomConfig
in interfaceDocument
-
normalizeDocument
public void normalizeDocument()- Specified by:
normalizeDocument
in interfaceDocument
-
renameNode
- Specified by:
renameNode
in interfaceDocument
- Throws:
DOMException
-
registerProperty
Description copied from interface:CSSDocument
Registers the definition of a custom property.- Specified by:
registerProperty
in interfaceCSSDocument
- Parameters:
definition
- the definition.- See Also:
-
getStyleSheets
A list containing all the style sheets explicitly linked into or embedded in a document. For HTML documents, this includes external style sheets, included via the HTML LINK element, and inline STYLE elements. In XML, this includes external style sheets, included via style sheet processing instructions (see [XML StyleSheet]).- Specified by:
getStyleSheets
in interfaceCSSDocument
- Specified by:
getStyleSheets
in interfaceDocumentStyle
-
getStyleSheet
Gets the merged style sheet that applies to this document, resulting from the merge of the document's default style sheet, the document linked or embedded style sheets, and the non-important part of the user style sheet. Does not include overriden styles nor the 'important' part of the user-defined style sheet.The style sheet is lazily built.
- Specified by:
getStyleSheet
in interfaceCSSDocument
- Returns:
- the merged style sheet that applies to this document.
-
getStyleSheetSets
Gets the list of available alternate styles.- Specified by:
getStyleSheetSets
in interfaceCSSDocument
- Returns:
- the list of available alternate style titles.
-
getSelectedStyleSheetSet
Gets the title of the currently selected style sheet set.- Specified by:
getSelectedStyleSheetSet
in interfaceCSSDocument
- Returns:
- the title of the currently selected style sheet, the empty string
if none is selected, or
null
if there are style sheets from different style sheet sets that have their style sheet disabled flag unset.
-
setSelectedStyleSheetSet
Selects a style sheet set, disabling the other non-persistent sheet sets. If the name is the empty string, all non-persistent sheets will be disabled. Otherwise, if the name does not match any of the sets, does nothing.- Specified by:
setSelectedStyleSheetSet
in interfaceCSSDocument
- Parameters:
name
- the case-sensitive name of the set to select.
-
getLastStyleSheetSet
Gets the style sheet set that was last selected.- Specified by:
getLastStyleSheetSet
in interfaceCSSDocument
- Returns:
- the last selected style sheet set, or
null
if none.
-
enableStyleSheetsForSet
Enables a style sheet set. If the name does not match any of the sets, does nothing.- Specified by:
enableStyleSheetsForSet
in interfaceCSSDocument
- Parameters:
name
- the case-sensitive name of the set to enable.
-
getStyleDatabase
Gets the style database currently used to apply specific styles to this document.- Specified by:
getStyleDatabase
in interfaceCSSDocument
- Returns:
- the style database, or null if no style database has been selected.
-
getTargetMedium
This document's current target medium name.- Specified by:
getTargetMedium
in interfaceCSSDocument
- Returns:
- the target medium name of this document.
-
setTargetMedium
Set the medium that will be used to compute the styles of this document.- Specified by:
setTargetMedium
in interfaceCSSDocument
- Parameters:
medium
- the name of the target medium, like 'screen' or 'print'.- Throws:
CSSMediaException
- if the document is unable to target the given medium.
-
getCanvas
Gets the document's canvas for the current target medium.- Specified by:
getCanvas
in interfaceCSSDocument
- Returns:
- the canvas, or null if no target medium has been set, or the DeviceFactory does not support canvas for the target medium.
-
rebuildCascade
public void rebuildCascade()Description copied from interface:CSSDocument
Forces the cascade to be rebuilt the next time that a computed style is obtained.This method should be called after you modify the styles in a way that is not detected by the library (like modifying a value).
- Specified by:
rebuildCascade
in interfaceCSSDocument
-
getErrorHandler
Description copied from interface:CSSDocument
Gets the document-level error handler.- Specified by:
getErrorHandler
in interfaceCSSDocument
- Returns:
- the error handler.
-
hasStyleIssues
public boolean hasStyleIssues()Has any of the linked or embedded style sheets any error or warning ?- Specified by:
hasStyleIssues
in interfaceCSSDocument
- Returns:
true
if any of the linked or embedded style sheets has any NSAC or rule error or warning,false
otherwise.
-
getBaseURL
Gets the base URL of this Document.If the Document's
head
element has abase
child element, the base URI is computed using the value of the href attribute of thebase
element. Otherwise, it is taken from the value of thegetDocumentURI
method.- Specified by:
getBaseURL
in interfaceCSSDocument
- Returns:
- the base URL, or null if no base URL could be determined.
-
getBaseURI
- Specified by:
getBaseURI
in interfaceNode
-
getURL
Gets an URL for the given URI, taking into account the Base URL if appropriate.- Specified by:
getURL
in interfaceCSSDocument
- Parameters:
uri
- the uri.- Returns:
- the absolute URL.
- Throws:
MalformedURLException
- if the uri was wrong.
-
isSafeOrigin
Is the provided URL a safe origin to load certain external resources?- Specified by:
isSafeOrigin
in interfaceCSSDocument
- Parameters:
linkedURL
- the URL of the external resource.- Returns:
true
if is a safe origin,false
otherwise.
-
isAuthorizedOrigin
Determine whether the retrieval of the given URL is authorized.If the URL's protocol is not
http
norhttps
and document's base URL's scheme is neitherfile
norjar
, it is denied.- Specified by:
isAuthorizedOrigin
in interfaceCSSDocument
- Parameters:
url
- the URL to check.- Returns:
true
if allowed.
-
getReferrerPolicy
Get the referrer policy obtained through the 'Referrer-Policy' header or a meta element.- Specified by:
getReferrerPolicy
in interfaceCSSDocument
- Returns:
- the referrer policy, or the empty string if none was specified.
-
setReferrerPolicyHeader
-
getNodeName
- Specified by:
getNodeName
in interfaceNode
-
getNodeValue
- Specified by:
getNodeValue
in interfaceNode
- Throws:
DOMException
-
setNodeValue
- Specified by:
setNodeValue
in interfaceNode
- Throws:
DOMException
-
getNodeType
public short getNodeType()- Specified by:
getNodeType
in interfaceNode
-
getParentNode
- Specified by:
getParentNode
in interfaceNode
-
getChildNodes
- Specified by:
getChildNodes
in interfaceNode
-
getFirstChild
- Specified by:
getFirstChild
in interfaceNode
-
getLastChild
- Specified by:
getLastChild
in interfaceNode
-
getPreviousSibling
- Specified by:
getPreviousSibling
in interfaceNode
-
getNextSibling
- Specified by:
getNextSibling
in interfaceNode
-
getAttributes
- Specified by:
getAttributes
in interfaceNode
-
insertBefore
- Specified by:
insertBefore
in interfaceNode
- Throws:
DOMException
-
replaceChild
- Specified by:
replaceChild
in interfaceNode
- Throws:
DOMException
-
removeChild
- Specified by:
removeChild
in interfaceNode
- Throws:
DOMException
-
appendChild
- Specified by:
appendChild
in interfaceNode
- Throws:
DOMException
-
hasChildNodes
public boolean hasChildNodes()- Specified by:
hasChildNodes
in interfaceNode
-
normalize
public void normalize() -
isSupported
- Specified by:
isSupported
in interfaceNode
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceNode
-
getPrefix
-
setPrefix
- Specified by:
setPrefix
in interfaceNode
- Throws:
DOMException
-
getLocalName
- Specified by:
getLocalName
in interfaceNode
-
hasAttributes
public boolean hasAttributes()- Specified by:
hasAttributes
in interfaceNode
-
compareDocumentPosition
- Specified by:
compareDocumentPosition
in interfaceNode
- Throws:
DOMException
-
getTextContent
- Specified by:
getTextContent
in interfaceNode
- Throws:
DOMException
-
setTextContent
- Specified by:
setTextContent
in interfaceNode
- Throws:
DOMException
-
isSameNode
- Specified by:
isSameNode
in interfaceNode
-
lookupPrefix
- Specified by:
lookupPrefix
in interfaceNode
-
isDefaultNamespace
- Specified by:
isDefaultNamespace
in interfaceNode
-
lookupNamespaceURI
- Specified by:
lookupNamespaceURI
in interfaceNode
-
isEqualNode
- Specified by:
isEqualNode
in interfaceNode
-
getFeature
- Specified by:
getFeature
in interfaceNode
-
setUserData
- Specified by:
setUserData
in interfaceNode
-
getUserData
- Specified by:
getUserData
in interfaceNode
-