Interface DeclarationFormattingContext

All Known Subinterfaces:
StyleFormattingContext
All Known Implementing Classes:
ColorDeclarationFormattingContext, DefaultDeclarationFormattingContext, DefaultStyleFormattingContext, InlineStyleFormattingContext, RGBColorDeclarationFormattingContext

public interface DeclarationFormattingContext
Define methods for formatting properties or descriptors in a declaration, generally for a computed style.
See Also:
  • Method Details

    • startPropertyDeclaration

      void startPropertyDeclaration(SimpleWriter wri) throws IOException
      Starts a property declaration in a rule style (does not apply to inline styles).

      It is called before writing the property name.

      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • endPropertyDeclaration

      void endPropertyDeclaration(SimpleWriter wri) throws IOException
      Ends a property declaration in a rule style (does not apply to inline styles).

      It is called after writeSemiColon(SimpleWriter).

      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeColon

      void writeColon(SimpleWriter wri) throws IOException
      Serialize a colon to a SimpleWriter.
      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeComma

      void writeComma(SimpleWriter wri) throws IOException
      Serialize a comma to a SimpleWriter.
      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeFullIndent

      void writeFullIndent(SimpleWriter wri) throws IOException
      Serialize a full paragraph indent to a SimpleWriter.
      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeSemiColon

      void writeSemiColon(SimpleWriter wri) throws IOException
      Serialize a semicolon to a SimpleWriter.

      Called after writing the property name.

      Parameters:
      wri - the writer.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeURL

      void writeURL(SimpleWriter wri, String href) throws IOException
      Serialize a URL/URI to a SimpleWriter.
      Parameters:
      wri - the writer.
      href - the URI.
      Throws:
      IOException - if an I/O problem happens while writing to the SimpleWriter.
    • writeValue

      default void writeValue(SimpleWriter wri, String propertyName, CSSValue value) throws IOException
      Write a css value to the given writer.

      The default implementation calls CSSValue.writeCssText(SimpleWriter).

      Parameters:
      wri - the writer.
      propertyName - the name of the property whose value is being printed.
      value - the value to write.
      Throws:
      IOException - if an error happened while writing.
    • writeMinifiedValue

      default void writeMinifiedValue(SimpleWriter wri, String propertyName, CSSValue value) throws IOException
      Write a minified css value to the given writer.

      Note that in order to guarantee some consistency, shorthands may not use this method to minify values.

      The default implementation just writes CSSValue.getMinifiedCssText(String).

      Parameters:
      wri - the writer.
      propertyName - the name of the property whose value is being printed.
      value - the value to write.
      Throws:
      IOException - if an error happened while writing.