@NotThreadSafe public class CascadingStyleSheet extends Object implements ICSSSourceLocationAware, Serializable
ICSSTopLevelRule) are maintained in a combined list.| Constructor and Description |
|---|
CascadingStyleSheet() |
| Modifier and Type | Method and Description |
|---|---|
CascadingStyleSheet |
addImportRule(CSSImportRule aImportRule)
Add a new
@import rule at the end of the @import
rule list. |
CascadingStyleSheet |
addImportRule(int nIndex,
CSSImportRule aImportRule)
Add a new
@import rule at a specified index of the
@import rule list. |
CascadingStyleSheet |
addNamespaceRule(CSSNamespaceRule aNamespaceRule)
Add a new
@namespace rule at the end of the
@namespace rule list. |
CascadingStyleSheet |
addNamespaceRule(int nIndex,
CSSNamespaceRule aNamespaceRule)
Add a new
@namespace rule at the specified index of the
@namespace rule list. |
CascadingStyleSheet |
addRule(ICSSTopLevelRule aRule)
Add a new top-level rule at the end.
|
CascadingStyleSheet |
addRule(int nIndex,
ICSSTopLevelRule aRule)
Add a new top-level rule at the specified index.
|
boolean |
equals(Object o) |
List<CSSFontFaceRule> |
getAllFontFaceRules()
Get a list of all top-level rules that are font-face rules (implementing
CSSFontFaceRule). |
List<CSSImportRule> |
getAllImportRules() |
List<CSSKeyframesRule> |
getAllKeyframesRules()
Get a list of all top-level rules that are keyframes rules (implementing
CSSKeyframesRule). |
List<CSSMediaRule> |
getAllMediaRules()
Get a list of all top-level rules that are media rules (implementing
CSSMediaRule). |
List<CSSNamespaceRule> |
getAllNamespaceRules() |
List<CSSPageRule> |
getAllPageRules()
Get a list of all top-level rules that are page rules (implementing
CSSPageRule). |
List<ICSSTopLevelRule> |
getAllRules()
Get a copy of all contained top-level rules.
|
List<CSSStyleRule> |
getAllStyleRules()
Get a list of all top-level rules that are style rules (implementing
CSSStyleRule). |
List<CSSSupportsRule> |
getAllSupportsRules()
Get a list of all top-level rules that are support rules (implementing
CSSSupportsRule). |
List<CSSUnknownRule> |
getAllUnknownRules()
Get a list of all top-level rules that are unknown rules (implementing
CSSUnknownRule). |
List<CSSViewportRule> |
getAllViewportRules()
Get a list of all top-level rules that are viewport rules (implementing
CSSViewportRule). |
CSSFontFaceRule |
getFontFaceRuleAtIndex(int nIndex)
Get the
@font-face rule at the specified index. |
int |
getFontFaceRuleCount()
Get the number of top-level rules that are font-face rules (implementing
CSSFontFaceRule). |
CSSImportRule |
getImportRuleAtIndex(int nIndex)
Get the
@import rule at the specified index. |
int |
getImportRuleCount() |
CSSKeyframesRule |
getKeyframesRuleAtIndex(int nIndex)
Get the
@keyframes rule at the specified index. |
int |
getKeyframesRuleCount()
Get the number of top-level rules that are keyframes rules (implementing
CSSKeyframesRule). |
CSSMediaRule |
getMediaRuleAtIndex(int nIndex)
Get the
@media rule at the specified index. |
int |
getMediaRuleCount()
Get the number of top-level rules that are media rules (implementing
CSSMediaRule). |
CSSNamespaceRule |
getNamespaceRuleAtIndex(int nIndex)
Get the
@namespace rule at the specified index. |
int |
getNamespaceRuleCount() |
CSSPageRule |
getPageRuleAtIndex(int nIndex)
Get the
@page rule at the specified index. |
int |
getPageRuleCount()
Get the number of top-level rules that are page rules (implementing
CSSPageRule). |
ICSSTopLevelRule |
getRuleAtIndex(int nIndex)
Get the top-level rule at the specified index.
|
int |
getRuleCount()
Get the number of total contained top-level rules.
|
CSSSourceLocation |
getSourceLocation() |
CSSStyleRule |
getStyleRuleAtIndex(int nIndex)
Get the style rule at the specified index.
|
int |
getStyleRuleCount()
Get the number of top-level rules that are style rules (implementing
CSSStyleRule). |
CSSSupportsRule |
getSupportsRuleAtIndex(int nIndex)
Get the
@supports rule at the specified index. |
int |
getSupportsRuleCount()
Get the number of top-level rules that are support rules (implementing
CSSSupportsRule). |
CSSUnknownRule |
getUnknownRuleAtIndex(int nIndex)
Get the unknown rule at the specified index.
|
int |
getUnknownRuleCount()
Get the number of top-level rules that are unknown rules (implementing
CSSUnknownRule). |
CSSViewportRule |
getViewportRuleAtIndex(int nIndex)
Get the
@viewport rule at the specified index. |
int |
getViewportRuleCount()
Get the number of top-level rules that are viewport rules (implementing
CSSViewportRule). |
boolean |
hasFontFaceRules()
Check if at least one of the top-level rules is a font-face rule
(implementing
CSSFontFaceRule). |
int |
hashCode() |
boolean |
hasImportRules() |
boolean |
hasKeyframesRules()
Check if at least one of the top-level rules is a keyframes rule
(implementing
CSSKeyframesRule). |
boolean |
hasMediaRules()
Check if at least one of the top-level rules is a media rule (implementing
CSSMediaRule). |
boolean |
hasNamespaceRules() |
boolean |
hasPageRules()
Check if at least one of the top-level rules is a page rule (implementing
CSSPageRule). |
boolean |
hasRules()
Check if any top-level rule.
|
boolean |
hasStyleRules()
Check if at least one of the top-level rules is a style rule (implementing
CSSStyleRule). |
boolean |
hasSupportsRules()
Check if at least one of the top-level rules is a supports rule
(implementing
CSSSupportsRule). |
boolean |
hasUnknownRules()
Check if at least one of the top-level rules is an unknown rule
(implementing
CSSUnknownRule). |
boolean |
hasViewportRules()
Check if at least one of the top-level rules is a viewport rule
(implementing
CSSViewportRule). |
com.helger.commons.state.EChange |
removeAllImportRules()
Remove all
@import rules. |
com.helger.commons.state.EChange |
removeAllNamespaceRules()
Remove all
@namespace rules. |
com.helger.commons.state.EChange |
removeAllRules()
Remove all top-level rules.
|
com.helger.commons.state.EChange |
removeImportRule(CSSImportRule aImportRule)
Remove the specified
@import rule. |
com.helger.commons.state.EChange |
removeImportRule(int nImportRuleIndex)
Remove the
@import rule at the specified index. |
com.helger.commons.state.EChange |
removeNamespaceRule(CSSNamespaceRule aNamespaceRule)
Remove the specified
@namespace rule. |
com.helger.commons.state.EChange |
removeNamespaceRule(int nNamespaceRuleIndex)
Remove the
@namespace rule at the specified index. |
com.helger.commons.state.EChange |
removeRule(ICSSTopLevelRule aRule)
Remove the specified top-level rule.
|
com.helger.commons.state.EChange |
removeRule(int nRuleIndex)
Remove the rule at the specified index.
|
void |
setSourceLocation(CSSSourceLocation aSourceLocation)
Set the source location of the object, determined while parsing.
|
String |
toString() |
public boolean hasImportRules()
true if at least one @import rule is
present, false otherwise.@Nonnegative public int getImportRuleCount()
@import rules. Always ≥ 0.@Nullable public CSSImportRule getImportRuleAtIndex(@Nonnegative int nIndex)
@import rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getImportRuleCount().null if an invalid index was specified.@Nonnull public CascadingStyleSheet addImportRule(@Nonnull CSSImportRule aImportRule)
@import rule at the end of the @import
rule list.aImportRule - The import rule to add. May not be null.@Nonnull public CascadingStyleSheet addImportRule(@Nonnegative int nIndex, @Nonnull CSSImportRule aImportRule)
@import rule at a specified index of the
@import rule list.nIndex - The index where the rule should be added. Must be ≥ 0.aImportRule - The import rule to add. May not be null.ArrayIndexOutOfBoundsException - if the index is invalid@Nonnull public com.helger.commons.state.EChange removeImportRule(@Nullable CSSImportRule aImportRule)
@import rule.aImportRule - The import rule to be removed. May be null.EChange.CHANGED if removal was successful,
EChange.UNCHANGED otherwise. Never null.@Nonnull public com.helger.commons.state.EChange removeImportRule(@Nonnegative int nImportRuleIndex)
@import rule at the specified index.nImportRuleIndex - The index to be removed. Should be ≥ 0.EChange.CHANGED if removal was successful,
EChange.UNCHANGED otherwise. Never null.@Nonnull public com.helger.commons.state.EChange removeAllImportRules()
@import rules.EChange.CHANGED if any rule was removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull @ReturnsMutableCopy public List<CSSImportRule> getAllImportRules()
@import rules. Never
null.public boolean hasNamespaceRules()
true if at least one @namespace rule is
present, false otherwise.@Nonnegative public int getNamespaceRuleCount()
@namespace rules. Always ≥
0.@Nullable public CSSNamespaceRule getNamespaceRuleAtIndex(@Nonnegative int nIndex)
@namespace rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getNamespaceRuleCount().null if an invalid index was specified.@Nonnull public CascadingStyleSheet addNamespaceRule(@Nonnull CSSNamespaceRule aNamespaceRule)
@namespace rule at the end of the
@namespace rule list.aNamespaceRule - The namespace rule to be added. May not be null.@Nonnull public CascadingStyleSheet addNamespaceRule(@Nonnegative int nIndex, @Nonnull CSSNamespaceRule aNamespaceRule)
@namespace rule at the specified index of the
@namespace rule list.nIndex - The index where the rule should be added. Must be ≥ 0.aNamespaceRule - The namespace rule to be added. May not be null.@Nonnull public com.helger.commons.state.EChange removeNamespaceRule(@Nullable CSSNamespaceRule aNamespaceRule)
@namespace rule.aNamespaceRule - The namespace rule to be removed. May be null.EChange.CHANGED if the namespace rule was successfully
removed, EChange.UNCHANGED otherwise. Never
null.@Nonnull public com.helger.commons.state.EChange removeNamespaceRule(@Nonnegative int nNamespaceRuleIndex)
@namespace rule at the specified index.nNamespaceRuleIndex - The index to be removed. Should be ≥ 0.EChange.CHANGED if the namespace rule was successfully
removed, EChange.UNCHANGED otherwise. Never
null.@Nonnull public com.helger.commons.state.EChange removeAllNamespaceRules()
@namespace rules.EChange.CHANGED if any rule was removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull @ReturnsMutableCopy public List<CSSNamespaceRule> getAllNamespaceRules()
@namespace rules. Never
null.public boolean hasRules()
@import and @namespace rules!true if at least one top-level rule is present,
false if otherwise.@Nonnegative public int getRuleCount()
@import and
@namespace rules!@Nullable public ICSSTopLevelRule getRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getRuleCount().null if an invalid index was specified.@Nonnull public CascadingStyleSheet addRule(@Nonnull ICSSTopLevelRule aRule)
@import and @namespace rules!aRule - The rule to be added. May not be null.@Nonnull public CascadingStyleSheet addRule(@Nonnegative int nIndex, @Nonnull ICSSTopLevelRule aRule)
@import and @namespace
rules!nIndex - The index where the top-level rule should be added. Must be ≥ 0.aRule - The rule to be added. May not be null.@Nonnull public com.helger.commons.state.EChange removeRule(@Nullable ICSSTopLevelRule aRule)
@import and @namespace rules!aRule - The rule to be removed. May be null.EChange.CHANGED if the rule was successfully removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull public com.helger.commons.state.EChange removeRule(@Nonnegative int nRuleIndex)
@import and @namespace
rules!nRuleIndex - The index of the rule to be removed. Should be ≥ 0.EChange.CHANGED if the rule at the specified index was
successfully removed, EChange.UNCHANGED otherwise. Never
null.@Nonnull public com.helger.commons.state.EChange removeAllRules()
EChange.CHANGED if any rule was removed,
EChange.UNCHANGED otherwise. Never null.@Nonnull @ReturnsMutableCopy public List<ICSSTopLevelRule> getAllRules()
@import and @namespace
rules!null.public boolean hasStyleRules()
CSSStyleRule).true if at least one style rule is contained,
false otherwise.@Nonnegative public int getStyleRuleCount()
CSSStyleRule).@Nullable public CSSStyleRule getStyleRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getStyleRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSStyleRule> getAllStyleRules()
CSSStyleRule).null.public boolean hasPageRules()
CSSPageRule).true if at least one @page rule is
contained, false otherwise.@Nonnegative public int getPageRuleCount()
CSSPageRule).@page rules. Always ≥ 0.@Nullable public CSSPageRule getPageRuleAtIndex(@Nonnegative int nIndex)
@page rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getPageRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSPageRule> getAllPageRules()
CSSPageRule).@page rules. Never
null.public boolean hasMediaRules()
CSSMediaRule).true if at least one @media rule is
contained, false otherwise.@Nonnegative public int getMediaRuleCount()
CSSMediaRule).@media rules. Always ≥ 0.@Nullable public CSSMediaRule getMediaRuleAtIndex(@Nonnegative int nIndex)
@media rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getMediaRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSMediaRule> getAllMediaRules()
CSSMediaRule).@media rules. Never
null.public boolean hasFontFaceRules()
CSSFontFaceRule).true if at least one @font-face rule is
contained, false otherwise.@Nonnegative public int getFontFaceRuleCount()
CSSFontFaceRule).@font-face rules. Always ≥
0.@Nullable public CSSFontFaceRule getFontFaceRuleAtIndex(@Nonnegative int nIndex)
@font-face rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getFontFaceRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSFontFaceRule> getAllFontFaceRules()
CSSFontFaceRule).@font-face rules. Never
null.public boolean hasKeyframesRules()
CSSKeyframesRule).true if at least one @keyframes rule is
contained, false otherwise.@Nonnegative public int getKeyframesRuleCount()
CSSKeyframesRule).@keyframes rules. Always ≥
0.@Nullable public CSSKeyframesRule getKeyframesRuleAtIndex(@Nonnegative int nIndex)
@keyframes rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getKeyframesRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSKeyframesRule> getAllKeyframesRules()
CSSKeyframesRule).@keyframes rules. Never
null.public boolean hasViewportRules()
CSSViewportRule).true if at least one @viewport rule is
contained, false otherwise.@Nonnegative public int getViewportRuleCount()
CSSViewportRule).@viewport rules. Always ≥
0.@Nullable public CSSViewportRule getViewportRuleAtIndex(@Nonnegative int nIndex)
@viewport rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getViewportRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSViewportRule> getAllViewportRules()
CSSViewportRule).@viewport rules. Never
null.public boolean hasSupportsRules()
CSSSupportsRule).true if at least one @supports rule is
contained, false otherwise.@Nonnegative public int getSupportsRuleCount()
CSSSupportsRule).@supports rules. Always ≥
0.@Nullable public CSSSupportsRule getSupportsRuleAtIndex(@Nonnegative int nIndex)
@supports rule at the specified index.nIndex - The index to be resolved. Should be ≥ 0 and <
getSupportsRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSSupportsRule> getAllSupportsRules()
CSSSupportsRule).@supports rules. Never
null.public boolean hasUnknownRules()
CSSUnknownRule).true if at least one unknown @ rule is
contained, false otherwise.@Nonnegative public int getUnknownRuleCount()
CSSUnknownRule).@ rules. Always ≥
0.@Nullable public CSSUnknownRule getUnknownRuleAtIndex(@Nonnegative int nIndex)
nIndex - The index to be resolved. Should be ≥ 0 and <
getUnknownRuleCount().null if an invalid index was specified.@Nonnull @ReturnsMutableCopy public List<CSSUnknownRule> getAllUnknownRules()
CSSUnknownRule).@ rules. Never
null.public void setSourceLocation(@Nullable CSSSourceLocation aSourceLocation)
ICSSSourceLocationAwaresetSourceLocation in interface ICSSSourceLocationAwareaSourceLocation - The source location to use. May be null.@Nullable public CSSSourceLocation getSourceLocation()
getSourceLocation in interface ICSSSourceLocationAwarenull if an object was not read but manually
created.Copyright © 2014–2016 Philip Helger. All rights reserved.