com.itextpdf.text.html.simpleparser
Class StyleSheet

java.lang.Object
  extended by com.itextpdf.text.html.simpleparser.StyleSheet

public class StyleSheet
extends Object

Old class to define styles for HTMLWorker. We've completely rewritten HTML to PDF functionality; see project XML Worker. XML Worker is able to parse CSS files and "style" attribute values.


Field Summary
protected  Map<String,Map<String,String>> classMap
          Map storing possible names of the "class" attribute and their corresponding styles.
protected  Map<String,Map<String,String>> tagMap
          Map storing tags and their corresponding styles.
 
Constructor Summary
StyleSheet()
          Creates a new instance of StyleSheet
 
Method Summary
 void applyStyle(String tag, Map<String,String> attrs)
          Resolves the styles based on the tag name and the value of the class attribute.
 void loadStyle(String className, HashMap<String,String> attrs)
          Associates a Map containing styles with a class name.
 void loadStyle(String className, String key, String value)
          Adds an extra style key-value pair to the styles Map of a specific tag
 void loadTagStyle(String tag, Map<String,String> attrs)
          Associates a Map containing styles with a tag.
 void loadTagStyle(String tag, String key, String value)
          Adds an extra style key-value pair to the styles Map of a specific tag
static void resolveStyleAttribute(Map<String,String> h, ChainedProperties chain)
          Method contributed by Lubos Strapko
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagMap

protected Map<String,Map<String,String>> tagMap
Map storing tags and their corresponding styles.

Since:
5.0.6 (changed HashMap => Map)

classMap

protected Map<String,Map<String,String>> classMap
Map storing possible names of the "class" attribute and their corresponding styles.

Since:
5.0.6 (changed HashMap => Map)
Constructor Detail

StyleSheet

public StyleSheet()
Creates a new instance of StyleSheet

Method Detail

loadTagStyle

public void loadTagStyle(String tag,
                         Map<String,String> attrs)
Associates a Map containing styles with a tag.

Parameters:
tag - the name of the HTML/XML tag
attrs - a map containing styles

loadTagStyle

public void loadTagStyle(String tag,
                         String key,
                         String value)
Adds an extra style key-value pair to the styles Map of a specific tag

Parameters:
tag - the name of the HTML/XML tag
key - the key specifying a specific style
value - the value defining the style

loadStyle

public void loadStyle(String className,
                      HashMap<String,String> attrs)
Associates a Map containing styles with a class name.

Parameters:
className - the value of the class attribute
attrs - a map containing styles

loadStyle

public void loadStyle(String className,
                      String key,
                      String value)
Adds an extra style key-value pair to the styles Map of a specific tag

Parameters:
className - the name of the HTML/XML tag
key - the key specifying a specific style
value - the value defining the style

applyStyle

public void applyStyle(String tag,
                       Map<String,String> attrs)
Resolves the styles based on the tag name and the value of the class attribute.

Parameters:
tag - the tag that needs to be resolved
attrs - existing style map that will be updated

resolveStyleAttribute

public static void resolveStyleAttribute(Map<String,String> h,
                                         ChainedProperties chain)
Method contributed by Lubos Strapko

Parameters:
h -
chain -
Since:
2.1.3


Copyright © 2013. All Rights Reserved.