Interface CSSStyleSheetFactory

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

public interface CSSStyleSheetFactory
CSS style sheet factory.
  • Field Details

  • Method Details

    • createStyleSheet

      ExtendedCSSStyleSheet<? extends ExtendedCSSRule> 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

      ExtendedCSSStyleDeclaration 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

      ExtendedCSSPrimitiveValue 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(ExtendedCSSStyleSheet<? extends ExtendedCSSRule> 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.
    • createUnmodifiableMediaQueryList

      @Deprecated MediaQueryList createUnmodifiableMediaQueryList(String media, Node owner)
      Deprecated.
      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.
      See Also:
    • 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.