本文整理汇总了Java中cz.vutbr.web.css.CSSFactory.getUsedStyles方法的典型用法代码示例。如果您正苦于以下问题:Java CSSFactory.getUsedStyles方法的具体用法?Java CSSFactory.getUsedStyles怎么用?Java CSSFactory.getUsedStyles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cz.vutbr.web.css.CSSFactory
的用法示例。
在下文中一共展示了CSSFactory.getUsedStyles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pseudoClassDirect
import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void pseudoClassDirect() throws SAXException, IOException {
DOMSource ds = new DOMSource(getClass().getResourceAsStream("/simple/pseudo.html"));
Document doc = ds.parse();
ElementMap elements = new ElementMap(doc);
MatchConditionOnElements cond = new MatchConditionOnElements("a", PseudoDeclaration.LINK);
cond.addMatch(elements.getElementById("l2"), PseudoDeclaration.HOVER);
cond.addMatch(elements.getElementById("l3"), PseudoDeclaration.VISITED);
CSSFactory.registerDefaultMatchCondition(cond);
StyleSheet style = CSSFactory.getUsedStyles(doc, null, createBaseFromFilename("data/simple/selectors.html"),"screen");
DirectAnalyzer da = new DirectAnalyzer(style);
NodeData l1 = getStyleById(elements, da, "l1");
NodeData l2 = getStyleById(elements, da, "l2");
NodeData l3 = getStyleById(elements, da, "l3");
assertThat(l1.getValue(TermColor.class, "color"), is(tf.createColor(0,255,0)));
assertThat(l2.getValue(TermColor.class, "color"), is(tf.createColor(0,255,255)));
assertThat(l3.getValue(TermColor.class, "color"), is(tf.createColor(0,0,170)));
}
示例2: pseudoClassDirectNonStatic
import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void pseudoClassDirectNonStatic() throws SAXException, IOException {
DOMSource ds = new DOMSource(getClass().getResourceAsStream("/simple/pseudo.html"));
Document doc = ds.parse();
ElementMap elements = new ElementMap(doc);
MatchConditionOnElements cond = new MatchConditionOnElements("a", PseudoDeclaration.LINK);
cond.addMatch(elements.getElementById("l2"), PseudoDeclaration.HOVER);
cond.addMatch(elements.getElementById("l3"), PseudoDeclaration.VISITED);
StyleSheet style = CSSFactory.getUsedStyles(doc, null, createBaseFromFilename("data/simple/selectors.html"),"screen");
DirectAnalyzer da = new DirectAnalyzer(style);
da.registerMatchCondition(cond);
NodeData l1 = getStyleById(elements, da, "l1");
NodeData l2 = getStyleById(elements, da, "l2");
NodeData l3 = getStyleById(elements, da, "l3");
assertThat(l1.getValue(TermColor.class, "color"), is(tf.createColor(0,255,0)));
assertThat(l2.getValue(TermColor.class, "color"), is(tf.createColor(0,255,255)));
assertThat(l3.getValue(TermColor.class, "color"), is(tf.createColor(0,0,170)));
}
示例3: getStyleSheets
import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
* Returns a vector of CSSStyleSheet objects referenced from the document for the specified
* media type. The internal style sheets are read from the document directly, the external
* ones are downloaded and parsed automatically.
* @param media the media type string
*/
public void getStyleSheets(String media)
{
this.media = new String(media);
StyleSheet newsheet = CSSFactory.getUsedStyles(doc, encoding, baseUrl, media);
styles.add(newsheet);
}
示例4: getStyleSheets
import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
* Returns a vector of CSSStyleSheet objects referenced from the document for the specified
* media type with default values of the remaining media features. The internal style sheets
* are read from the document directly, the external ones are downloaded and parsed automatically.
* @param media the media type string
*/
public void getStyleSheets(String media)
{
this.media = new MediaSpec(media);
StyleSheet newsheet = CSSFactory.getUsedStyles(doc, encoding, baseUrl, this.media);
styles.add(newsheet);
}
示例5: pseudoClassVsPseudoElementSelector
import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Test
public void pseudoClassVsPseudoElementSelector() throws SAXException, IOException {
DOMSource ds = new DOMSource(getClass().getResourceAsStream("/simple/pseudo.html"));
Document doc = ds.parse();
ElementMap elements = new ElementMap(doc);
StyleSheet style = CSSFactory.getUsedStyles(doc, null, createBaseFromFilename("data/simple/selectors.html"),"screen");
DirectAnalyzer da = new DirectAnalyzer(style);
NodeData nodeData = getStyleById(elements, da, "p1");
assertThat(nodeData.getValue(TermColor.class, "color"), is(tf.createColor(0,128,0)));
}