Interface DeclarationFormattingContext

All Known Subinterfaces:
StyleFormattingContext
All Known Implementing Classes:
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 Summary

    Modifier and Type
    Method
    Description
    void
    endPropertyDeclaration(io.sf.carte.util.SimpleWriter wri)
    Ends a property declaration in a rule style (does not apply to inline styles).
    void
    startPropertyDeclaration(io.sf.carte.util.SimpleWriter wri)
    Starts a property declaration in a rule style (does not apply to inline styles).
    void
    writeColon(io.sf.carte.util.SimpleWriter wri)
    Serialize a colon to a SimpleWriter.
    void
    writeComma(io.sf.carte.util.SimpleWriter wri)
    Serialize a comma to a SimpleWriter.
    void
    writeFullIndent(io.sf.carte.util.SimpleWriter wri)
    Serialize a full paragraph indent to a SimpleWriter.
    default void
    writeMinifiedValue(io.sf.carte.util.SimpleWriter wri, String propertyName, CSSValue value)
    Write a minified css value to the given writer.
    void
    writeSemiColon(io.sf.carte.util.SimpleWriter wri)
    Serialize a semicolon to a SimpleWriter.
    void
    writeURL(io.sf.carte.util.SimpleWriter wri, String href)
    Serialize a URL/URI to a SimpleWriter.
    default void
    writeValue(io.sf.carte.util.SimpleWriter wri, String propertyName, CSSValue value)
    Write a css value to the given writer.
  • Method Details

    • startPropertyDeclaration

      void startPropertyDeclaration(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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(io.sf.carte.util.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.