@NotThreadSafe public class CSSImportRule extends Object implements ICSSWriteable, ICSSSourceLocationAware
@import url("style.css") screen;
Constructor and Description |
---|
CSSImportRule(CSSURI aLocation) |
CSSImportRule(String sLocation) |
Modifier and Type | Method and Description |
---|---|
CSSImportRule |
addMediaQuery(CSSMediaQuery aMediaQuery)
Add a media query at the end of the list.
|
CSSImportRule |
addMediaQuery(int nIndex,
CSSMediaQuery aMediaQuery)
Add a media query at the specified index of the list.
|
boolean |
equals(Object o) |
List<CSSMediaQuery> |
getAllMediaQueries() |
String |
getAsCSSString(ICSSWriterSettings aSettings,
int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to
an output.
|
CSSURI |
getLocation() |
String |
getLocationString() |
int |
getMediaQueryCount() |
CSSSourceLocation |
getSourceLocation() |
int |
hashCode() |
boolean |
hasMediaQueries() |
com.helger.commons.state.EChange |
removeAllMediaQueries()
Remove all contained media queries.
|
com.helger.commons.state.EChange |
removeMediaQuery(CSSMediaQuery aMediaQuery)
Remove the specified media query.
|
com.helger.commons.state.EChange |
removeMediaQuery(int nMediumIndex)
Remove the media query at the specified index.
|
CSSImportRule |
setLocation(CSSURI aLocation)
Set the URI of the file to be imported.
|
CSSImportRule |
setLocationString(String sLocationURI)
Set the URI of the file to be imported.
|
void |
setSourceLocation(CSSSourceLocation aSourceLocation)
Set the source location of the object, determined while parsing.
|
String |
toString() |
public boolean hasMediaQueries()
true
if this import rule has any specific media
queries, to which it belongs, false
if not.@Nonnegative public int getMediaQueryCount()
@Nonnull public CSSImportRule addMediaQuery(@Nonnull CSSMediaQuery aMediaQuery)
aMediaQuery
- The media query to be added. May not be null
.@Nonnull public CSSImportRule addMediaQuery(@Nonnegative int nIndex, @Nonnull CSSMediaQuery aMediaQuery)
nIndex
- The index where to add the media query. Must be ≥ 0.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.CHANGED
if removal was successful.@Nonnull public com.helger.commons.state.EChange removeMediaQuery(int nMediumIndex)
nMediumIndex
- The index of the media query to be removed.EChange.CHANGED
if removal was successful.@Nonnull public com.helger.commons.state.EChange removeAllMediaQueries()
EChange.CHANGED
if at least one media query was contained.@Nonnull @ReturnsMutableCopy public List<CSSMediaQuery> getAllMediaQueries()
null
and always a copy of the underlying list.@Nonnull public CSSURI getLocation()
null
.@Nonnull @Nonempty public String getLocationString()
null
. This is
a shortcut for getLocation().getURI()
@Nonnull public CSSImportRule setLocation(@Nonnull CSSURI aLocation)
aLocation
- The location to use. May not be null
.@Nonnull public CSSImportRule setLocationString(@Nonnull String sLocationURI)
sLocationURI
- The location URI to use. May not be null
.@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
ICSSWriteable
getAsCSSString
in interface ICSSWriteable
aSettings
- The settings to be used to format the output. May not be
null
.nIndentLevel
- The current indentation levelpublic void setSourceLocation(@Nullable CSSSourceLocation aSourceLocation)
ICSSSourceLocationAware
setSourceLocation
in interface ICSSSourceLocationAware
aSourceLocation
- The source location to use. May be null
.@Nullable public CSSSourceLocation getSourceLocation()
getSourceLocation
in interface ICSSSourceLocationAware
null
if an object was not read but manually
created.Copyright © 2014–2015 Philip Helger. All rights reserved.