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.

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

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

      DocumentCSSStyleSheet getUserAgentStyleSheet(CSSDocument.ComplianceMode mode)
      Gets the User Agent default CSS style sheet to be used by this factory.
      mode - the compliance mode.
      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.

      re - the reader with the user style sheet.
      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.

      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.

      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.

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

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

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

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

      MediaQueryList createMediaQueryList(String mediaQueryString, Node owner)
      Parses mediaQueryString and creates a new media query list.
      mediaQueryString - the media query string.
      owner - the node that would handle errors, if any.
      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.
      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.
      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.

      name - the property name (unescaped).
      syntax - the syntax.
      inherited - whether the property is inherited or not.
      initialValue - the initial value.
      the property definition.
      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.
      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.
      factory - the style formatting factory.
    • getDeviceFactory

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