Package com.openhtmltopdf.css.sheet
Class Stylesheet
- java.lang.Object
-
- com.openhtmltopdf.css.sheet.Stylesheet
-
- All Implemented Interfaces:
RulesetContainer
public class Stylesheet extends java.lang.Object implements RulesetContainer
A representation of a CSS style sheet. A Stylesheet has the sheet's rules inRuleset
, 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 theRuleset
, but not modify either of them.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.Object>
_contents
May contain page rules, media rules or rulesets.private java.util.List<FontFaceRule>
_fontFaceRules
private java.util.List<StylesheetInfo>
_importRules
private int
_origin
user-agent, user or author fromStylesheetInfo
private java.lang.String
_uri
-
Constructor Summary
Constructors Constructor Description Stylesheet(java.lang.String uri, int origin)
Creates a new instance of Stylesheet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContent(MediaRule rule)
void
addContent(PageRule rule)
void
addContent(Ruleset ruleset)
void
addFontFaceRule(FontFaceRule rule)
void
addImportRule(StylesheetInfo info)
java.util.List<java.lang.Object>
getContents()
java.util.List<FontFaceRule>
getFontFaceRules()
java.util.List<StylesheetInfo>
getImportRules()
int
getOrigin()
Gets the origin attribute of the Stylesheet objectjava.lang.String
getURI()
Gets the URI of the Stylesheet object
-
-
-
Field Detail
-
_uri
private final java.lang.String _uri
-
_origin
private final int _origin
user-agent, user or author fromStylesheetInfo
-
_fontFaceRules
private final java.util.List<FontFaceRule> _fontFaceRules
-
_importRules
private final java.util.List<StylesheetInfo> _importRules
-
_contents
private final java.util.List<java.lang.Object> _contents
May contain page rules, media rules or rulesets.
-
-
Method Detail
-
getOrigin
public int getOrigin()
Gets the origin attribute of the Stylesheet object- Specified by:
getOrigin
in interfaceRulesetContainer
- Returns:
- The origin value: user-agent, user or author from
StylesheetInfo
-
getURI
public java.lang.String getURI()
Gets the URI of the Stylesheet object- Returns:
- The URI
-
addContent
public void addContent(Ruleset ruleset)
- Specified by:
addContent
in interfaceRulesetContainer
-
addContent
public void addContent(MediaRule rule)
-
addContent
public void addContent(PageRule rule)
-
getContents
public java.util.List<java.lang.Object> getContents()
- Returns:
- a list containing page rules, media rules and rulesets in encounter order.
-
addImportRule
public void addImportRule(StylesheetInfo info)
-
getImportRules
public java.util.List<StylesheetInfo> getImportRules()
-
addFontFaceRule
public void addFontFaceRule(FontFaceRule rule)
-
getFontFaceRules
public java.util.List<FontFaceRule> getFontFaceRules()
-
-