Interface CSSStyleSheetFactory
- All Known Implementing Classes:
AbstractCSSStyleSheetFactory,BaseCSSStyleSheetFactory,CSSDOMImplementation,DOMCSSStyleSheetFactory
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final byte -
Method Summary
Modifier and TypeMethodDescriptionCreate a style declaration for an anonymous inline box, associated to a text/cdata node.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.createMediaQueryList(String mediaQueryString, Node owner) ParsesmediaQueryStringand creates a new media query list.createPropertyDefinition(String name, CSSValueSyntax syntax, boolean inherited, CSSLexicalValue initialValue) Create a property definition.createSheetErrorHandler(CSSStyleSheet<? extends CSSRule> sheet) Creates a style sheet error handler.Create a new StyleDeclarationErrorHandler for the given style rule.CSSStyleSheet<? extends CSSRule>createStyleSheet(String title, MediaQueryList media) Creates a stand-alone author style sheet.Gets the device factory.Get the style formatting factory to be used with this sheet factory.getSystemDefaultValue(String propertyName) Get a system default value for the given property.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.voidsetFactoryFlag(byte flag) Set a configuration flag.voidsetLenientSystemValues(boolean lenient) Set the value of thelenientSystemValuesflag.voidSet a style formatting factory to format style serializations made with sheets created by this sheet factory.voidSets the CSS style sheet defined by the end-user.
-
Field Details
-
ORIGIN_USER_IMPORTANT
static final byte ORIGIN_USER_IMPORTANT- See Also:
-
ORIGIN_AUTHOR
static final byte ORIGIN_AUTHOR- See Also:
-
ORIGIN_USER
static final byte ORIGIN_USER- See Also:
-
ORIGIN_USER_AGENT
static final byte ORIGIN_USER_AGENT- See Also:
-
-
Method Details
-
createStyleSheet
Creates a stand-alone author style sheet.- Parameters:
title- the advisory title.media- the target media for style.- Returns:
- the style sheet.
-
createAnonymousStyleDeclaration
Create a style declaration for an anonymous inline box, associated to a text/cdata node.- Parameters:
node- the node that has the declaration associated to it.- Returns:
- the anonymous style declaration.
-
getUserAgentStyleSheet
Gets the User Agent default CSS style sheet to be used by this factory.- Parameters:
mode- the compliance mode.- Returns:
- the default style sheet, or an empty sheet if no User Agent sheet was defined.
-
setDefaultHTMLUserAgentSheet
void setDefaultHTMLUserAgentSheet()Sets a default HTML default style sheet as the user agent style sheet. -
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.
-
setFactoryFlag
void setFactoryFlag(byte flag) 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
void setLenientSystemValues(boolean lenient) Set the value of thelenientSystemValuesflag. Do not confuse this flag with the NSAC flags.The style sheet factories provide system default values, and its behaviour depends on a
lenientSystemValuesflag. 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-trueorfalseto enable/disable thelenientSystemValuesflag.
-
getSystemDefaultValue
Get a system default value for the given property.If the
lenientSystemValuesflag istrue, returns a reasonable default for the property. Otherwise, it returns a system default meta-value.- Parameters:
propertyName- the property name.- Returns:
- the system default css primitive value.
-
createStyleDeclarationErrorHandler
Create a new StyleDeclarationErrorHandler for the given style rule.- Parameters:
rule- the declaration rule the handler is for.- Returns:
- the StyleDeclarationErrorHandler.
-
createInlineStyleErrorHandler
Create a new StyleDeclarationErrorHandler for the given style rule.- Parameters:
owner- the element owner of the inline style.- Returns:
- the StyleDeclarationErrorHandler.
-
createSheetErrorHandler
Creates a style sheet error handler.- Parameters:
sheet- the style sheet whose errors are to be handled.- Returns:
- the error handler.
-
createMediaQueryList
ParsesmediaQueryStringand 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.
-
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.
-
createPropertyDefinition
CSSPropertyDefinition createPropertyDefinition(String name, CSSValueSyntax syntax, boolean inherited, CSSLexicalValue initialValue) throws DOMException Create a property definition.To parse the syntax, use a parser like
SyntaxParser.- Parameters:
name- the property name (unescaped).syntax- the syntax.inherited- whether the property is inherited or not.initialValue- the initial value.- Returns:
- the property definition.
- Throws:
DOMException- INVALID_ACCESS_ERR if the initial value does not match the syntax.
-
getStyleFormattingFactory
StyleFormattingFactory getStyleFormattingFactory()Get the style formatting factory to be used with this sheet factory.- Returns:
- the style formatting factory.
-
setStyleFormattingFactory
Set a style formatting factory to format style serializations made with sheets created by this sheet factory.- Parameters:
factory- the style formatting factory.
-
getDeviceFactory
DeviceFactory getDeviceFactory()Gets the device factory.- Returns:
- the device factory.
-