public final class CSSFactory extends Object
cz.vutbr.web.csskit.TermFactoryImpl
cz.vutbr.web.domassign.SupportedCSS3
cz.vutbr.web.csskit.RuleFactoryImpl
cz.vutbr.web.domassign.SingleMapNodeData
Other usage of this factory is to parse either string or file into
StyleSheet.
Whole conversion between DOM tree and mapping of CSS to DOM tree elements
could be done by invoking method assignDOM()| Constructor and Description |
|---|
CSSFactory() |
| Modifier and Type | Method and Description |
|---|---|
static StyleMap |
assignDOM(Document doc,
String encoding,
URL base,
String media,
boolean useInheritance)
Goes through a DOM tree and assigns the CSS declarations to the DOM elements.
|
static StyleMap |
assignDOM(Document doc,
URL base,
String media,
boolean useInheritance)
Goes through a DOM tree and assigns the CSS declarations to the DOM elements.
|
static NodeData |
createNodeData()
Creates instance of NodeData
|
static DeclarationTransformer |
getDeclarationTransformer()
Returns the registered DeclarationTransformer
|
static MatchCondition |
getDefaultMatchCondition()
Obtains the default match condition to be used for matching the elements and selector parts.
|
static boolean |
getImplyPixelLength()
Says whether to allow lengths with no units and interpret them as pixels.
|
static RuleFactory |
getRuleFactory()
Returns registered RuleFactory
|
static SupportedCSS |
getSupportedCSS()
Returns registered SupportedCSS
|
static TermFactory |
getTermFactory()
Returns TermFactory registered in step above
|
static StyleSheet |
getUsedStyles(Document doc,
String encoding,
URL base,
String media)
Loads all the style sheets used from the specified DOM tree.
|
static StyleSheet |
getUsedStyles(Document doc,
URL base,
String media)
Loads all the style sheets used from the specified DOM tree.
|
static StyleSheet |
parse(String css)
Parses text into StyleSheet
|
static StyleSheet |
parse(String fileName,
String encoding)
Parses file into StyleSheet.
|
static StyleSheet |
parse(URL url,
String encoding)
Parses URL into StyleSheet
|
static void |
registerDeclarationTransformer(DeclarationTransformer newDeclarationTransformer)
Registers new DeclarationTransformer
|
static void |
registerDefaultMatchCondition(MatchCondition newMatchCondition)
Registers a new default match condition to be used for matching the elements and selector parts.
|
static void |
registerNodeDataInstance(Class<? extends NodeData> clazz)
Registers node data instance.
|
static void |
registerRuleFactory(RuleFactory newRuleFactory)
Registers new RuleFactory
|
static void |
registerSupportedCSS(SupportedCSS newCSS)
Registers new SupportedCSS instance
|
static void |
registerTermFactory(TermFactory newFactory)
Registers new TermFactory instance
|
static void |
setImplyPixelLength(boolean b)
Sets whether to allow lengths with no units and interpret them as pixels.
|
public static final void setImplyPixelLength(boolean b)
b - public static final boolean getImplyPixelLength()
public static final void registerTermFactory(TermFactory newFactory)
newFactory - New TermFactorypublic static final TermFactory getTermFactory()
public static final void registerSupportedCSS(SupportedCSS newCSS)
newCSS - new SupportedCSSpublic static final SupportedCSS getSupportedCSS()
public static final void registerRuleFactory(RuleFactory newRuleFactory)
newRuleFactory - New RuleFactory instancepublic static final RuleFactory getRuleFactory()
public static final void registerDeclarationTransformer(DeclarationTransformer newDeclarationTransformer)
newDeclarationTransformer - New DeclarationTransformer instancepublic static final DeclarationTransformer getDeclarationTransformer()
public static final void registerDefaultMatchCondition(MatchCondition newMatchCondition)
newMatchCondition - the new match conditionpublic static final MatchCondition getDefaultMatchCondition()
public static final void registerNodeDataInstance(Class<? extends NodeData> clazz)
clazz - Instance classpublic static final NodeData createNodeData()
public static final StyleSheet parse(URL url, String encoding) throws CSSException, IOException
url - URL of file to be parsedencoding - Encoding of fileCSSException - When exception during parse occursIOException - When file not foundpublic static final StyleSheet parse(String fileName, String encoding) throws CSSException, IOException
fileName - Name of fileencoding - Encoding used to parse inputCSSException - In case that parsing error occursIOException - If file is not found or not readablepublic static final StyleSheet parse(String css) throws IOException, CSSException
css - Text with CSS declarationsIOException - When exception during read occursCSSException - When exception during parse occurspublic static final StyleSheet getUsedStyles(Document doc, URL base, String media)
link and style tags.
style element attribute.
XDefaultStyle
element attribute. These styles behave the same way as the inline styles but they have the lowest priority
(the values are used only when not redefined by any other way)
getUsedStyles(Document, String, URL, String)
method in order to specify the encoding correctly.doc - DOM treebase - Base URL against which all files are searchedmedia - Selected media for style sheetpublic static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, String media)
link and style tags.
style element attribute.
XDefaultStyle
element attribute. These styles behave the same way as the inline styles but they have the lowest priority
(the values are used only when not redefined by any other way)
doc - DOM treeencoding - The default encoding used for the referenced style sheetsbase - Base URL against which all files are searchedmedia - Selected media for style sheetpublic static final StyleMap assignDOM(Document doc, URL base, String media, boolean useInheritance)
link and style tags.
style element attribute.
XDefaultStyle
element attribute. These styles behave the same way as the inline styles but they have the lowest priority
(the values are used only when not redefined by any other way)
assignDOM(Document, String, URL, String, boolean)
method in order to specify the encoding correctly.doc - DOM treebase - Base URL against which all files are searchedmedia - Selected media for style sheetuseInheritance - Whether inheritance will be used to determine valuespublic static final StyleMap assignDOM(Document doc, String encoding, URL base, String media, boolean useInheritance)
link and style tags.
style element attribute.
XDefaultStyle
element attribute. These styles behave the same way as the inline styles but they have the lowest priority
(the values are used only when not redefined by any other way)
doc - DOM treeencoding - The default encoding used for the referenced style sheetsbase - Base URL against which all files are searchedmedia - Selected media for style sheetuseInheritance - Whether inheritance will be used to determine valuesCopyright © 2014. All rights reserved.