Class CSSMediaRule

    • Constructor Detail

      • CSSMediaRule

        public CSSMediaRule()
    • Method Detail

      • hasMediaQueries

        public boolean hasMediaQueries()
        Returns:
        true if at least one media query is present, false if no media query is present.
      • getMediaQueryCount

        @Nonnegative
        public int getMediaQueryCount()
        Returns:
        The number of contained media queries. Always ≥ 0.
      • addMediaQuery

        @Nonnull
        public CSSMediaRule addMediaQuery​(@Nonnull @Nonempty
                                          CSSMediaQuery aMediaQuery)
        Add a new media query.
        Parameters:
        aMediaQuery - The media query to be added. May not be null.
        Returns:
        this for chaining
      • removeMediaQuery

        @Nonnull
        public com.helger.commons.state.EChange removeMediaQuery​(@Nullable
                                                                 CSSMediaQuery aMediaQuery)
        Remove the provided media query.
        Parameters:
        aMediaQuery - The media query to be removed. May be null.
        Returns:
        EChange.
      • removeMediaQuery

        @Nonnull
        public com.helger.commons.state.EChange removeMediaQuery​(@Nonnegative
                                                                 int nMediumIndex)
        Remove the media query at the provided index.
        Parameters:
        nMediumIndex - The index to be removed. Should be ≥ 0.
        Returns:
        EChange.
      • removeAllMediaQueries

        @Nonnull
        public com.helger.commons.state.EChange removeAllMediaQueries()
        Remove all media queries.
        Returns:
        EChange.CHANGED if any media query was removed, EChange.UNCHANGED otherwise. Never null.
        Since:
        3.7.3
      • getMediaQueryAtIndex

        @Nullable
        public CSSMediaQuery getMediaQueryAtIndex​(@Nonnegative
                                                  int nMediumIndex)
        Get the media query at the specified index or null.
        Parameters:
        nMediumIndex - The index to be retrieved. Should be ≥ 0.
        Returns:
        null if an invalid index was provided.
      • getAllMediaQueries

        @Nonnull
        @ReturnsMutableCopy
        public com.helger.commons.collection.impl.ICommonsList<CSSMediaQuery> getAllMediaQueries()
        Returns:
        A copy of all contained media queries. Never null. Maybe empty.
      • getAsCSSString

        @Nonnull
        @Nonempty
        public String getAsCSSString​(@Nonnull
                                     ICSSWriterSettings aSettings,
                                     @Nonnegative
                                     int nIndentLevel)
        Description copied from interface: ICSSWriteable
        Get the contents of this object as a serialized CSS string for writing to an output.
        Specified by:
        getAsCSSString in interface ICSSWriteable
        Parameters:
        aSettings - The settings to be used to format the output. May not be null.
        nIndentLevel - The current indentation level
        Returns:
        The content of this object as CSS string. Never null.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object