@NotThreadSafe public class CSSMediaRule extends AbstractHasTopLevelRules implements ICSSTopLevelRule, ICSSSourceLocationAware
@media rule: a list of style rules only
valid for certain media.@media print {
div#footer {
display: none;
}
}m_aRules| Constructor and Description |
|---|
CSSMediaRule() |
| Modifier and Type | Method and Description |
|---|---|
CSSMediaRule |
addMediaQuery(CSSMediaQuery aMediaQuery)
Add a new media query.
|
CSSMediaRule |
addMediaQuery(int nIndex,
CSSMediaQuery aMediaQuery)
Add a media query at the specified index.
|
boolean |
equals(Object o) |
com.helger.commons.collection.impl.ICommonsList<CSSMediaQuery> |
getAllMediaQueries() |
String |
getAsCSSString(ICSSWriterSettings aSettings,
int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to
an output.
|
CSSMediaQuery |
getMediaQueryAtIndex(int nMediumIndex)
Get the media query at the specified index or
null. |
int |
getMediaQueryCount() |
CSSSourceLocation |
getSourceLocation() |
int |
hashCode() |
boolean |
hasMediaQueries() |
com.helger.commons.state.EChange |
removeAllMediaQueries()
Remove all media queries.
|
com.helger.commons.state.EChange |
removeMediaQuery(CSSMediaQuery aMediaQuery)
Remove the provided media query.
|
com.helger.commons.state.EChange |
removeMediaQuery(int nMediumIndex)
Remove the media query at the provided index.
|
void |
setSourceLocation(CSSSourceLocation aSourceLocation)
Set the source location of the object, determined while parsing.
|
String |
toString() |
addRule, addRule, getAllFontFaceRules, getAllKeyframesRules, getAllMediaRules, getAllPageRules, getAllRules, getAllRules, getAllStyleRules, getAllSupportsRules, getAllUnknownRules, getAllViewportRules, getFontFaceRuleAtIndex, getFontFaceRuleCount, getKeyframesRuleAtIndex, getKeyframesRuleCount, getMediaRuleAtIndex, getMediaRuleCount, getPageRuleAtIndex, getPageRuleCount, getRule, getRuleAtIndex, getRuleCount, getStyleRuleAtIndex, getStyleRuleCount, getSupportsRuleAtIndex, getSupportsRuleCount, getUnknownRuleAtIndex, getUnknownRuleCount, getViewportRuleAtIndex, getViewportRuleCount, hasFontFaceRules, hasKeyframesRules, hasMediaRules, hasPageRules, hasRules, hasStyleRules, hasSupportsRules, hasUnknownRules, hasViewportRules, removeAllRules, removeRule, removeRule, removeRulesclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAsCSSString, getAsCSSStringpublic boolean hasMediaQueries()
true if at least one media query is present,
false if no media query is present.@Nonnegative public int getMediaQueryCount()
@Nonnull public CSSMediaRule addMediaQuery(@Nonnull @Nonempty CSSMediaQuery aMediaQuery)
aMediaQuery - The media query to be added. May not be null.@Nonnull public CSSMediaRule addMediaQuery(@Nonnegative int nIndex, @Nonnull @Nonempty CSSMediaQuery aMediaQuery)
nIndex - The index to use. Must be ≥ 0. If the index is ≥
getMediaQueryCount() than the media query is appended like
in addMediaQuery(CSSMediaQuery).aMediaQuery - The media query to be added. May not be null.@Nonnull public com.helger.commons.state.EChange removeMediaQuery(@Nullable CSSMediaQuery aMediaQuery)
aMediaQuery - The media query to be removed. May be null.EChange.@Nonnull public com.helger.commons.state.EChange removeMediaQuery(@Nonnegative int nMediumIndex)
nMediumIndex - The index to be removed. Should be ≥ 0.EChange.@Nonnull public com.helger.commons.state.EChange removeAllMediaQueries()
EChange.CHANGED if any media query was removed,
EChange.UNCHANGED otherwise. Never null.@Nullable public CSSMediaQuery getMediaQueryAtIndex(@Nonnegative int nMediumIndex)
null.nMediumIndex - The index to be retrieved. Should be ≥ 0.null if an invalid index was provided.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSMediaQuery> getAllMediaQueries()
null.
Maybe empty.@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
ICSSWriteablegetAsCSSString in interface ICSSWriteableaSettings - The settings to be used to format the output. May not be
null.nIndentLevel - The current indentation levelnull.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–2018 Philip Helger. All rights reserved.