Class Stylesheet

java.lang.Object
com.openhtmltopdf.css.sheet.Stylesheet
All Implemented Interfaces:
RulesetContainer

public class Stylesheet
extends Object
implements RulesetContainer
A representation of a CSS style sheet. A Stylesheet has the sheet's rules in Ruleset, and has an origin--either user agent, user, or author. A Stylesheet can only be instantiated from a SAC CSSStyleSheet instance-- this would be the output of a SAC-compliant parser after parsing a CSS stream or source. A Stylesheet is immutable; after instantiation, you can query the origin and the Ruleset, but not modify either of them.
Author:
Torbjoern Gannholm, Patrick Wright
  • Constructor Details

    • Stylesheet

      public Stylesheet​(String uri, int origin)
      Creates a new instance of Stylesheet
      Parameters:
      uri -
      origin - user-agent, user or author from StylesheetInfo
  • Method Details

    • getOrigin

      public int getOrigin()
      Gets the origin attribute of the Stylesheet object
      Specified by:
      getOrigin in interface RulesetContainer
      Returns:
      The origin value: user-agent, user or author from StylesheetInfo
    • getURI

      public String getURI()
      Gets the URI of the Stylesheet object
      Returns:
      The URI
    • addContent

      public void addContent​(Ruleset ruleset)
      Specified by:
      addContent in interface RulesetContainer
    • addContent

      public void addContent​(MediaRule rule)
    • addContent

      public void addContent​(PageRule rule)
    • getContents

      public List<Object> getContents()
      Returns:
      a list containing page rules, media rules and rulesets in encounter order.
    • addImportRule

      public void addImportRule​(StylesheetInfo info)
    • getImportRules

      public List<StylesheetInfo> getImportRules()
    • addFontFaceRule

      public void addFontFaceRule​(FontFaceRule rule)
    • getFontFaceRules

      public List<FontFaceRule> getFontFaceRules()