Package com.helger.css.decl
Class CSSKeyframesBlock
- java.lang.Object
-
- com.helger.css.decl.CSSKeyframesBlock
-
- All Implemented Interfaces:
com.helger.commons.traits.IGenericImplTrait<CSSKeyframesBlock>,IHasCSSDeclarations<CSSKeyframesBlock>,ICSSSourceLocationAware,ICSSVersionAware,ICSSWriteable
@NotThreadSafe public class CSSKeyframesBlock extends Object implements IHasCSSDeclarations<CSSKeyframesBlock>, ICSSVersionAware, ICSSSourceLocationAware
keyframes block- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description CSSKeyframesBlock(Iterable<String> aKeyframesSelectors)CSSKeyframesBlock(String... aKeyframesSelectors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CSSKeyframesBlockaddDeclaration(int nIndex, CSSDeclaration aNewDeclaration)Add a new declaration at the specified index.CSSKeyframesBlockaddDeclaration(CSSDeclaration aDeclaration)Add a new declaration.booleanequals(Object o)com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>getAllDeclarations()com.helger.commons.collection.impl.ICommonsList<CSSDeclaration>getAllDeclarationsOfPropertyName(String sPropertyName)Get all declarations within this list that have the specified property name.com.helger.commons.collection.impl.ICommonsList<String>getAllKeyframesSelectors()StringgetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel)Get the contents of this object as a serialized CSS string for writing to an output.CSSDeclarationgetDeclarationAtIndex(int nIndex)intgetDeclarationCount()CSSDeclarationgetDeclarationOfPropertyName(String sPropertyName)Get the first declaration with the specified property name.ECSSVersiongetMinimumCSSVersion()CSSSourceLocationgetSourceLocation()booleanhasDeclarations()inthashCode()com.helger.commons.state.EChangeremoveAllDeclarations()Remove all declarations.com.helger.commons.state.EChangeremoveDeclaration(int nDeclarationIndex)Remove the declaration at the specified indexcom.helger.commons.state.EChangeremoveDeclaration(CSSDeclaration aDeclaration)Remove the given declarationCSSKeyframesBlocksetDeclarationAtIndex(int nIndex, CSSDeclaration aNewDeclaration)Set the declaration at the specified index with a new one.voidsetSourceLocation(CSSSourceLocation aSourceLocation)Set the source location of the object, determined while parsing.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
Methods inherited from interface com.helger.css.decl.IHasCSSDeclarations
addDeclaration, getAllDeclarationsOfPropertyNameCaseInsensitive, getDeclarationOfPropertyNameCaseInsensitive
-
-
-
-
Method Detail
-
getAllKeyframesSelectors
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<String> getAllKeyframesSelectors()
-
addDeclaration
@Nonnull public CSSKeyframesBlock addDeclaration(@Nonnull CSSDeclaration aDeclaration)
Description copied from interface:IHasCSSDeclarationsAdd a new declaration.- Specified by:
addDeclarationin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
aDeclaration- The declaration to be added. May not benull.- Returns:
- this
-
addDeclaration
@Nonnull public CSSKeyframesBlock addDeclaration(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration)
Description copied from interface:IHasCSSDeclarationsAdd a new declaration at the specified index.- Specified by:
addDeclarationin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
nIndex- The index to retrieve. Must be ≥ 0. If the index is ≥ thangetDeclarationCount(), it behaves likeIHasCSSDeclarations.addDeclaration(CSSDeclaration).aNewDeclaration- The declaration to be added. May not benull.- Returns:
- this
-
removeDeclaration
@Nonnull public com.helger.commons.state.EChange removeDeclaration(@Nonnull CSSDeclaration aDeclaration)
Description copied from interface:IHasCSSDeclarationsRemove the given declaration- Specified by:
removeDeclarationin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
aDeclaration- The declaration to be removed. May not benull.- Returns:
EChange.CHANGEDif the declaration was successfully removed
-
removeDeclaration
@Nonnull public com.helger.commons.state.EChange removeDeclaration(@Nonnegative int nDeclarationIndex)
Description copied from interface:IHasCSSDeclarationsRemove the declaration at the specified index- Specified by:
removeDeclarationin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
nDeclarationIndex- The index of the declaration to be removed. Must be ≥ 0.- Returns:
EChange.CHANGEDif the declaration was successfully removed,EChange.UNCHANGEDif the index was invalid.
-
removeAllDeclarations
@Nonnull public com.helger.commons.state.EChange removeAllDeclarations()
Description copied from interface:IHasCSSDeclarationsRemove all declarations.- Specified by:
removeAllDeclarationsin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Returns:
EChange.CHANGEDif any declaration was removed,EChange.UNCHANGEDotherwise. Nevernull.
-
getAllDeclarations
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarations()
- Specified by:
getAllDeclarationsin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Returns:
- A mutable, non-
nullcopy of all contained declarations.
-
getDeclarationAtIndex
@Nullable public CSSDeclaration getDeclarationAtIndex(@Nonnegative int nIndex)
- Specified by:
getDeclarationAtIndexin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
nIndex- The index to retrieve- Returns:
- The declaration at the specified index or
nullif the index is invalid
-
setDeclarationAtIndex
@Nonnull public CSSKeyframesBlock setDeclarationAtIndex(@Nonnegative int nIndex, @Nonnull CSSDeclaration aNewDeclaration)
Description copied from interface:IHasCSSDeclarationsSet the declaration at the specified index with a new one. If an existing declaration is present at that index, it is overwritten.- Specified by:
setDeclarationAtIndexin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
nIndex- The index to retrieve. Must be ≥ 0. If the index is ≥ thangetDeclarationCount(), it behaves likeIHasCSSDeclarations.addDeclaration(CSSDeclaration).aNewDeclaration- The new declaration to be set.- Returns:
- this
-
hasDeclarations
public boolean hasDeclarations()
- Specified by:
hasDeclarationsin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Returns:
trueif at least one declaration is present,falseif no declaration is present.
-
getDeclarationCount
@Nonnegative public int getDeclarationCount()
- Specified by:
getDeclarationCountin interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Returns:
- The number of contained declarations. Always ≥ 0.
-
getDeclarationOfPropertyName
@Nullable public CSSDeclaration getDeclarationOfPropertyName(@Nullable String sPropertyName)
Description copied from interface:IHasCSSDeclarationsGet the first declaration with the specified property name. If no such property name is present,nullis returned. If more than one declaration ith the specified property name is present, always the first in the list will be returned. The comparison happens case insensitive (since v6.0.0).- Specified by:
getDeclarationOfPropertyNamein interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
sPropertyName- The property name of the declaration to search (e.g.color). May benull.- Returns:
nullif no such property name was found.
-
getAllDeclarationsOfPropertyName
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarationsOfPropertyName(@Nullable String sPropertyName)
Description copied from interface:IHasCSSDeclarationsGet all declarations within this list that have the specified property name. The comparison happens case insensitive (since v6.0.0).- Specified by:
getAllDeclarationsOfPropertyNamein interfaceIHasCSSDeclarations<CSSKeyframesBlock>- Parameters:
sPropertyName- The property name of the declaration to search (e.g.color). May benull.- Returns:
- Never
nullbut maybe an empty list.
-
getAsCSSString
@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
Description copied from interface:ICSSWriteableGet the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSStringin interfaceICSSWriteable- Parameters:
aSettings- The settings to be used to format the output. May not benull.nIndentLevel- The current indentation level- Returns:
- The content of this object as CSS string. Never
null.
-
getMinimumCSSVersion
@Nonnull public ECSSVersion getMinimumCSSVersion()
- Specified by:
getMinimumCSSVersionin interfaceICSSVersionAware- Returns:
- The minimum CSS version that is required to read or write this
artifact. May not be
null.
-
getSourceLocation
@Nullable public final CSSSourceLocation getSourceLocation()
- Specified by:
getSourceLocationin interfaceICSSSourceLocationAware- Returns:
- The source location of this object when it was read by the parser.
May be
nullif an object was not read but manually created.
-
setSourceLocation
public final void setSourceLocation(@Nullable CSSSourceLocation aSourceLocation)
Description copied from interface:ICSSSourceLocationAwareSet the source location of the object, determined while parsing.- Specified by:
setSourceLocationin interfaceICSSSourceLocationAware- Parameters:
aSourceLocation- The source location to use. May benull.
-
-