Class KeyframesRule

java.lang.Object
io.sf.carte.doc.style.css.om.AbstractCSSRule
io.sf.carte.doc.style.css.om.KeyframesRule
All Implemented Interfaces:
CSSKeyframesRule, CSSRule, Serializable, org.w3c.dom.css.CSSRule

public class KeyframesRule extends AbstractCSSRule implements CSSKeyframesRule
Implementation of CSSKeyframesRule.
See Also:
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Description copied from interface: CSSKeyframesRule
      Gets the name of the keyframes.
      Specified by:
      getName in interface CSSKeyframesRule
      Returns:
      the name of the keyframes.
    • getCssRules

      public CSSRuleArrayList getCssRules()
      Description copied from interface: CSSKeyframesRule
      Gets the list of keyframe rules.
      Specified by:
      getCssRules in interface CSSKeyframesRule
      Returns:
      the list of keyframe rules.
    • appendRule

      public void appendRule(String rule) throws DOMException
      Appends a new rule into this keyframes rule collection.

      According to the specification this method does not throw exceptions, but for this library's use cases it seems reasonable to check for syntax errors.

      Specified by:
      appendRule in interface CSSKeyframesRule
      Parameters:
      rule - The parsable text representing the rule.
      Throws:
      DOMException - if there was a problem parsing the rule.
    • deleteRule

      public void deleteRule(String select)
      Description copied from interface: CSSKeyframesRule
      Deletes the last declared CSSKeyframeRule matching the specified keyframe selector from this keyframes rule collection. If no matching rule exists, the method does nothing.

      The number and order of the values in the specified keyframe selector must match those of the targeted keyframe rule(s). The match is not sensitive to white space around the values in the list.

      Specified by:
      deleteRule in interface CSSKeyframesRule
      Parameters:
      select - The keyframe selector of the rule to be deleted: a comma-separated list of keywords or percentage values between 0% and 100%.
    • findRule

      public CSSKeyframeRule findRule(String select) throws DOMException
      Description copied from interface: CSSKeyframesRule
      The findRule returns the last declared CSSKeyframeRule matching the specified keyframe selector. If no matching rule exists, the method does nothing.
      Specified by:
      findRule in interface CSSKeyframesRule
      Parameters:
      select - The keyframe selector of the rule to be deleted: a comma-separated list of keywords or percentage values between 0% and 100%.
      Returns:
      the found rule, or null if no rule was found.
      Throws:
      DOMException
    • getCssText

      public String getCssText()
      Specified by:
      getCssText in interface org.w3c.dom.css.CSSRule
      Specified by:
      getCssText in class AbstractCSSRule
    • getMinifiedCssText

      public String getMinifiedCssText()
      Description copied from class: AbstractCSSRule
      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 CSSRule
      Returns:
      the minified textual representation of the rule.
    • writeCssText

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

      public void setCssText(String cssText) throws DOMException
      Specified by:
      setCssText in interface org.w3c.dom.css.CSSRule
      Overrides:
      setCssText in class AbstractCSSRule
      Throws:
      DOMException
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      public KeyframesRule clone(AbstractCSSStyleSheet parentSheet)
      Description copied from class: AbstractCSSRule
      Obtain a clone of this rule whose parent sheet is parentSheet.
      Specified by:
      clone in class AbstractCSSRule
      Parameters:
      parentSheet - the parent sheet for the new rule.
      Returns:
      a clone of this rule with the given parent sheet.
    • getType

      public short getType()
      Specified by:
      getType in interface org.w3c.dom.css.CSSRule
      Specified by:
      getType in class AbstractCSSRule
    • getParentStyleSheet

      public AbstractCSSStyleSheet getParentStyleSheet()
      Description copied from interface: CSSRule
      Get the style sheet that contains this rule.
      Specified by:
      getParentStyleSheet in interface CSSRule
      Specified by:
      getParentStyleSheet in interface org.w3c.dom.css.CSSRule
      Specified by:
      getParentStyleSheet in class AbstractCSSRule
      Returns:
      the style sheet, or null if no sheet contains this rule.
    • createSACParser

      protected Parser createSACParser() throws DOMException
      Throws:
      DOMException
    • getParentRule

      public AbstractCSSRule getParentRule()
      Description copied from interface: CSSRule
      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 org.w3c.dom.css.CSSRule
      Specified by:
      getParentRule in class AbstractCSSRule
      Returns:
      the containing rule, if any, otherwise null.
    • setParentRule

      public void setParentRule(AbstractCSSRule parent)
      Sets the parent CSS rule, in case this rule is contained by another.
      Specified by:
      setParentRule in class AbstractCSSRule
      Parameters:
      parent - the parent rule.
    • getOrigin

      public byte getOrigin()
      Description copied from class: AbstractCSSRule
      Get the origin of this rule (user agent sheet, author, user).
      Specified by:
      getOrigin in class AbstractCSSRule
      Returns:
      the origin of this rule.
    • enablePrecedingComments

      public void enablePrecedingComments()
      Description copied from class: AbstractCSSRule
      If this rule does not contain a preceding comment list, create one.

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

      Specified by:
      enablePrecedingComments in class AbstractCSSRule
    • getPrecedingComments

      public StringList getPrecedingComments()
      Description copied from interface: CSSRule
      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:
    • enableTrailingComments

      public void enableTrailingComments()
      Description copied from class: AbstractCSSRule
      If this rule does not contain a trailing comment list, create one.

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

      Specified by:
      enableTrailingComments in class AbstractCSSRule
    • getTrailingComments

      public StringList getTrailingComments()
      Description copied from interface: CSSRule
      Get a list of the comments that immediately follow this rule, if any.

      If the parsing mode was COMMENTS_PRECEDING, or was COMMENTS_AUTO and the next comment happens after a newline character, it shall be assigned to the next rule as a preceding comment.

      Returns:
      the list of comments, or null if there were no trailing comments or the parsing was specified to ignore comments.
      See Also:
    • getStyleFormattingContext

      protected StyleFormattingContext getStyleFormattingContext()
    • getURL

      protected URL getURL(String uri) throws MalformedURLException
      Gets an URL for the given URI, taking into account the parent CSS Base URL if appropriate.
      Parameters:
      uri - the uri.
      Returns:
      the absolute URL.
      Throws:
      MalformedURLException - if the uri was wrong.