java.lang.Object
io.sf.carte.doc.style.css.om.AbstractCSSRule
io.sf.carte.doc.style.css.om.GroupingRule
io.sf.carte.doc.style.css.om.StyleRule
- All Implemented Interfaces:
CSSDeclarationRule
,CSSGroupingRule
,CSSRule
,CSSStyleRule
,Serializable
,CSSRule
CSS style rule.
- See Also:
-
Field Summary
Fields inherited from interface io.sf.carte.doc.style.css.CSSRule
COUNTER_STYLE_RULE, CUSTOM_MEDIA_RULE, DOCUMENT_RULE, FONT_FACE_RULE, FONT_FEATURE_VALUES_RULE, IMPORT_RULE, KEYFRAME_RULE, KEYFRAMES_RULE, MARGIN_RULE, MEDIA_RULE, NAMESPACE_RULE, NESTED_DECLARATIONS, PAGE_RULE, PROPERTY_RULE, REGION_STYLE_RULE, STYLE_RULE, SUPPORTS_RULE, UNKNOWN_RULE, VIEWPORT_RULE
Fields inherited from interface org.w3c.dom.css.CSSRule
CHARSET_RULE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone
(AbstractCSSStyleSheet parentSheet) Obtain a clone of this rule whose parent sheet isparentSheet
.protected Parser
void
If this rule does not contain a preceding comment list, create one.void
If this rule does not contain a trailing comment list, create one.boolean
A minified parsable textual representation of the rule.int
Get the origin of this rule (user agent sheet, author, user).If this rule is contained inside another rule, return that rule.Get the style sheet that contains this rule.Get a list of the comments that preceded this rule, if any.The selectors of this style rule.Get a parsable serialization of the selector(s).getStyle()
Get the style that is declared by this rule.Gets the error handler.protected StyleFormattingContext
Get a list of the comments that immediately follow this rule, if any.short
getType()
protected URL
Gets an URL for the given URI, taking into account the parent CSS Base URL if appropriate.int
hashCode()
void
setParentRule
(AbstractCSSRule parent) Sets the parent CSS rule, in case this rule is contained by another.void
setSelectorList
(SelectorList selectorList) Set the selectors of this style rule.void
setSelectorText
(String selectorText) Parse the given string and set the selector list according to it.void
Sets the style declaration error handler.void
writeCssText
(SimpleWriter wri, StyleFormattingContext context) Write a serialization of this rule to the given simple writer, according to the given context.Methods inherited from class io.sf.carte.doc.style.css.om.GroupingRule
addRule, deleteRule, getCssRules, insertRule
Methods inherited from class io.sf.carte.doc.style.css.om.AbstractCSSRule
clone, setCssText, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.sf.carte.doc.style.css.CSSGroupingRule
deleteRule, getCssRules, insertRule
Methods inherited from interface io.sf.carte.doc.style.css.CSSRule
getParentRule, getParentStyleSheet, getPrecedingComments, getTrailingComments, setCssText
-
Constructor Details
-
StyleRule
-
-
Method Details
-
getStyle
Description copied from interface:CSSDeclarationRule
Get the style that is declared by this rule.- Specified by:
getStyle
in interfaceCSSDeclarationRule
- Returns:
- the style declaration.
-
getStyleDeclarationErrorHandler
Gets the error handler.- Specified by:
getStyleDeclarationErrorHandler
in interfaceCSSDeclarationRule
- Returns:
- the error handler.
-
setStyleDeclarationErrorHandler
Sets the style declaration error handler.If no handler is set, the one from the parent style sheet's factory will be used.
- Parameters:
handler
- the error handler.
-
setSelectorText
Description copied from interface:CSSStyleRule
Parse the given string and set the selector list according to it.- Specified by:
setSelectorText
in interfaceCSSStyleRule
- Parameters:
selectorText
- a text representation of a selector list, according to CSS syntax.- Throws:
DOMException
-
getSelectorText
Description copied from interface:CSSStyleRule
Get a parsable serialization of the selector(s).- Specified by:
getSelectorText
in interfaceCSSStyleRule
- Returns:
- a parsable serialization of the selector list.
-
setSelectorList
Set the selectors of this style rule.- Specified by:
setSelectorList
in interfaceCSSStyleRule
- Parameters:
selectorList
- the selector list.- Throws:
NullPointerException
- ifselectorList
is null.IllegalArgumentException
- ifselectorList
is empty.
-
getSelectorList
Description copied from interface:CSSStyleRule
The selectors of this style rule.- Specified by:
getSelectorList
in interfaceCSSStyleRule
- Returns:
- the selector list.
-
getCssText
- Specified by:
getCssText
in interfaceCSSRule
- Specified by:
getCssText
in classAbstractCSSRule
-
writeCssText
Description copied from interface:CSSRule
Write a serialization of this rule to the given simple writer, according to the given context.- Specified by:
writeCssText
in interfaceCSSRule
- Specified by:
writeCssText
in classAbstractCSSRule
- Parameters:
wri
- the simple writer object.context
- the formatting context.- Throws:
IOException
- if an error happened while writing.
-
getMinifiedCssText
Description copied from class:AbstractCSSRule
A minified parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.- Specified by:
getMinifiedCssText
in interfaceCSSRule
- Returns:
- the minified textual representation of the rule.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classGroupingRule
-
equals
- Overrides:
equals
in classGroupingRule
-
clone
Description copied from class:AbstractCSSRule
Obtain a clone of this rule whose parent sheet isparentSheet
.- Specified by:
clone
in classAbstractCSSRule
- Parameters:
parentSheet
- the parent sheet for the new rule.- Returns:
- a clone of this rule with the given parent sheet.
- Throws:
IllegalArgumentException
-
getType
public short getType()- Specified by:
getType
in interfaceCSSRule
- Specified by:
getType
in classAbstractCSSRule
-
getParentStyleSheet
Description copied from interface:CSSRule
Get the style sheet that contains this rule.- Specified by:
getParentStyleSheet
in interfaceCSSRule
- Specified by:
getParentStyleSheet
in interfaceCSSRule
- Specified by:
getParentStyleSheet
in classAbstractCSSRule
- Returns:
- the style sheet, or null if no sheet contains this rule.
-
createSACParser
- Throws:
DOMException
-
getParentRule
Description copied from interface:CSSRule
If this rule is contained inside another rule, return that rule. If it is not nested inside any other rules, returnnull
.- Specified by:
getParentRule
in interfaceCSSRule
- Specified by:
getParentRule
in interfaceCSSRule
- Specified by:
getParentRule
in classAbstractCSSRule
- Returns:
- the containing rule, if any, otherwise
null
.
-
setParentRule
Sets the parent CSS rule, in case this rule is contained by another.- Specified by:
setParentRule
in classAbstractCSSRule
- Parameters:
parent
- the parent rule.
-
getOrigin
public int getOrigin()Description copied from class:AbstractCSSRule
Get the origin of this rule (user agent sheet, author, user).- Specified by:
getOrigin
in classAbstractCSSRule
- Returns:
- the origin of this rule.
-
enablePrecedingComments
public void enablePrecedingComments()Description copied from class:AbstractCSSRule
If this rule does not contain a preceding comment list, create one.If this rule already has a preceding comment list, does nothing.
- Specified by:
enablePrecedingComments
in classAbstractCSSRule
-
getPrecedingComments
Description copied from interface:CSSRule
Get a list of the comments that preceded this rule, if any.- Returns:
- the list of comments, or
null
if there were no preceding comments or the parsing was specified to ignore comments. - See Also:
-
enableTrailingComments
public void enableTrailingComments()Description copied from class:AbstractCSSRule
If this rule does not contain a trailing comment list, create one.If this rule already has a trailing comment list, does nothing.
- Specified by:
enableTrailingComments
in classAbstractCSSRule
-
getTrailingComments
Description copied from interface:CSSRule
Get a list of the comments that immediately follow this rule, if any.If the parsing mode was
COMMENTS_PRECEDING
, or wasCOMMENTS_AUTO
and the next comment happens after a newline character, it shall be assigned to the next rule as a preceding comment.- Returns:
- the list of comments, or
null
if there were no trailing comments or the parsing was specified to ignore comments. - See Also:
-
getStyleFormattingContext
-
getURL
Gets an URL for the given URI, taking into account the parent CSS Base URL if appropriate.- Parameters:
uri
- the uri.- Returns:
- the absolute URL.
- Throws:
MalformedURLException
- if the URL could not be built.
-