com.itextpdf.tool.xml.css
Class StyleAttrCSSResolver

java.lang.Object
  extended by com.itextpdf.tool.xml.css.StyleAttrCSSResolver
All Implemented Interfaces:
CSSResolver

public class StyleAttrCSSResolver
extends Object
implements CSSResolver

Resolves CSS properties.

Author:
redlab_b

Field Summary
static String STYLE
           
 
Constructor Summary
StyleAttrCSSResolver()
          Construct a new StyleAttrCSSResolver with default settings.
StyleAttrCSSResolver(CssFiles cssFiles)
          Construct a new StyleAttrCSSResolver with the given CssFiles and the DefaultCssInheritanceRules.
StyleAttrCSSResolver(CssFiles cssFiles, CssUtils utils)
          Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils and the DefaultCssInheritanceRules.
StyleAttrCSSResolver(CssFiles cssFiles, FileRetrieve r)
           
StyleAttrCSSResolver(CssInheritanceRules rules, CssFiles cssFiles, CssUtils utils)
          Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils.
StyleAttrCSSResolver(CssInheritanceRules rules, CssFiles cssFiles, CssUtils utils, FileRetrieve fileRetrieve)
          Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils.
 
Method Summary
 void addCss(CssFile file)
          Add a file to the CssFiles Collection.
 void addCss(String content, boolean isPersistent)
          Add a piece of CSS code.
 void addCss(String content, String charSet, boolean isPersistent)
          Add a piece of CSS code.
 void addCssFile(String href, boolean isPersistent)
          Add a file to the CssFiles Collection.
 CSSResolver clear()
           
 void resolveStyles(Tag t)
          Also taking into account the CSS properties of any parent tag in the given tag.
 void setCssInheritance(CssInheritanceRules cssInheritanceRules)
          By setting an implementation of CssInheritanceRules a developer can set rules on what css selectors are inherited from parent tags.
 void setCssInheritanceRules(CssInheritanceRules inherit)
           
 void setFileRetrieve(FileRetrieve retrieve)
          The FileRetrieve implementation to use in addCss(String, boolean).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE

public static final String STYLE
See Also:
Constant Field Values
Constructor Detail

StyleAttrCSSResolver

public StyleAttrCSSResolver()
Construct a new StyleAttrCSSResolver with default settings.


StyleAttrCSSResolver

public StyleAttrCSSResolver(CssFiles cssFiles)
Construct a new StyleAttrCSSResolver with the given CssFiles and the DefaultCssInheritanceRules.

Parameters:
cssFiles - a CssFiles implementation.

StyleAttrCSSResolver

public StyleAttrCSSResolver(CssFiles cssFiles,
                            CssUtils utils)
Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils and the DefaultCssInheritanceRules.

Parameters:
cssFiles - a CssFiles implementation.
utils - the CssUtils to use.

StyleAttrCSSResolver

public StyleAttrCSSResolver(CssInheritanceRules rules,
                            CssFiles cssFiles,
                            CssUtils utils)
Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils.

Parameters:
rules - the CssInheritanceRules to use.
cssFiles - a CssFiles implementation.
utils - the CssUtils to use.

StyleAttrCSSResolver

public StyleAttrCSSResolver(CssInheritanceRules rules,
                            CssFiles cssFiles,
                            CssUtils utils,
                            FileRetrieve fileRetrieve)
Construct a new StyleAttrCSSResolver with the given CssFiles and CssUtils.

Parameters:
rules - the CssInheritanceRules to use.
cssFiles - a CssFiles implementation.
utils - the CssUtils to use.
fileRetrieve - the FileRetrieve implementation

StyleAttrCSSResolver

public StyleAttrCSSResolver(CssFiles cssFiles,
                            FileRetrieve r)
Parameters:
cssFiles - the CssFile implementation
r - the FileRetrieve implementation
Method Detail

resolveStyles

public void resolveStyles(Tag t)
Also taking into account the CSS properties of any parent tag in the given tag.

Specified by:
resolveStyles in interface CSSResolver
Parameters:
t - the tag.
See Also:
CSSResolver.resolveStyles(com.itextpdf.tool.xml.Tag)

setCssInheritance

public void setCssInheritance(CssInheritanceRules cssInheritanceRules)
By setting an implementation of CssInheritanceRules a developer can set rules on what css selectors are inherited from parent tags.

Parameters:
cssInheritanceRules - the inherit to set

addCss

public void addCss(String content,
                   String charSet,
                   boolean isPersistent)
            throws CssResolverException
Description copied from interface: CSSResolver
Add a piece of CSS code.

Specified by:
addCss in interface CSSResolver
Parameters:
content - the CSS
charSet - a charset
isPersistent - true if the added css should not be deleted on a call to clear
Throws:
CssResolverException - thrown if something goes wrong

addCssFile

public void addCssFile(String href,
                       boolean isPersistent)
                throws CssResolverException
Add a file to the CssFiles Collection.

Specified by:
addCssFile in interface CSSResolver
Parameters:
href - the path, if it starts with http we try to retrieve the file from the net, if not we try a normal file operation.
isPersistent - true if the added css should not be deleted on a call to clear
Throws:
CssResolverException - thrown if something goes wrong

addCss

public void addCss(CssFile file)
Add a file to the CssFiles Collection.

Specified by:
addCss in interface CSSResolver
Parameters:
file - the CssFile to add.

addCss

public void addCss(String content,
                   boolean isPersistent)
            throws CssResolverException
Description copied from interface: CSSResolver
Add a piece of CSS code.

Specified by:
addCss in interface CSSResolver
Parameters:
content - the content to parse to css
isPersistent - true if the added css should not be deleted on a call to clear
Throws:
CssResolverException - thrown if something goes wrong

setCssInheritanceRules

public void setCssInheritanceRules(CssInheritanceRules inherit)
Parameters:
inherit - the inherit to set

setFileRetrieve

public void setFileRetrieve(FileRetrieve retrieve)
The FileRetrieve implementation to use in addCss(String, boolean).

Specified by:
setFileRetrieve in interface CSSResolver
Parameters:
retrieve - the retrieve to set

clear

public CSSResolver clear()
                  throws CssResolverException
Specified by:
clear in interface CSSResolver
Returns:
an instance of this resolver
Throws:
CssResolverException - thrown if something goes wrong


Copyright © 2012. All Rights Reserved.