Package com.itextpdf.styledxmlparser.css
Class CssStyleSheet
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.CssStyleSheet
-
public class CssStyleSheet extends java.lang.Object
Class that stores all the CSS statements, and thus acts as a CSS style sheet.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CssStatement>
statements
The list of CSS statements.
-
Constructor Summary
Constructors Constructor Description CssStyleSheet()
Creates a newCssStyleSheet
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStatement(CssStatement statement)
Adds a CSS statement to the style sheet.void
appendCssStyleSheet(CssStyleSheet anotherCssStyleSheet)
Append another CSS style sheet to this one.static java.util.Map<java.lang.String,java.lang.String>
extractStylesFromRuleSets(java.util.List<CssRuleSet> ruleSets)
Gets the CSS declarations.java.util.List<CssDeclaration>
getCssDeclarations(INode node, MediaDeviceDescription deviceDescription)
Gets the CSS declarations.java.util.List<CssRuleSet>
getCssRuleSets(INode node, MediaDeviceDescription deviceDescription)
Gets the CSS rule sets.java.util.List<CssStatement>
getStatements()
Gets the CSS statements of this style sheet.private static void
populateDeclarationsMap(java.util.List<CssDeclaration> declarations, java.util.Map<java.lang.String,CssDeclaration> map)
Populates the CSS declarations map.private static void
putDeclarationInMapIfValid(java.util.Map<java.lang.String,CssDeclaration> stylesMap, CssDeclaration cssDeclaration)
Puts a declaration in a styles map if the declaration is valid.java.lang.String
toString()
-
-
-
Field Detail
-
statements
private java.util.List<CssStatement> statements
The list of CSS statements.
-
-
Constructor Detail
-
CssStyleSheet
public CssStyleSheet()
Creates a newCssStyleSheet
instance.
-
-
Method Detail
-
addStatement
public void addStatement(CssStatement statement)
Adds a CSS statement to the style sheet.- Parameters:
statement
- the CSS statement
-
appendCssStyleSheet
public void appendCssStyleSheet(CssStyleSheet anotherCssStyleSheet)
Append another CSS style sheet to this one.- Parameters:
anotherCssStyleSheet
- the other CSS style sheet
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getStatements
public java.util.List<CssStatement> getStatements()
Gets the CSS statements of this style sheet.- Returns:
- the CSS statements
-
getCssDeclarations
public java.util.List<CssDeclaration> getCssDeclarations(INode node, MediaDeviceDescription deviceDescription)
Gets the CSS declarations.- Parameters:
node
- the nodedeviceDescription
- the media device description- Returns:
- the CSS declarations
-
extractStylesFromRuleSets
public static java.util.Map<java.lang.String,java.lang.String> extractStylesFromRuleSets(java.util.List<CssRuleSet> ruleSets)
Gets the CSS declarations.- Parameters:
ruleSets
- list of css rule sets- Returns:
- the CSS declarations
-
populateDeclarationsMap
private static void populateDeclarationsMap(java.util.List<CssDeclaration> declarations, java.util.Map<java.lang.String,CssDeclaration> map)
Populates the CSS declarations map.- Parameters:
declarations
- the declarationsmap
- the map
-
getCssRuleSets
public java.util.List<CssRuleSet> getCssRuleSets(INode node, MediaDeviceDescription deviceDescription)
Gets the CSS rule sets.- Parameters:
node
- the nodedeviceDescription
- the device description- Returns:
- the css rule sets
-
putDeclarationInMapIfValid
private static void putDeclarationInMapIfValid(java.util.Map<java.lang.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
-
-