本文整理汇总了Java中cz.vutbr.web.domassign.Traversal类的典型用法代码示例。如果您正苦于以下问题:Java Traversal类的具体用法?Java Traversal怎么用?Java Traversal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Traversal类属于cz.vutbr.web.domassign包,在下文中一共展示了Traversal类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assignDOM
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* Goes through a DOM tree and assigns the CSS declarations to the DOM elements.
* The following style specifications are evaluated:
* <ul>
* <li>The style sheets included using the <code>link</code> and <code>style</code> tags.
* <li>Inline styles specified using the <code>style</code> element attribute.
* <li><strong>Proprietary extension:</strong> Default styles defined using the <code>XDefaultStyle</code>
* 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)
* </ul>
*
* @param doc
* DOM tree
* @param encoding
* The default encoding used for the referenced style sheets
* @param base
* Base URL against which all files are searched
* @param media
* Selected media for style sheet
* @param useInheritance
* Whether inheritance will be used to determine values
* @return Map between DOM element nodes and data structure containing CSS
* information
*/
public static final StyleMap assignDOM(Document doc, String encoding,
URL base, String media, boolean useInheritance) {
Pair pair = new Pair(base, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding,
(Object) pair, NodeFilter.SHOW_ELEMENT);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet()
.unlock();
traversal.listTraversal(style);
Analyzer analyzer = new Analyzer(style);
return analyzer.evaluateDOM(doc, media, useInheritance);
}
示例2: assignDOM
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* This is the same as {@link CSSFactory#assignDOM(Document, String, URL, MediaSpec, boolean)}
* with the possibility of specifying a custom network processor for obtaining data from URL
* resources.
*
* @param doc
* DOM tree
* @param encoding
* The default encoding used for the referenced style sheets
* @param network
* Custom network processor
* @param base
* Base URL against which all files are searched
* @param media
* Current media specification used for evaluating the media queries
* @param useInheritance
* Whether inheritance will be used to determine values
* @param matchCond
* The match condition to match the against.
* @return Map between DOM element nodes and data structure containing CSS
* information
*/
public static final StyleMap assignDOM(Document doc, String encoding, NetworkProcessor network,
URL base, MediaSpec media, boolean useInheritance, final MatchCondition matchCond) {
SourceData pair = new SourceData(base, network, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding,
pair, NodeFilter.SHOW_ELEMENT);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet()
.unlock();
traversal.listTraversal(style);
Analyzer analyzer = new Analyzer(style);
if (matchCond != null) {
analyzer.registerMatchCondition(matchCond);
}
return analyzer.evaluateDOM(doc, media, useInheritance);
}
示例3: getUsedStyles
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* Loads all the style sheets used from the specified DOM tree.
* The following style specifications are evaluated:
* <ul>
* <li>The style sheets included using the <code>link</code> and <code>style</code> tags.
* <li>Inline styles specified using the <code>style</code> element attribute.
* <li><strong>Proprietary extension:</strong> Default styles defined using the <code>XDefaultStyle</code>
* 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)
* </ul>
*
* @param doc
* DOM tree
* @param encoding
* The default encoding used for the referenced style sheets
* @param base
* Base URL against which all files are searched
* @param media
* Selected media for style sheet
* @return the rules of all the style sheets used in the document including the inline styles
*/
public static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, String media)
{
Pair pair = new Pair(base, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding,
(Object) pair, NodeFilter.SHOW_ELEMENT);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock();
traversal.listTraversal(style);
return style;
}
示例4: getUsedStyles
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* Loads all the style sheets used from the specified DOM tree.
* The following style specifications are evaluated:
* <ul>
* <li>The style sheets included using the <code>link</code> and <code>style</code> tags.
* <li>Inline styles specified using the <code>style</code> element attribute.
* <li><strong>Proprietary extension:</strong> Default styles defined using the <code>XDefaultStyle</code>
* 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)
* </ul>
*
* @param doc DOM tree
* @param encoding The default encoding used for the referenced style sheets
* @param base Base URL against which all files are searched
* @param media Selected media for style sheet
* @return the rules of all the style sheets used in the document including the inline styles
*/
public static final StyleSheet getUsedStyles(XmlDocument doc, String encoding, URL base, MediaSpec media) {
Pair pair = new Pair(base, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding, (Object) pair);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock();
traversal.listTraversal(style);
return style;
}
示例5: assignDOM
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* Goes through a DOM tree and assigns the CSS declarations to the DOM elements.
* The following style specifications are evaluated:
* <ul>
* <li>The style sheets included using the <code>link</code> and <code>style</code> tags.
* <li>Inline styles specified using the <code>style</code> element attribute.
* <li><strong>Proprietary extension:</strong> Default styles defined using the <code>XDefaultStyle</code>
* 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)
* </ul>
*
* @param doc DOM tree
* @param encoding The default encoding used for the referenced style sheets
* @param base Base URL against which all files are searched
* @param media Current media specification used for evaluating the media queries
* @param useInheritance Whether inheritance will be used to determine values
* @return Map between DOM element nodes and data structure containing CSS
* information
*/
public static final StyleMap assignDOM(XmlDocument doc, String encoding,
URL base, MediaSpec media, boolean useInheritance) {
Pair pair = new Pair(base, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding, (Object) pair);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet()
.unlock();
traversal.listTraversal(style);
Analyzer analyzer = new Analyzer(style);
return analyzer.evaluateDOM(doc, media, useInheritance);
}
示例6: getUsedStyles
import cz.vutbr.web.domassign.Traversal; //导入依赖的package包/类
/**
* Loads all the style sheets used from the specified DOM tree.
* The following style specifications are evaluated:
* <ul>
* <li>The style sheets included using the <code>link</code> and <code>style</code> tags.
* <li>Inline styles specified using the <code>style</code> element attribute.
* <li><strong>Proprietary extension:</strong> Default styles defined using the <code>XDefaultStyle</code>
* 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)
* </ul>
*
* @param doc
* DOM tree
* @param encoding
* The default encoding used for the referenced style sheets
* @param base
* Base URL against which all files are searched
* @param media
* Selected media for style sheet
* @return the rules of all the style sheets used in the document including the inline styles
*/
public static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, MediaSpec media, NetworkProcessor network)
{
SourceData pair = new SourceData(base, network, media);
Traversal<StyleSheet> traversal = new CSSAssignTraversal(doc, encoding,
pair, NodeFilter.SHOW_ELEMENT);
StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock();
traversal.listTraversal(style);
return style;
}