- All Implemented Interfaces:
CSSStyleSheetFactory
- Direct Known Subclasses:
CSSDOMImplementation
,DOMCSSStyleSheetFactory
-
Field Summary
Fields inherited from class io.sf.carte.doc.style.css.om.AbstractCSSStyleSheetFactory
STRING_DOUBLE_QUOTE, STRING_SINGLE_QUOTE
Fields inherited from interface io.sf.carte.doc.style.css.CSSStyleSheetFactory
ORIGIN_AUTHOR, ORIGIN_USER, ORIGIN_USER_AGENT, ORIGIN_USER_IMPORTANT
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
BaseCSSStyleSheetFactory
(EnumSet<Parser2.Flag> parserFlags) -
Method Summary
Modifier and TypeMethodDescriptionprotected StyleFormattingFactory
protected abstract BaseDocumentCSSStyleSheet
createDocumentStyleSheet
(byte origin) Creates a Document CSS style sheet for all media.createImmutableMediaQueryList
(String media, Node owner) Parses and creates an immutable media query list for the given media.Create a new StyleDeclarationErrorHandler for the given style rule.createMediaList
(SACMediaList media, Node owner) Create a media query list for the given SAC media list.createMediaQueryList
(String mediaQueryString, Node owner) ParsesmediaQueryString
and creates a new media query list.protected abstract AbstractCSSStyleSheet
createRuleStyleSheet
(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Creates a CSS style sheet owned by a CSS rule.protected Parser
Create a SAC Parser specified by the system propertyorg.w3c.css.sac.parser
.createSheetErrorHandler
(ExtendedCSSStyleSheet<? extends ExtendedCSSRule> sheet) Creates a style sheet error handler.Create a new StyleDeclarationErrorHandler for the given style rule.createStyleSheet
(String title, MediaQueryList media) Creates a stand-alone author style sheet.createUnmodifiableMediaQueryList
(String media, Node owner) Deprecated.Gets the device factory.protected EnumSet<Parser2.Flag>
Get the parser flags that should be used by NSAC parsers.Get the style formatting factory to be used with this sheet factory.getSystemDefaultValue
(String propertyName) Get a system default value for the given property.protected AbstractCSSStyleSheet
Get the priority-important part of the user style sheet, i.e. the style sheet with the declarations ofimportant
priority.protected AbstractCSSStyleSheet
Get the normal part of the user style sheet, i.e. the style sheet with the declarations of normal priority.protected ValueFactory
Get a value factory set to the appropriate flags.protected boolean
Check for compat value flags.protected BaseDocumentCSSStyleSheet
Returns a default user agent style sheet for (X)HTML documents, strict mode.protected BaseDocumentCSSStyleSheet
Returns a default user agent style sheet for (X)HTML documents, quirks mode.void
setClassLoader
(ClassLoader loader) Sets the class loader to be used when loading internal style sheets.void
setDeviceFactory
(DeviceFactory deviceFactory) Sets the device factory.void
setFactoryFlag
(byte flag) Set a configuration flag.void
setLenientSystemValues
(boolean lenient) The style sheet factories provide system default values, and its behaviour depends on alenientSystemValues
flag.void
Set a style formatting factory to format style serializations made with sheets created by this sheet factory.void
Sets the CSS style sheet defined by the end-user.Methods inherited from class io.sf.carte.doc.style.css.om.AbstractCSSStyleSheetFactory
createAnonymousStyleDeclaration, createInlineStyle, createLinkedStyleSheet, getDefaultStyleSheet, setDefaultHTMLUserAgentSheet
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.CSSStyleSheetFactory
getUserAgentStyleSheet
-
Constructor Details
-
BaseCSSStyleSheetFactory
protected BaseCSSStyleSheetFactory() -
BaseCSSStyleSheetFactory
-
-
Method Details
-
createDefaultStyleFormattingFactory
-
createDocumentStyleSheet
Creates a Document CSS style sheet for all media.- Parameters:
origin
- the origin of the sheet (likeauthor
,user agent
, etc.)- Returns:
- the style sheet.
-
createStyleSheet
Creates a stand-alone author style sheet.- Specified by:
createStyleSheet
in interfaceCSSStyleSheetFactory
- Specified by:
createStyleSheet
in classAbstractCSSStyleSheetFactory
- Parameters:
title
- the advisory title.media
- the target media for the style sheet.- Returns:
- the style sheet.
-
createRuleStyleSheet
protected abstract AbstractCSSStyleSheet createRuleStyleSheet(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Creates a CSS style sheet owned by a CSS rule.- Specified by:
createRuleStyleSheet
in classAbstractCSSStyleSheetFactory
- Parameters:
ownerRule
- the owner rule.title
- the advisory title.mediaList
- the list of target media for style.- Returns:
- the style sheet.
-
setClassLoader
Sets the class loader to be used when loading internal style sheets.- Parameters:
loader
- the class loader.
-
getStyleFormattingFactory
Description copied from interface:CSSStyleSheetFactory
Get the style formatting factory to be used with this sheet factory.- Returns:
- the style formatting factory.
-
setStyleFormattingFactory
Description copied from interface:CSSStyleSheetFactory
Set a style formatting factory to format style serializations made with sheets created by this sheet factory.- Parameters:
factory
- the style formatting factory.
-
setUserStyleSheet
Sets the CSS style sheet defined by the end-user.The sheet in the supplied reader should contain user preferences, and will be appropriately merged with the other style sheets.
- Parameters:
re
- the reader with the user style sheet.- Throws:
DOMException
- if a problem is found parsing the sheet.IOException
- if there is a problem retrieving the reader.
-
getUserImportantStyleSheet
Description copied from class:AbstractCSSStyleSheetFactory
Get the priority-important part of the user style sheet, i.e. the style sheet with the declarations ofimportant
priority.- Specified by:
getUserImportantStyleSheet
in classAbstractCSSStyleSheetFactory
- Returns:
- the important part of the user style sheet.
-
getUserNormalStyleSheet
Description copied from class:AbstractCSSStyleSheetFactory
Get the normal part of the user style sheet, i.e. the style sheet with the declarations of normal priority.- Specified by:
getUserNormalStyleSheet
in classAbstractCSSStyleSheetFactory
- Returns:
- the normal part of the user style sheet.
-
htmlDefaultSheet
Returns a default user agent style sheet for (X)HTML documents, strict mode.- Returns:
- the default style sheet for HTML.
- Throws:
IllegalStateException
- if a problem arose when reading the default sheet.
-
htmlQuirksDefaultSheet
Returns a default user agent style sheet for (X)HTML documents, quirks mode.- Returns:
- the default style sheet for HTML.
- Throws:
IllegalStateException
- if a problem arose when reading the default sheet.
-
getValueFactory
Description copied from class:AbstractCSSStyleSheetFactory
Get a value factory set to the appropriate flags.- Specified by:
getValueFactory
in classAbstractCSSStyleSheetFactory
- Returns:
- the value factory.
-
setFactoryFlag
public void setFactoryFlag(byte flag) Description copied from interface:CSSStyleSheetFactory
Set a configuration flag. Do not confuse with NSAC flags, which must be set at this object's creation time (see the documentation for implementation's constructors).The flags are implementation-dependent.
- Parameters:
flag
- the flag to set.
-
setLenientSystemValues
public void setLenientSystemValues(boolean lenient) The style sheet factories provide system default values, and its behaviour depends on a
lenientSystemValues
flag. The lenient flag allows to compute values by giving reasonable defaults to properties with system-dependent initial values: '#000000' for color and 'serif' for font-family.If you work with style databases you do not need
lenientSystemValues
.Default value is
true
.- Parameters:
lenient
-true
orfalse
to enable/disable thelenientSystemValues
flag.
-
getSystemDefaultValue
Get a system default value for the given property.If the
lenientSystemValues
flag is set, returns a reasonable default for the property. Otherwise, it returns a system default meta-value.- Specified by:
getSystemDefaultValue
in interfaceCSSStyleSheetFactory
- Specified by:
getSystemDefaultValue
in classAbstractCSSStyleSheetFactory
- Parameters:
propertyName
- the property name.- Returns:
- the system default css primitive value.
-
createSACParser
Create a SAC Parser specified by the system propertyorg.w3c.css.sac.parser
.If that property is not set, the instantiation of a default parser will be attempted.
If the parser is NSAC 1.1 compliant, the NSAC flags will be enabled.
- Specified by:
createSACParser
in classAbstractCSSStyleSheetFactory
- Returns:
- the SAC parser.
- Throws:
DOMException
- NOT_SUPPORTED_ERR if the Parser could not be instantiated.
-
getParserFlags
Get the parser flags that should be used by NSAC parsers.- Specified by:
getParserFlags
in classAbstractCSSStyleSheetFactory
- Returns:
- the NSAC parser flags.
-
hasCompatValueFlags
protected boolean hasCompatValueFlags()Description copied from class:AbstractCSSStyleSheetFactory
Check for compat value flags.- Specified by:
hasCompatValueFlags
in classAbstractCSSStyleSheetFactory
- Returns:
true
if the factory has compat value flags set.
-
createInlineStyleErrorHandler
Description copied from interface:CSSStyleSheetFactory
Create a new StyleDeclarationErrorHandler for the given style rule.- Parameters:
owner
- the element owner of the inline style.- Returns:
- the StyleDeclarationErrorHandler.
-
createStyleDeclarationErrorHandler
Create a new StyleDeclarationErrorHandler for the given style rule.- Parameters:
rule
- the declaration rule the handler is for.- Returns:
- the StyleDeclarationErrorHandler.
-
createSheetErrorHandler
public SheetErrorHandler createSheetErrorHandler(ExtendedCSSStyleSheet<? extends ExtendedCSSRule> sheet) Creates a style sheet error handler.- Parameters:
sheet
- the sheet that will be handled.- Returns:
- the error handler.
-
createMediaQueryList
ParsesmediaQueryString
and creates a new media query list.- Parameters:
mediaQueryString
- the media query string.owner
- the node that would handle errors, if any.- Returns:
- a new media list for
mediaQueryString
. - Throws:
CSSException
- SAC_NOT_SUPPORTED_ERR if a hard-coded limit in nested expressions was reached.
-
createImmutableMediaQueryList
Parses and creates an immutable media query list for the given media.- Parameters:
media
- the comma-separated list of media. Ifnull
, the media list will be for all media.owner
- the node that would handle errors, if any.- Returns:
- the immutable media list.
- Throws:
CSSException
- SAC_NOT_SUPPORTED_ERR if a hard-coded limit in nested expressions was reached.
-
createUnmodifiableMediaQueryList
Deprecated.Parses and creates an immutable media query list for the given media.- Parameters:
media
- the comma-separated list of media. Ifnull
, the media list will be for all media.owner
- the node that would handle errors, if any.- Returns:
- the immutable media list.
- See Also:
-
createMediaList
Create a media query list for the given SAC media list.- Parameters:
media
- the SAC media list.owner
- the node that would handle errors, if any.- Returns:
- the media query list.
- Throws:
CSSException
- SAC_NOT_SUPPORTED_ERR if a hard-coded limit in nested expressions was reached.
-
getDeviceFactory
Gets the device factory.- Returns:
- the device factory.
-
setDeviceFactory
Sets the device factory.- Parameters:
deviceFactory
- the device factory.
-