Top Description Fields Constructors Methods
com.openhtmltopdf.css.sheet

public Class Stylesheet

extends Object
implements RulesetContainer
Class Inheritance
All Implemented Interfaces
com.openhtmltopdf.css.sheet.RulesetContainer
Imports
java.util.ArrayList, .List

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.
Authors
Torbjoern Gannholm, Patrick Wright

Field Summary

Modifier and TypeField and Description
private final List<Object>
_contents

May contain page rules, media rules or rulesets.

private final List<FontFaceRule>
private final List<StylesheetInfo>
private final int
_origin

user-agent, user or author from StylesheetInfo

private final String

Constructor Summary

AccessConstructor and Description
public
Stylesheet(String uri, int
user-agent, user or author from StylesheetInfo
origin
)

Creates a new instance of Stylesheet

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
public void
public List<Object>

Returns:

a list containing page rules, media rules and rulesets in encounter order.
getContents
()

public List<FontFaceRule>
public List<StylesheetInfo>
public int

Returns:

The origin value: user-agent, user or author from StylesheetInfo
getOrigin
()

Implements com.openhtmltopdf.css.sheet.RulesetContainer.getOrigin.

Gets the origin attribute of the Stylesheet object

public String

Returns:

The URI
getURI
()

Gets the URI of the Stylesheet object

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_contentsback to summary
private final List<Object> _contents

May contain page rules, media rules or rulesets.

_fontFaceRulesback to summary
private final List<FontFaceRule> _fontFaceRules
_importRulesback to summary
private final List<StylesheetInfo> _importRules
_originback to summary
private final int _origin

user-agent, user or author from StylesheetInfo

_uriback to summary
private final String _uri

Constructor Detail

Stylesheetback to summary
public Stylesheet(String uri, int origin)

Creates a new instance of Stylesheet

Parameters
origin:int

user-agent, user or author from StylesheetInfo

Method Detail

addContentback to summary
public void addContent(Ruleset ruleset)

Implements com.openhtmltopdf.css.sheet.RulesetContainer.addContent.

Annotations
@Override
addContentback to summary
public void addContent(MediaRule rule)
addContentback to summary
public void addContent(PageRule rule)
addFontFaceRuleback to summary
public void addFontFaceRule(FontFaceRule rule)
addImportRuleback to summary
public void addImportRule(StylesheetInfo info)
getContentsback to summary
public List<Object> getContents()
Returns:List<Object>

a list containing page rules, media rules and rulesets in encounter order.

getFontFaceRulesback to summary
public List<FontFaceRule> getFontFaceRules()
getImportRulesback to summary
public List<StylesheetInfo> getImportRules()
getOriginback to summary
public int getOrigin()

Implements com.openhtmltopdf.css.sheet.RulesetContainer.getOrigin.

Gets the origin attribute of the Stylesheet object

Returns:int

The origin value: user-agent, user or author from StylesheetInfo

Annotations
@Override
getURIback to summary
public String getURI()

Gets the URI of the Stylesheet object

Returns:String

The URI