- All Implemented Interfaces:
ExtendedCSSStyleSheet<AbstractCSSRule>,Cloneable,CSSStyleSheet,StyleSheet
- Direct Known Subclasses:
BaseCSSStyleSheet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdds the rules contained by the supplied style sheet, if that sheet is not disabled.abstract AbstractCSSStyleSheetclone()Clone this style sheet.abstract FontFaceRuleCreate a CSS Font Face rule compatible with this implementation.abstract ImportRulecreateImportRule(MediaQueryList mediaList, String href) Create a CSS import rule compatible with this implementation.abstract MediaRulecreateMediaRule(MediaQueryList mediaList) Create a CSS media rule.abstract PageRuleCreate a CSS page rule compatible with this implementation.abstract AbstractCSSStyleDeclarationCreate a CSS style declaration compatible with this implementation.protected abstract AbstractCSSStyleDeclarationabstract CSSStyleDeclarationRuleCreate a CSS style rule.abstract SupportsRuleCreate a CSSSupportsRule compatible with this implementation.abstract UnknownRuleCreate a CSS unknown rule.abstract ViewportRuleCreate a CSSViewportRule compatible with this implementation.abstract CSSRuleArrayListGets the collection of all CSS rules contained within the style sheet.protected abstract StringgetNamespacePrefix(String uri) Gets the namespace prefix associated to the given URI.abstract byteGet the origin of this sheet.abstract AbstractCSSRuleabstract AbstractCSSStyleSheetabstract AbstractCSSStyleSheetFactoryGet the style sheet factory used to produce this sheet.protected abstract booleanHas this style sheet defined a default namespace ?abstract booleanloadStyleSheet(URL url, String referrerPolicy) Load the styles fromurlinto this style sheet.openConnection(URL url, String referrerPolicy) Open a non-interactive connection to the given URL.static byteparseRelAttribute(String relText) Parses therelattribute.abstract booleanparseStyleSheet(InputSource source) Parses a style sheet.abstract booleanparseStyleSheet(InputSource source, boolean ignoreComments) Parses a style sheet.protected abstract voidregisterNamespace(CSSNamespaceRule nsrule) abstract voidprotected abstract voidprotected abstract voidunregisterNamespace(String namespaceURI) Methods inherited from class io.sf.carte.doc.style.css.om.AbstractStyleSheet
getDocumentErrorHandler, getTitle, setMedia, setTitle, toMinifiedString, toStyleStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.w3c.dom.css.CSSStyleSheet
deleteRule, insertRuleMethods inherited from interface io.sf.carte.doc.style.css.ExtendedCSSStyleSheet
addRule, createCounterStyleRule, createFontFeatureValuesRule, createKeyframesRule, createMarginRule, createNamespaceRule, getErrorHandler, getMedia, getRulesForProperty, getSelectorsForProperty, hasRuleErrorsOrWarningsMethods inherited from interface org.w3c.dom.stylesheets.StyleSheet
getDisabled, getHref, getOwnerNode, getTitle, getType, setDisabled
-
Constructor Details
-
AbstractCSSStyleSheet
-
-
Method Details
-
getCssRules
Description copied from interface:ExtendedCSSStyleSheetGets the collection of all CSS rules contained within the style sheet.- Specified by:
getCssRulesin interfaceCSSStyleSheet- Specified by:
getCssRulesin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- the list of all CSS rules contained within the style sheet.
-
getParentStyleSheet
- Specified by:
getParentStyleSheetin interfaceStyleSheet
-
getOwnerRule
- Specified by:
getOwnerRulein interfaceCSSStyleSheet
-
getStyleSheetFactory
Description copied from interface:ExtendedCSSStyleSheetGet the style sheet factory used to produce this sheet.- Specified by:
getStyleSheetFactoryin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- the style sheet factory.
-
parseStyleSheet
Parses a style sheet.If the style sheet is not empty, the rules from the parsed source will be added at the end of the rule list, with the same origin as the rule with a highest precedence origin.
Even if a specific media is set at the
InputSource, this method does not alter the sheet's current media attribute.The comments preceding a rule will be available through
AbstractCSSRule.getPrecedingComments().To create a sheet, see
CSSStyleSheetFactory.createStyleSheet(String,MediaQueryList)- Specified by:
parseStyleSheetin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Parameters:
source- the SAC input source.- Returns:
trueif the SAC parser reported no errors or fatal errors, false otherwise.- Throws:
DOMException- if a problem is found parsing the sheet.IOException- if a problem is found reading the sheet.
-
parseStyleSheet
public abstract boolean parseStyleSheet(InputSource source, boolean ignoreComments) throws DOMException, IOException Parses a style sheet.If the style sheet is not empty, the rules from the parsed source will be added at the end of the rule list, with the same origin as the rule with a highest precedence origin.
Even if a specific media is set at the
InputSource, this method does not alter the sheet's current media attribute.If
ignoreCommentsis false, the comments preceding a rule will be available throughAbstractCSSRule.getPrecedingComments().This method resets the state of this sheet's error handler.
To create a sheet, see
CSSStyleSheetFactory.createStyleSheet(String,MediaQueryList)- Specified by:
parseStyleSheetin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Parameters:
source- the SAC input source.ignoreComments- true if comments have to be ignored.- Returns:
trueif the SAC parser reported no errors or fatal errors, false otherwise.- Throws:
DOMException- if a problem is found parsing the sheet.IOException- if a problem is found reading the sheet.
-
addStyleSheet
Adds the rules contained by the supplied style sheet, if that sheet is not disabled.If the provided sheet does not target all media, a media rule is created.
- Specified by:
addStyleSheetin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Parameters:
sheet- the sheet whose rules are to be added.
-
loadStyleSheet
public abstract boolean loadStyleSheet(URL url, String referrerPolicy) throws DOMException, IOException Load the styles fromurlinto this style sheet.- Parameters:
url- the url to load the style sheet from.referrerPolicy- the content of thereferrerpolicycontent attribute, if any, or the empty string.- Returns:
trueif the SAC parser reported no errors or fatal errors,falseotherwise.- Throws:
DOMException- if there is a serious problem parsing the style sheet.IOException- if a problem appears fetching the url contents.
-
createFontFaceRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS Font Face rule compatible with this implementation.- Specified by:
createFontFaceRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSS Font Face rule object.
-
createImportRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS import rule compatible with this implementation.- Specified by:
createImportRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Parameters:
mediaList- a list of media types for which the new import rule may be used.href- the URI from which to import the sheet.- Returns:
- a CSS import rule.
-
createMediaRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS media rule.- Specified by:
createMediaRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Parameters:
mediaList- a list of media types for the new rule.- Returns:
- a CSS media rule.
-
createPageRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS page rule compatible with this implementation.- Specified by:
createPageRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSS page rule.
-
createStyleRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS style rule.- Specified by:
createStyleRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSS style rule.
-
createSupportsRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSSSupportsRule compatible with this implementation.- Specified by:
createSupportsRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSSSupportsRule object.
-
createUnknownRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS unknown rule.Its contents can be set with
CSSRule.setCssText(String). Be careful to set a text that is compatible with a CSS rule, with an ending semicolon or balanced curly brackets, otherwise its serialization may break the style sheet serialization.- Specified by:
createUnknownRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSS unknown rule.
-
createViewportRule
Description copied from interface:ExtendedCSSStyleSheetCreate a CSSViewportRule compatible with this implementation.- Specified by:
createViewportRulein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSSViewportRule object.
-
createStyleDeclaration
Description copied from interface:ExtendedCSSStyleSheetCreate a CSS style declaration compatible with this implementation.- Specified by:
createStyleDeclarationin interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Returns:
- a CSS style declaration.
-
createStyleDeclaration
-
registerNamespace
-
unregisterNamespace
-
getNamespacePrefix
Gets the namespace prefix associated to the given URI.- Parameters:
uri- the namespace URI string.- Returns:
- the namespace prefix, or null if the URI is not known.
-
hasDefaultNamespace
protected abstract boolean hasDefaultNamespace()Has this style sheet defined a default namespace ?- Returns:
trueif a default namespace was defined,falseotherwise.
-
setHref
-
getOrigin
public abstract byte getOrigin()Get the origin of this sheet.- Returns:
- the origin of this sheet.
-
clone
Clone this style sheet.- Specified by:
clonein interfaceExtendedCSSStyleSheet<AbstractCSSRule>- Specified by:
clonein classAbstractStyleSheet- Returns:
- the cloned style sheet.
-
openConnection
Description copied from class:AbstractStyleSheetOpen a non-interactive connection to the given URL.If this sheet was obtained through a network connection, the returned connection should be opened by the same user agent (and appropriate credentials) that retrieved this sheet.
- Specified by:
openConnectionin classAbstractStyleSheet- Parameters:
url- the URL to connect to.referrerPolicy- the content of thereferrerpolicycontent attribute, if any, or the empty string.- Returns:
- the network connection.
- Throws:
IOException- if an I/O problem occurs opening the connection.
-
setParentStyleSheet
-
parseRelAttribute
Parses therelattribute.- Parameters:
relText- therelattribute.- Returns:
- 0 if
relrefers to a style sheet, 1 if the sheet is alternate, -1 if it is not compatible with a style sheet.
-