Package org.xhtmlrenderer.context
Class StylesheetFactoryImpl
java.lang.Object
org.xhtmlrenderer.context.StylesheetFactoryImpl
- All Implemented Interfaces:
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 LRU test,
but timestamp of file is not checked.
- Author:
- Torbjoern Gannholm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsStylesheet(String key) voidReturns a cached sheet by its key; null if no entry for that key.getStylesheet(StylesheetInfo info) Returns a cached sheet by its key; loads and caches it if not in cache; null if not able to loadparse(Reader reader, StylesheetInfo info) parseStyleDeclaration(int origin, String styleDeclaration) voidputStylesheet(String key, Stylesheet sheet) Adds a stylesheet to the factory cache.Removes a cached sheet by its key.voidsetSupportCMYKColors(boolean b) voidsetUserAgentCallback(UserAgentCallback userAgent)
-
Constructor Details
-
StylesheetFactoryImpl
-
-
Method Details
-
parse
- Specified by:
parsein interfaceStylesheetFactory
-
parseStyleDeclaration
- Specified by:
parseStyleDeclarationin interfaceStylesheetFactory
-
putStylesheet
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
- Returns:
- true if a Stylesheet with this key has been put in the cache. Note that the Stylesheet may be null.
-
getCachedStylesheet
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
Removes a cached sheet by its key.- Parameters:
key- The key for this sheet; same as key passed to putStylesheet();
-
flushCachedStylesheets
public void flushCachedStylesheets() -
getStylesheet
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
-
setSupportCMYKColors
public void setSupportCMYKColors(boolean b)
-