Package com.itextpdf.styledxmlparser.css
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 Pattern
Pattern to match "important" in a rule declaration.private List
<CssDeclaration> The important CSS declarations.private List
<CssDeclaration> The normal CSS declarations.private ICssSelector
The CSS selector. -
Constructor Summary
ConstructorsConstructorDescriptionCssRuleSet
(ICssSelector selector, List<CssDeclaration> declarations) Creates a newCssRuleSet
from selector and raw list of declarations.CssRuleSet
(ICssSelector selector, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) -
Method Summary
Modifier and TypeMethodDescriptiongetCssRuleSets
(INode element, MediaDeviceDescription deviceDescription) Gets a list ofCssRuleSet
objects.Gets the important CSS declarations.Gets the normal CSS declarations.Gets the CSS selector.private static void
splitDeclarationsIntoNormalAndImportant
(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 newCssRuleSet
from selector and raw list of declarations. The declarations are split into normal and important under the hood. To construct theCssRuleSet
instance 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)
-
-
Method Details
-
getCssRuleSets
Description copied from class:CssStatement
Gets a list ofCssRuleSet
objects.- Overrides:
getCssRuleSets
in classCssStatement
- Parameters:
element
- a nodedeviceDescription
- a media device description- Returns:
- the css rule sets
-
toString
-
getSelector
Gets the CSS selector.- Returns:
- the CSS selector
-
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
-