Class CssStyleSheet
java.lang.Object
com.itextpdf.styledxmlparser.css.CssStyleSheet
Class that stores all the CSS statements, and thus acts as a CSS style sheet.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStatement(CssStatement statement) Adds a CSS statement to the style sheet.voidappendCssStyleSheet(CssStyleSheet anotherCssStyleSheet) Append another CSS style sheet to this one.extractStylesFromRuleSets(List<CssRuleSet> ruleSets) Gets the CSS declarations.getCssDeclarations(INode node, MediaDeviceDescription deviceDescription) Gets the CSS declarations.getCssRuleSets(INode node, MediaDeviceDescription deviceDescription) Gets the CSS rule sets.Gets the CSS statements of this style sheet.private static voidpopulateDeclarationsMap(List<CssDeclaration> declarations, Map<String, CssDeclaration> map) Populates the CSS declarations map.private static voidputDeclarationInMapIfValid(Map<String, CssDeclaration> stylesMap, CssDeclaration cssDeclaration) Puts a declaration in a styles map if the declaration is valid.toString()
-
Field Details
-
statements
The list of CSS statements.
-
-
Constructor Details
-
CssStyleSheet
public CssStyleSheet()Creates a newCssStyleSheetinstance.
-
-
Method Details
-
addStatement
Adds a CSS statement to the style sheet.- Parameters:
statement- the CSS statement
-
appendCssStyleSheet
Append another CSS style sheet to this one.- Parameters:
anotherCssStyleSheet- the other CSS style sheet
-
toString
-
getStatements
Gets the CSS statements of this style sheet.- Returns:
- the CSS statements
-
getCssDeclarations
public List<CssDeclaration> getCssDeclarations(INode node, MediaDeviceDescription deviceDescription) Gets the CSS declarations.- Parameters:
node- the nodedeviceDescription- the media device description- Returns:
- the CSS declarations
-
extractStylesFromRuleSets
Gets the CSS declarations.- Parameters:
ruleSets- list of css rule sets- Returns:
- the CSS declarations
-
populateDeclarationsMap
private static void populateDeclarationsMap(List<CssDeclaration> declarations, Map<String, CssDeclaration> map) Populates the CSS declarations map.- Parameters:
declarations- the declarationsmap- the map
-
getCssRuleSets
Gets the CSS rule sets.- Parameters:
node- the nodedeviceDescription- the device description- Returns:
- the css rule sets
-
putDeclarationInMapIfValid
private static void putDeclarationInMapIfValid(Map<String, CssDeclaration> stylesMap, CssDeclaration cssDeclaration) Puts a declaration in a styles map if the declaration is valid.- Parameters:
stylesMap- the styles mapcssDeclaration- the css declaration
-