Interface IHasCSSDeclarations<IMPLTYPE extends IHasCSSDeclarations<IMPLTYPE>>

    • Method Detail

      • addDeclaration

        @Nonnull
        IMPLTYPE addDeclaration​(@Nonnull
                                CSSDeclaration aDeclaration)
        Add a new declaration.
        Parameters:
        aDeclaration - The declaration to be added. May not be null.
        Returns:
        this
      • addDeclaration

        @Nonnull
        default IMPLTYPE addDeclaration​(@Nonnull @Nonempty
                                        String sProperty,
                                        @Nonnull
                                        CSSExpression aExpression,
                                        boolean bImportant)
        Add a new declaration.
        Parameters:
        sProperty - The name of the property. E.g. "color". May neither be null nor empty.
        aExpression - The value of the property. May not be null.
        bImportant - true if it is important, false if not.
        Returns:
        this
      • removeDeclaration

        @Nonnull
        com.helger.commons.state.EChange removeDeclaration​(@Nonnull
                                                           CSSDeclaration aDeclaration)
        Remove the given declaration
        Parameters:
        aDeclaration - The declaration to be removed. May not be null.
        Returns:
        EChange.CHANGED if the declaration was successfully removed
      • removeDeclaration

        @Nonnull
        com.helger.commons.state.EChange removeDeclaration​(@Nonnegative
                                                           int nDeclarationIndex)
        Remove the declaration at the specified index
        Parameters:
        nDeclarationIndex - The index of the declaration to be removed. Must be ≥ 0.
        Returns:
        EChange.CHANGED if the declaration was successfully removed, EChange.UNCHANGED if the index was invalid.
      • removeAllDeclarations

        @Nonnull
        com.helger.commons.state.EChange removeAllDeclarations()
        Remove all declarations.
        Returns:
        EChange.CHANGED if any declaration was removed, EChange.UNCHANGED otherwise. Never null.
        Since:
        3.7.3
      • getAllDeclarations

        @Nonnull
        @ReturnsMutableCopy
        com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarations()
        Returns:
        A mutable, non-null copy of all contained declarations.
      • getDeclarationAtIndex

        @Nullable
        CSSDeclaration getDeclarationAtIndex​(@Nonnegative
                                             int nIndex)
        Parameters:
        nIndex - The index to retrieve
        Returns:
        The declaration at the specified index or null if the index is invalid
      • setDeclarationAtIndex

        @Nonnull
        IMPLTYPE setDeclarationAtIndex​(@Nonnegative
                                       int nIndex,
                                       @Nonnull
                                       CSSDeclaration aNewDeclaration)
        Set the declaration at the specified index with a new one. If an existing declaration is present at that index, it is overwritten.
        Parameters:
        nIndex - The index to retrieve. Must be ≥ 0. If the index is ≥ than getDeclarationCount(), it behaves like addDeclaration(CSSDeclaration).
        aNewDeclaration - The new declaration to be set.
        Returns:
        this
      • hasDeclarations

        boolean hasDeclarations()
        Returns:
        true if at least one declaration is present, false if no declaration is present.
      • getDeclarationCount

        @Nonnegative
        int getDeclarationCount()
        Returns:
        The number of contained declarations. Always ≥ 0.
      • getDeclarationOfPropertyName

        @Nullable
        CSSDeclaration getDeclarationOfPropertyName​(@Nullable
                                                    String sPropertyName)
        Get the first declaration with the specified property name. If no such property name is present, null is 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).
        Parameters:
        sPropertyName - The property name of the declaration to search (e.g. color). May be null.
        Returns:
        null if no such property name was found.
        Since:
        3.7.4
      • getDeclarationOfPropertyNameCaseInsensitive

        @Nullable
        @Deprecated
        default CSSDeclaration getDeclarationOfPropertyNameCaseInsensitive​(@Nullable
                                                                           String sPropertyName)
        Deprecated.
        Since 6.0.0 - use getDeclarationOfPropertyName(String) instead.
        Get the first declaration with the specified property name. If no such property name is present, null is 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.
        Parameters:
        sPropertyName - The property name of the declaration to search (e.g. color). May be null.
        Returns:
        null if no such property name was found.
        Since:
        3.7.4
      • getAllDeclarationsOfPropertyName

        @Nonnull
        @ReturnsMutableCopy
        com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarationsOfPropertyName​(@Nullable
                                                                                                         String sPropertyName)
        Get all declarations within this list that have the specified property name. The comparison happens case insensitive (since v6.0.0).
        Parameters:
        sPropertyName - The property name of the declaration to search (e.g. color). May be null.
        Returns:
        Never null but maybe an empty list.
        Since:
        3.7.4
      • getAllDeclarationsOfPropertyNameCaseInsensitive

        @Nonnull
        @ReturnsMutableCopy
        @Deprecated
        default com.helger.commons.collection.impl.ICommonsList<CSSDeclaration> getAllDeclarationsOfPropertyNameCaseInsensitive​(@Nullable
                                                                                                                                String sPropertyName)
        Deprecated.
        Since 6.0.0 - use getAllDeclarationsOfPropertyName(String) instead.
        Get all declarations within this list that have the specified property name. The comparison happens case insensitive.
        Parameters:
        sPropertyName - The property name of the declaration to search (e.g. color). May be null.
        Returns:
        Never null but maybe an empty list.
        Since:
        3.7.4