@NotThreadSafe public class CSSMediaRule extends Object implements ICSSTopLevelRule, ICSSSourceLocationAware
@media rule: a list of style rules only
valid for certain media.@media print {
div#footer {
display: none;
}
}| Constructor and Description |
|---|
CSSMediaRule() |
| Modifier and Type | Method and Description |
|---|---|
CSSMediaRule |
addMediaQuery(CSSMediaQuery aMediaQuery) |
CSSMediaRule |
addMediaQuery(int nIndex,
CSSMediaQuery aMediaQuery) |
CSSMediaRule |
addRule(ICSSTopLevelRule aRule) |
CSSMediaRule |
addRule(int nIndex,
ICSSTopLevelRule aRule) |
boolean |
equals(Object o) |
List<CSSMediaQuery> |
getAllMediaQueries() |
List<ICSSTopLevelRule> |
getAllRules() |
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) |
int |
getMediaQueryCount() |
ICSSTopLevelRule |
getRule(int nRuleIndex) |
int |
getRuleCount() |
CSSSourceLocation |
getSourceLocation() |
int |
hashCode() |
boolean |
hasMediaQueries() |
boolean |
hasRules() |
com.helger.commons.state.EChange |
removeAllMediaQueries()
Remove all media queries.
|
com.helger.commons.state.EChange |
removeAllRules()
Remove all rules.
|
com.helger.commons.state.EChange |
removeMediaQuery(CSSMediaQuery aMediaQuery) |
com.helger.commons.state.EChange |
removeMediaQuery(int nMediumIndex) |
com.helger.commons.state.EChange |
removeRule(ICSSTopLevelRule aRule) |
com.helger.commons.state.EChange |
removeRule(int nRuleIndex) |
void |
setSourceLocation(CSSSourceLocation aSourceLocation)
Set the source location of the object, determined while parsing.
|
String |
toString() |
public boolean hasMediaQueries()
@Nonnegative public int getMediaQueryCount()
@Nonnull public CSSMediaRule addMediaQuery(@Nonnull @Nonempty CSSMediaQuery aMediaQuery)
@Nonnull public CSSMediaRule addMediaQuery(@Nonnegative int nIndex, @Nonnull @Nonempty CSSMediaQuery aMediaQuery)
@Nonnull public com.helger.commons.state.EChange removeMediaQuery(@Nonnull CSSMediaQuery aMediaQuery)
@Nonnull public com.helger.commons.state.EChange removeMediaQuery(@Nonnegative int nMediumIndex)
@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)
@Nonnull @ReturnsMutableCopy public List<CSSMediaQuery> getAllMediaQueries()
public boolean hasRules()
@Nonnegative public int getRuleCount()
@Nonnull public CSSMediaRule addRule(@Nonnull ICSSTopLevelRule aRule)
@Nonnull public CSSMediaRule addRule(@Nonnegative int nIndex, @Nonnull ICSSTopLevelRule aRule)
@Nonnull public com.helger.commons.state.EChange removeRule(@Nonnull ICSSTopLevelRule aRule)
@Nonnull public com.helger.commons.state.EChange removeRule(@Nonnegative int nRuleIndex)
@Nonnull public com.helger.commons.state.EChange removeAllRules()
EChange.CHANGED if any rule was removed,
EChange.UNCHANGED otherwise. Never null.@Nullable public ICSSTopLevelRule getRule(@Nonnegative int nRuleIndex)
@Nonnull @ReturnsMutableCopy public List<ICSSTopLevelRule> getAllRules()
@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 levelpublic 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.