- All Implemented Interfaces:
CSSStyleSheetFactory,Serializable
Allows the creation of stand-alone style sheets; also provides a method
(createCSSDocument(Document)) to wrap any DOM Document into a
CSSDocument, and access to an implementation of
UserAgent based on those wrapped documents.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface io.sf.carte.doc.style.css.CSSStyleSheetFactory
FLAG_STRING_DOUBLE_QUOTE, FLAG_STRING_SINGLE_QUOTE, ORIGIN_AUTHOR, ORIGIN_USER, ORIGIN_USER_AGENT, ORIGIN_USER_IMPORTANT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a style declaration for an anonymous inline box, associated to a text/cdata node.createCSSDocument(Document document) Wrap a DOM document with a CSS-enabled wrapper that allows styles to be computed.protected DOMDocumentCSSStyleSheetcreateDocumentStyleSheet(int origin) Creates a Document CSS style sheet for all media.protected EntityResolverprotected InlineStylecreateInlineStyle(Node owner) Create an inline style.protected BaseCSSStyleSheetcreateLinkedStyleSheet(Node ownerNode, String title, MediaQueryList mediaList) Creates an author (document-linked) CSS style sheet.protected DOMCSSStyleSheetcreateRuleStyleSheet(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Creates a CSS style sheet owned by a CSS rule.protected BaseDocumentCSSStyleSheetGet the style sheet resulting from the merge of the user agent sheet and the non-important part of the user style sheet.Gets a lazily instantiated user agent, appropriate to retrieve resources.Gets the User Agent default CSS style sheet to be used by this factory.voidSets a default HTML default style sheet as the user agent style sheet.Methods inherited from class io.sf.carte.doc.style.css.om.BaseCSSStyleSheetFactory
createDefaultStyleFormattingFactory, createImmutableMediaQueryList, createInlineStyleErrorHandler, createMediaQueryList, createPropertyDefinition, createSACParser, createSheetErrorHandler, createStyleDeclarationErrorHandler, createStyleSheet, getDeviceFactory, getParserFlags, getStyleFormattingFactory, getSystemDefaultValue, getUserImportantStyleSheet, getUserNormalStyleSheet, getValueFactory, hasCompatValueFlags, hasFactoryFlag, htmlDefaultSheet, htmlQuirksDefaultSheet, setClassLoader, setDeviceFactory, setFactoryFlag, setFlag, setLenientSystemValues, setStyleFormattingFactory, setUserStyleSheet, setUserStyleSheet, unsetFlag
-
Constructor Details
-
DOMCSSStyleSheetFactory
public DOMCSSStyleSheetFactory() -
DOMCSSStyleSheetFactory
-
-
Method Details
-
createDocumentStyleSheet
Description copied from class:BaseCSSStyleSheetFactoryCreates a Document CSS style sheet for all media.- Specified by:
createDocumentStyleSheetin classBaseCSSStyleSheetFactory- Parameters:
origin- the origin of the sheet (likeauthor,user agent, etc.)- Returns:
- the style sheet.
-
createRuleStyleSheet
protected DOMCSSStyleSheet createRuleStyleSheet(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Description copied from class:BaseCSSStyleSheetFactoryCreates a CSS style sheet owned by a CSS rule.- Specified by:
createRuleStyleSheetin classBaseCSSStyleSheetFactory- Parameters:
ownerRule- the owner rule.title- the advisory title.mediaList- the list of target media for style.- Returns:
- the style sheet.
-
createLinkedStyleSheet
protected BaseCSSStyleSheet createLinkedStyleSheet(Node ownerNode, String title, MediaQueryList mediaList) Description copied from class:AbstractCSSStyleSheetFactoryCreates an author (document-linked) CSS style sheet.- Specified by:
createLinkedStyleSheetin classAbstractCSSStyleSheetFactory- Parameters:
ownerNode- the node that associates the style sheet to the document. In HTML it can be alinkorstyleelement. For style sheets that are included by other style sheets, the value of this parameter isnull.title- the advisory title.mediaList- the target media list for style.- Returns:
- the style sheet.
-
getUserAgentStyleSheet
Gets the User Agent default CSS style sheet to be used by this factory.This implementation does not support !important rules in the user agent style sheet, as that support would imply some overhead that is unnecessary with the usual user agent sheets.
The sheet will be appropriately merged with the non-important part of the user-preference style sheet to provide the document's default sheet.
- Parameters:
mode- the compliance mode.- Returns:
- the default style sheet, or an empty sheet if no User Agent sheet was defined.
-
getDefaultStyleSheet
Description copied from class:AbstractCSSStyleSheetFactoryGet the style sheet resulting from the merge of the user agent sheet and the non-important part of the user style sheet.- Specified by:
getDefaultStyleSheetin classAbstractCSSStyleSheetFactory- Parameters:
mode- the compliance mode.- Returns:
- the default style sheet at the top of the cascade.
-
setDefaultHTMLUserAgentSheet
public void setDefaultHTMLUserAgentSheet()Description copied from class:AbstractCSSStyleSheetFactorySets a default HTML default style sheet as the user agent style sheet.The sheet will be appropriately merged with the non-important part of the user-preference style sheet to provide the document's default sheet.
- Specified by:
setDefaultHTMLUserAgentSheetin interfaceCSSStyleSheetFactory- Specified by:
setDefaultHTMLUserAgentSheetin classAbstractCSSStyleSheetFactory
-
getUserAgent
Gets a lazily instantiated user agent, appropriate to retrieve resources.It reads XML documents with a DocumentBuilder that can be set with
DOMCSSStyleSheetFactory.WrapperUserAgent.setDocumentBuilder(DocumentBuilder)and wraps them with CSS capabilities.- Returns:
- the user agent.
-
createCSSDocument
Wrap a DOM document with a CSS-enabled wrapper that allows styles to be computed.The resulting document is read-only, and does not apply non-CSS presentational hints.
- Parameters:
document- the document to wrap.- Returns:
- the CSS-enabled document wrapper.
-
createAnonymousStyleDeclaration
Description copied from interface:CSSStyleSheetFactoryCreate a style declaration for an anonymous inline box, associated to a text/cdata node.- Specified by:
createAnonymousStyleDeclarationin interfaceCSSStyleSheetFactory- Specified by:
createAnonymousStyleDeclarationin classAbstractCSSStyleSheetFactory- Parameters:
node- the node that has the declaration associated to it.- Returns:
- the anonymous style declaration.
-
createInlineStyle
Description copied from class:AbstractCSSStyleSheetFactoryCreate an inline style.- Specified by:
createInlineStylein classAbstractCSSStyleSheetFactory- Parameters:
owner- the style's owner node (an attribute node).- Returns:
- the inline style.
-
createEntityResolver
-