Package com.openhtmltopdf.context
Class StylesheetFactoryImpl
- java.lang.Object
-
- com.openhtmltopdf.context.StylesheetFactoryImpl
-
- All Implemented Interfaces:
StylesheetFactory
public class StylesheetFactoryImpl extends Object implements StylesheetFactory
A Factory class for Cascading Style Sheets. Sheets are parsed using a single parser instance for all sheets. Sheets are cached by URI using a LRU test, but timestamp of file is not checked.- Author:
- Torbjoern Gannholm
-
-
Constructor Summary
Constructors Constructor Description StylesheetFactoryImpl(UserAgentCallback userAgentCallback)
-
Method Summary
Modifier and Type Method Description booleancontainsStylesheet(String key)Deprecated.voidflushCachedStylesheets()Deprecated.StylesheetgetCachedStylesheet(String key)Deprecated.StylesheetgetStylesheet(StylesheetInfo info)Returns a cached sheet by its key; loads and caches it if not in cache; null if not able to loadStylesheetparse(Reader reader, StylesheetInfo info)RulesetparseStyleDeclaration(int origin, String styleDeclaration)voidputStylesheet(String key, Stylesheet sheet)Deprecated.ObjectremoveCachedStylesheet(String key)Deprecated.voidsetSupportCMYKColors(boolean b)voidsetUserAgentCallback(UserAgentCallback userAgent)
-
-
-
Constructor Detail
-
StylesheetFactoryImpl
public StylesheetFactoryImpl(UserAgentCallback userAgentCallback)
-
-
Method Detail
-
parse
public Stylesheet parse(Reader reader, StylesheetInfo info)
- Specified by:
parsein interfaceStylesheetFactory
-
parseStyleDeclaration
public Ruleset parseStyleDeclaration(int origin, String styleDeclaration)
- Specified by:
parseStyleDeclarationin interfaceStylesheetFactory
-
putStylesheet
@Deprecated public void putStylesheet(String key, Stylesheet sheet)
Deprecated.Adds a stylesheet to the factory cache. Will overwrite older entry for same key.- Parameters:
key- Key to use to reference sheet later; must be unique in factory.sheet- The sheet to cache.
-
containsStylesheet
@Deprecated public boolean containsStylesheet(String key)
Deprecated.- Parameters:
key-- Returns:
- true if a Stylesheet with this key has been put in the cache. Note that the Stylesheet may be null.
-
getCachedStylesheet
@Deprecated public Stylesheet getCachedStylesheet(String key)
Deprecated.Returns a cached sheet by its key; null if no entry for that key.- Parameters:
key- The key for this sheet; same as key passed to putStylesheet();- Returns:
- The stylesheet
-
removeCachedStylesheet
@Deprecated public Object removeCachedStylesheet(String key)
Deprecated.Removes a cached sheet by its key.- Parameters:
key- The key for this sheet; same as key passed to putStylesheet();
-
flushCachedStylesheets
@Deprecated public void flushCachedStylesheets()
Deprecated.
-
getStylesheet
public Stylesheet getStylesheet(StylesheetInfo info)
Returns a cached sheet by its key; loads and caches it if not in cache; null if not able to load- Specified by:
getStylesheetin interfaceStylesheetFactory- Parameters:
info- The StylesheetInfo for this sheet- Returns:
- The stylesheet
-
setUserAgentCallback
public void setUserAgentCallback(UserAgentCallback userAgent)
-
setSupportCMYKColors
public void setSupportCMYKColors(boolean b)
-
-