@NotThreadSafe public class CSSMediaQuery extends Object implements ICSSWriteable, ICSSSourceLocationAware
| Modifier and Type | Class and Description |
|---|---|
static class |
CSSMediaQuery.EModifier
A global modifier that can be used in front of a single CSS media query.
|
| Constructor and Description |
|---|
CSSMediaQuery(CSSMediaQuery.EModifier eModifier,
String sMedium)
Constructor
|
CSSMediaQuery(String sMedium)
Constructor without a modifier.
|
| Modifier and Type | Method and Description |
|---|---|
CSSMediaQuery |
addMediaExpression(CSSMediaExpression aMediaExpression)
Append a media expression to the list.
|
CSSMediaQuery |
addMediaExpression(int nIndex,
CSSMediaExpression aMediaExpression)
Add a media expression to the list at the specified index.
|
boolean |
equals(Object o) |
com.helger.commons.collection.impl.ICommonsList<CSSMediaExpression> |
getAllMediaExpressions() |
String |
getAsCSSString(ICSSWriterSettings aSettings,
int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to
an output.
|
CSSMediaExpression |
getMediaExpression(int nExpressionIndex)
Get the media expression at the specified index.
|
int |
getMediaExpressionCount() |
String |
getMedium() |
CSSMediaQuery.EModifier |
getModifier() |
CSSSourceLocation |
getSourceLocation() |
int |
hashCode() |
boolean |
hasMediaExpressions() |
boolean |
isNot() |
boolean |
isOnly() |
com.helger.commons.state.EChange |
removeAllMediaExpressions()
Remove all media expressions.
|
com.helger.commons.state.EChange |
removeMediaExpression(CSSMediaExpression aMediaExpression)
Remove the specified media expression.
|
com.helger.commons.state.EChange |
removeMediaExpression(int nExpressionIndex)
Remove the media expression at the specified index.
|
void |
setSourceLocation(CSSSourceLocation aSourceLocation)
Set the source location of the object, determined while parsing.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAsCSSString, getAsCSSStringpublic CSSMediaQuery(@Nullable String sMedium)
CSSMediaQuery.EModifier.NONE.sMedium - The medium to use. May be null.public CSSMediaQuery(@Nonnull CSSMediaQuery.EModifier eModifier, @Nullable String sMedium)
eModifier - The modifier to use. May not be null.sMedium - The medium to use. May be null.@Nonnull public final CSSMediaQuery.EModifier getModifier()
null.public final boolean isNot()
true if the modifier is CSSMediaQuery.EModifier.NOT.getModifier()public final boolean isOnly()
true if the modifier is CSSMediaQuery.EModifier.ONLY.getModifier()public boolean hasMediaExpressions()
true if at least a single media expression is present.@Nonnegative public int getMediaExpressionCount()
@Nonnull public CSSMediaQuery addMediaExpression(@Nonnull CSSMediaExpression aMediaExpression)
aMediaExpression - The media expression to be added. May not be null.@Nonnull public CSSMediaQuery addMediaExpression(@Nonnegative int nIndex, @Nonnull CSSMediaExpression aMediaExpression)
nIndex - The index where the media expression should be added. Must be ≥
0.aMediaExpression - The media expression to be added. May not be null.@Nonnull public com.helger.commons.state.EChange removeMediaExpression(@Nullable CSSMediaExpression aMediaExpression)
aMediaExpression - The media expression to be removed. May be null.EChange.CHANGED if removal succeeded,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange removeMediaExpression(int nExpressionIndex)
nExpressionIndex - The index of the media expression to be removed.EChange.CHANGED if removal succeeded,
EChange.UNCHANGED otherwise.@Nonnull public com.helger.commons.state.EChange removeAllMediaExpressions()
EChange.CHANGED if any media expression was removed,
EChange.UNCHANGED otherwise. Never null.@Nullable public CSSMediaExpression getMediaExpression(@Nonnegative int nExpressionIndex)
nExpressionIndex - The index to be retrieved.null if the index is < 0 or too large.@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSMediaExpression> getAllMediaExpressions()
null but 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.@Nullable public final CSSSourceLocation getSourceLocation()
getSourceLocation in interface ICSSSourceLocationAwarenull if an object was not read but manually
created.public final void setSourceLocation(@Nullable CSSSourceLocation aSourceLocation)
ICSSSourceLocationAwaresetSourceLocation in interface ICSSSourceLocationAwareaSourceLocation - The source location to use. May be null.Copyright © 2014–2022 Philip Helger. All rights reserved.