Class AbstractCSSRule

java.lang.Object
io.sf.carte.doc.style.css.om.AbstractCSSRule
All Implemented Interfaces:
ExtendedCSSRule, CSSRule
Direct Known Subclasses:
BaseCSSDeclarationRule, FontFeatureValuesRule, GroupingRule, ImportRule, KeyframesRule, NamespaceRule, UnknownRule

public abstract class AbstractCSSRule extends Object implements ExtendedCSSRule
Abstract class to be inherited by all CSS rules.
  • Constructor Details

    • AbstractCSSRule

      public AbstractCSSRule()
  • Method Details

    • getType

      public abstract short getType()
      Specified by:
      getType in interface CSSRule
    • getCssText

      public abstract String getCssText()
      Specified by:
      getCssText in interface CSSRule
    • setCssText

      public void setCssText(String cssText) throws DOMException
      Specified by:
      setCssText in interface CSSRule
      Throws:
      DOMException
    • getMinifiedCssText

      public abstract String getMinifiedCssText()
      A minified parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.
      Specified by:
      getMinifiedCssText in interface ExtendedCSSRule
      Returns:
      the minified textual representation of the rule.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeCssText

      public abstract void writeCssText(SimpleWriter wri, StyleFormattingContext context) throws IOException
      Description copied from interface: ExtendedCSSRule
      Write a serialization of this rule to the given simple writer, according to the given context.
      Specified by:
      writeCssText in interface ExtendedCSSRule
      Parameters:
      wri - the simple writer object.
      context - the formatting context.
      Throws:
      IOException - if an error happened while writing.
    • getParentStyleSheet

      public abstract AbstractCSSStyleSheet getParentStyleSheet()
      Description copied from interface: ExtendedCSSRule
      Get the style sheet that contains this rule.
      Specified by:
      getParentStyleSheet in interface CSSRule
      Specified by:
      getParentStyleSheet in interface ExtendedCSSRule
      Returns:
      the style sheet, or null if no sheet contains this rule.
    • getParentRule

      public abstract AbstractCSSRule getParentRule()
      Description copied from interface: ExtendedCSSRule
      If this rule is contained inside another rule, return that rule. If it is not nested inside any other rules, return null.
      Specified by:
      getParentRule in interface CSSRule
      Specified by:
      getParentRule in interface ExtendedCSSRule
      Returns:
      the containing rule, if any, otherwise null.
    • setParentRule

      public abstract void setParentRule(AbstractCSSRule parent)
    • getOrigin

      public abstract byte getOrigin()
      Get the origin of this rule (user agent sheet, author, user).
      Returns:
      the origin of this rule.
    • enablePrecedingComments

      public abstract void enablePrecedingComments(int initialSize)
      If this rule does not contain a preceding comment list, create one with the given initial capacity.

      If this rule already has a comment list, does nothing.

      Parameters:
      initialSize - the initial capacity.
    • getPrecedingComments

      public abstract List<String> getPrecedingComments()
      Get a list of the comments that preceded this rule, if any.
      Returns:
      the list of comments, or null if there were no preceding comments or the parsing was specified to ignore comments.
      See Also:
    • clone

      public abstract AbstractCSSRule clone(AbstractCSSStyleSheet parentSheet)
      Obtain a clone of this rule whose parent sheet is parentSheet.
      Specified by:
      clone in interface ExtendedCSSRule
      Parameters:
      parentSheet - the parent sheet for the new rule.
      Returns:
      a clone of this rule with the given parent sheet.