Interface CSSStyleSheetFactory

All Known Implementing Classes:
AbstractCSSStyleSheetFactory, BaseCSSStyleSheetFactory, CSSDOMImplementation, DOMCSSStyleSheetFactory

public interface CSSStyleSheetFactory
CSS style sheet factory.
  • Field Details

  • Method Details

    • createStyleSheet

      CSSStyleSheet<? extends CSSRule> createStyleSheet(String title, MediaQueryList media)
      Creates a stand-alone author style sheet.

      Parameters:
      title - the advisory title.
      media - the target media for style.
      Returns:
      the style sheet.
    • createAnonymousStyleDeclaration

      CSSStyleDeclaration createAnonymousStyleDeclaration(Node node)
      Create a style declaration for an anonymous inline box, associated to a text/cdata node.
      Parameters:
      node - the node that has the declaration associated to it.
      Returns:
      the anonymous style declaration.
    • getUserAgentStyleSheet

      DocumentCSSStyleSheet getUserAgentStyleSheet(CSSDocument.ComplianceMode mode)
      Gets the User Agent default CSS style sheet to be used by this factory.
      Parameters:
      mode - the compliance mode.
      Returns:
      the default style sheet, or an empty sheet if no User Agent sheet was defined.
    • setDefaultHTMLUserAgentSheet

      void setDefaultHTMLUserAgentSheet()
      Sets a default HTML default style sheet as the user agent style sheet.
    • setUserStyleSheet

      void setUserStyleSheet(Reader re) throws DOMException, IOException
      Sets the CSS style sheet defined by the end-user.

      The sheet in the supplied reader should contain user preferences, and will be appropriately merged with the other style sheets.

      Parameters:
      re - the reader with the user style sheet.
      Throws:
      DOMException - if a problem is found parsing the sheet.
      IOException - if there is a problem retrieving the reader.
    • setFactoryFlag

      void setFactoryFlag(byte flag)
      Set a configuration flag. Do not confuse with NSAC flags, which must be set at this object's creation time (see the documentation for implementation's constructors).

      The flags are implementation-dependent.

      Parameters:
      flag - the flag to set.
    • setLenientSystemValues

      void setLenientSystemValues(boolean lenient)
      Set the value of the lenientSystemValues flag. Do not confuse this flag with the NSAC flags.

      The style sheet factories provide system default values, and its behaviour depends on a lenientSystemValues flag. The lenient flag allows to compute values by giving reasonable defaults to properties with system-dependent initial values: '#000000' for color and 'serif' for font-family.

      If you work with style databases you do not need lenientSystemValues.

      Default value is true.

      Parameters:
      lenient - true or false to enable/disable the lenientSystemValues flag.
    • getSystemDefaultValue

      CSSTypedValue getSystemDefaultValue(String propertyName)
      Get a system default value for the given property.

      If the lenientSystemValues flag is true, returns a reasonable default for the property. Otherwise, it returns a system default meta-value.

      Parameters:
      propertyName - the property name.
      Returns:
      the system default css primitive value.
    • createStyleDeclarationErrorHandler

      StyleDeclarationErrorHandler createStyleDeclarationErrorHandler(CSSDeclarationRule rule)
      Create a new StyleDeclarationErrorHandler for the given style rule.
      Parameters:
      rule - the declaration rule the handler is for.
      Returns:
      the StyleDeclarationErrorHandler.
    • createInlineStyleErrorHandler

      StyleDeclarationErrorHandler createInlineStyleErrorHandler(CSSElement owner)
      Create a new StyleDeclarationErrorHandler for the given style rule.
      Parameters:
      owner - the element owner of the inline style.
      Returns:
      the StyleDeclarationErrorHandler.
    • createSheetErrorHandler

      SheetErrorHandler createSheetErrorHandler(CSSStyleSheet<? extends CSSRule> sheet)
      Creates a style sheet error handler.
      Parameters:
      sheet - the style sheet whose errors are to be handled.
      Returns:
      the error handler.
    • createMediaQueryList

      MediaQueryList createMediaQueryList(String mediaQueryString, Node owner)
      Parses mediaQueryString and creates a new media query list.
      Parameters:
      mediaQueryString - the media query string.
      owner - the node that would handle errors, if any.
      Returns:
      a new media list for mediaQueryString.
    • createImmutableMediaQueryList

      MediaQueryList createImmutableMediaQueryList(String media, Node owner)
      Parses and creates an immutable media query list for the given media.
      Parameters:
      media - the comma-separated list of media. If null, the media list will be for all media.
      owner - the node that would handle errors, if any.
      Returns:
      the immutable media list.
    • createPropertyDefinition

      CSSPropertyDefinition createPropertyDefinition(String name, CSSValueSyntax syntax, boolean inherited, CSSLexicalValue initialValue) throws DOMException
      Create a property definition.

      To parse the syntax, use a parser like SyntaxParser.

      Parameters:
      name - the property name (unescaped).
      syntax - the syntax.
      inherited - whether the property is inherited or not.
      initialValue - the initial value.
      Returns:
      the property definition.
      Throws:
      DOMException - INVALID_ACCESS_ERR if the initial value does not match the syntax.
    • getStyleFormattingFactory

      StyleFormattingFactory getStyleFormattingFactory()
      Get the style formatting factory to be used with this sheet factory.
      Returns:
      the style formatting factory.
    • setStyleFormattingFactory

      void setStyleFormattingFactory(StyleFormattingFactory factory)
      Set a style formatting factory to format style serializations made with sheets created by this sheet factory.
      Parameters:
      factory - the style formatting factory.
    • getDeviceFactory

      DeviceFactory getDeviceFactory()
      Gets the device factory.
      Returns:
      the device factory.