当前位置: 首页>>代码示例>>Java>>正文


Java CSSFactory.getUsedStyles方法代码示例

本文整理汇总了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)));
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:24,代码来源:PseudoClassTest.java

示例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)));
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:24,代码来源:PseudoClassTest.java

示例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);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:13,代码来源:DOMAnalyzer.java

示例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);
}
 
开发者ID:radkovo,项目名称:CSSBox,代码行数:13,代码来源:DOMAnalyzer.java

示例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)));
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:14,代码来源:PseudoClassTest.java


注:本文中的cz.vutbr.web.css.CSSFactory.getUsedStyles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。