Package com.itextpdf.styledxmlparser.css
Class CssRuleSet
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.CssStatement
-
- com.itextpdf.styledxmlparser.css.CssRuleSet
-
- Direct Known Subclasses:
CssNonStandardRuleSet
public class CssRuleSet extends CssStatement
Class to store a CSS rule set.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternIMPORTANT_MATCHERPattern to match "important" in a rule declaration.private java.util.List<CssDeclaration>importantDeclarationsThe important CSS declarations.private java.util.List<CssDeclaration>normalDeclarationsThe normal CSS declarations.private ICssSelectorselectorThe CSS selector.
-
Constructor Summary
Constructors Constructor Description CssRuleSet(ICssSelector selector, java.util.List<CssDeclaration> declarations)Creates a newCssRuleSetfrom selector and raw list of declarations.CssRuleSet(ICssSelector selector, java.util.List<CssDeclaration> normalDeclarations, java.util.List<CssDeclaration> importantDeclarations)Creates a newCssRuleSetfrom a selector and a list of normal and important declarations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CssRuleSet>getCssRuleSets(INode element, MediaDeviceDescription deviceDescription)Gets a list ofCssRuleSetobjects.java.util.List<CssDeclaration>getImportantDeclarations()Gets the important CSS declarations.java.util.List<CssDeclaration>getNormalDeclarations()Gets the normal CSS declarations.ICssSelectorgetSelector()Gets the CSS selector.private static voidsplitDeclarationsIntoNormalAndImportant(java.util.List<CssDeclaration> declarations, java.util.List<CssDeclaration> normalDeclarations, java.util.List<CssDeclaration> importantDeclarations)Split CSS declarations into normal and important CSS declarations.java.lang.StringtoString()
-
-
-
Field Detail
-
IMPORTANT_MATCHER
private static final java.util.regex.Pattern IMPORTANT_MATCHER
Pattern to match "important" in a rule declaration.
-
selector
private ICssSelector selector
The CSS selector.
-
normalDeclarations
private java.util.List<CssDeclaration> normalDeclarations
The normal CSS declarations.
-
importantDeclarations
private java.util.List<CssDeclaration> importantDeclarations
The important CSS declarations.
-
-
Constructor Detail
-
CssRuleSet
public CssRuleSet(ICssSelector selector, java.util.List<CssDeclaration> declarations)
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, java.util.List<CssDeclaration> normalDeclarations, java.util.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 Detail
-
getCssRuleSets
public java.util.List<CssRuleSet> getCssRuleSets(INode element, MediaDeviceDescription deviceDescription)
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getSelector
public ICssSelector getSelector()
Gets the CSS selector.- Returns:
- the CSS selector
-
getNormalDeclarations
public java.util.List<CssDeclaration> getNormalDeclarations()
Gets the normal CSS declarations.- Returns:
- the normal declarations
-
getImportantDeclarations
public java.util.List<CssDeclaration> getImportantDeclarations()
Gets the important CSS declarations.- Returns:
- the important declarations
-
splitDeclarationsIntoNormalAndImportant
private static void splitDeclarationsIntoNormalAndImportant(java.util.List<CssDeclaration> declarations, java.util.List<CssDeclaration> normalDeclarations, java.util.List<CssDeclaration> importantDeclarations)
Split CSS declarations into normal and important CSS declarations.- Parameters:
declarations- the declarations
-
-