Class CssRuleSet
java.lang.Object
com.itextpdf.styledxmlparser.css.CssStatement
com.itextpdf.styledxmlparser.css.CssRuleSet
- Direct Known Subclasses:
CssNonStandardRuleSet
Class to store a CSS rule set.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final PatternPattern to match "important" in a rule declaration.private List<CssDeclaration> The important CSS declarations.private List<CssDeclaration> The normal CSS declarations.private ICssSelectorThe CSS selector. -
Constructor Summary
ConstructorsConstructorDescriptionCssRuleSet(ICssSelector selector, List<CssDeclaration> declarations) Creates a newCssRuleSetfrom selector and raw list of declarations.CssRuleSet(ICssSelector selector, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) Creates a newCssRuleSetfrom a selector and a list of normal and important declarations. -
Method Summary
Modifier and TypeMethodDescriptiongetCssRuleSets(INode element, MediaDeviceDescription deviceDescription) Gets a list ofCssRuleSetobjects.Gets the important CSS declarations.Gets the normal CSS declarations.Gets the CSS selector.private static voidsplitDeclarationsIntoNormalAndImportant(List<CssDeclaration> declarations, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) Split CSS declarations into normal and important CSS declarations.toString()
-
Field Details
-
IMPORTANT_MATCHER
Pattern to match "important" in a rule declaration. -
selector
The CSS selector. -
normalDeclarations
The normal CSS declarations. -
importantDeclarations
The important CSS declarations.
-
-
Constructor Details
-
CssRuleSet
Creates a newCssRuleSetfrom selector and raw list of declarations. The declarations are split into normal and important under the hood. To construct theCssRuleSetinstance from normal and important declarations, seeCssRuleSet(ICssSelector, List, List)- Parameters:
selector- the CSS selectordeclarations- the CSS declarations
-
CssRuleSet
public CssRuleSet(ICssSelector selector, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) Creates a newCssRuleSetfrom a selector and a list of normal and important declarations.- Parameters:
selector- the CSS selectornormalDeclarations- the list of normal declarationsimportantDeclarations- the list of important declarations
-
-
Method Details
-
getCssRuleSets
Description copied from class:CssStatementGets a list ofCssRuleSetobjects.- Overrides:
getCssRuleSetsin classCssStatement- Parameters:
element- a nodedeviceDescription- a media device description- Returns:
- the css rule sets
-
toString
-
getSelector
-
getNormalDeclarations
Gets the normal CSS declarations.- Returns:
- the normal declarations
-
getImportantDeclarations
Gets the important CSS declarations.- Returns:
- the important declarations
-
splitDeclarationsIntoNormalAndImportant
private static void splitDeclarationsIntoNormalAndImportant(List<CssDeclaration> declarations, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) Split CSS declarations into normal and important CSS declarations.- Parameters:
declarations- the declarations
-