• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CSSException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cz.vutbr.web.css.CSSException的典型用法代码示例。如果您正苦于以下问题:Java CSSException类的具体用法?Java CSSException怎么用?Java CSSException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CSSException类属于cz.vutbr.web.css包,在下文中一共展示了CSSException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: feedLexer

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
private static CommonTokenStream feedLexer(CSSInputStream source,
		StyleSheet stylesheet) throws CSSException {

	// we have to unpack runtime exception
	// because of Java limitation
	// to change method contract with different type of exception
	try {
		CSSLexer lexer = new CSSLexer(source);
		lexer.init(stylesheet);
		return new CommonTokenStream(lexer);
	} catch (RuntimeException re) {
		if (re.getCause() instanceof CSSException) {
			throw (CSSException) re.getCause();
		}
		// this is some other exception
		else {
			log.error("LEXER THROWS:", re);
			throw re;
		}
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:22,代码来源:CSSParserFactory.java


示例2: testRGBFunction1

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testRGBFunction1() throws IOException, CSSException   {
	
	StyleSheet ss = CSSFactory.parseString(TEST_RGBFUNCTION1, null);
	assertEquals("One rule is set", 1, ss.size());
	
	RuleSet rule = (RuleSet) ss.get(0);				
	
	assertArrayEquals("Rule contains one selector BODY ", 
			SelectorsUtil.createSelectors("BODY"), 
			rule.getSelectors());
	
	assertEquals("Rule contains one declaration {color: #00aa85;}",
			DeclarationsUtil.appendDeclaration(null, "color", 
					tf.createColor(192, 64, 32)),
			rule.asList());
	
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:SimpleTest.java


示例3: testRGBFunction2

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testRGBFunction2() throws IOException, CSSException   {
	
	StyleSheet ss = CSSFactory.parseString(TEST_RGBFUNCTION2, null);
	assertEquals("One rule is set", 1, ss.size());
	
	RuleSet rule = (RuleSet) ss.get(0);				
	
	assertArrayEquals("Rule contains one selector BODY ", 
			SelectorsUtil.createSelectors("BODY"), 
			rule.getSelectors());
	
	assertEquals("Rule contains one declaration {color: rgb(50%,40%,30%);}",
			DeclarationsUtil.appendDeclaration(null, "color", 
					tf.createColor(127, 102, 76)),
			rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:18,代码来源:SimpleTest.java


示例4: testRGBFunctionInvalid

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testRGBFunctionInvalid() throws IOException, CSSException   {
    
    StyleSheet ss = CSSFactory.parseString(TEST_RGBFUNCTION_INVALID, null);
    assertEquals("One rule is set", 1, ss.size());
    
    RuleSet rule = (RuleSet) ss.get(0);             
    
    assertArrayEquals("Rule contains one selector BODY ", 
            SelectorsUtil.createSelectors("BODY"), 
            rule.getSelectors());
    
    assertEquals("Rule contains one declaration", 1, rule.size());
    Term<?> value = rule.get(0).get(0);
    assertTrue("Assigned value is TermFunction (not TermColor)", value instanceof TermFunction);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:17,代码来源:SimpleTest.java


示例5: testHSLFunction1

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testHSLFunction1() throws IOException, CSSException   {
    
    StyleSheet ss = CSSFactory.parseString(TEST_HSLFUNCTION1, null);
    assertEquals("One rule is set", 1, ss.size());
    
    RuleSet rule = (RuleSet) ss.get(0);             
    
    assertArrayEquals("Rule contains one selector BODY ", 
            SelectorsUtil.createSelectors("BODY"), 
            rule.getSelectors());
    
    assertEquals("Rule contains one declaration with color",
            DeclarationsUtil.appendDeclaration(null, "color", 
                    tf.createColor(0, 255, 0)),
            rule.asList());
    
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:SimpleTest.java


示例6: testRGBAFunction1

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testRGBAFunction1() throws IOException, CSSException   {
    
    StyleSheet ss = CSSFactory.parseString(TEST_RGBAFUNCTION1, null);
    assertEquals("One rule is set", 1, ss.size());
    
    RuleSet rule = (RuleSet) ss.get(0);             
    
    assertArrayEquals("Rule contains one selector BODY ", 
            SelectorsUtil.createSelectors("BODY"), 
            rule.getSelectors());
    
    assertEquals("Rule contains one declaration with color",
            DeclarationsUtil.appendDeclaration(null, "color", 
                    tf.createColor(255, 0, 0, 51)),
            rule.asList());
    
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:SimpleTest.java


示例7: testHSLAFunction1

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test 
public void testHSLAFunction1() throws IOException, CSSException   {
    
    StyleSheet ss = CSSFactory.parseString(TEST_HSLAFUNCTION1, null);
    assertEquals("One rule is set", 1, ss.size());
    
    RuleSet rule = (RuleSet) ss.get(0);             
    
    assertArrayEquals("Rule contains one selector BODY ", 
            SelectorsUtil.createSelectors("BODY"), 
            rule.getSelectors());
    
    assertEquals("Rule contains one declaration with color",
            DeclarationsUtil.appendDeclaration(null, "color", 
                    tf.createColor(0, 0, 255, 102)),
            rule.asList());
    
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:SimpleTest.java


示例8: testHashColor1

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testHashColor1() throws IOException, CSSException   {

	StyleSheet ss = CSSFactory.parseString(TEST_HASH_COLOR1, null);
	assertEquals("One rule is set", 1, ss.size());
	
	RuleSet rule = (RuleSet) ss.get(0);				
	
	assertArrayEquals("Rule contains one selector BODY ", 
			SelectorsUtil.createSelectors("BODY"), 
			rule.getSelectors());
	
	assertEquals("Rule contains one declaration {color: #00aa85;}",
			DeclarationsUtil.appendDeclaration(null, "color", 
					tf.createColor(0, 170, 133)),
			rule.asList());
	
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:SimpleTest.java


示例9: testHashColor2

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testHashColor2() throws IOException, CSSException   {
	
	StyleSheet ss = CSSFactory.parseString(TEST_HASH_COLOR2, null);
	assertEquals("One rule is set", 1, ss.size());
	
	final RuleSet rule = (RuleSet) ss.get(0);				
	
	assertArrayEquals("Rule contains two selectors DIV, P", 
			SelectorsUtil.createSelectors("DIV", "P"), 
			rule.getSelectors());
	
	assertEquals("Rule contains one declaration {color: #CCC;}",
			DeclarationsUtil.appendDeclaration(null, "color", 
					tf.createColor(204,204,204)),
			rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:18,代码来源:SimpleTest.java


示例10: testInvalidPseudoSelector2

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testInvalidPseudoSelector2() throws IOException, CSSException   {
	StyleSheet ss = CSSFactory.parseString(TEST_INVALID_PSEUDO_SELECTOR2, null);
	assertEquals("One rule is set", 1, ss.size());

	RuleSet rule = (RuleSet) ss.get(0);

	assertArrayEquals("Rule contains one selector p ",
			SelectorsUtil.createSelectors("p"),
			rule.getSelectors());

	assertEquals("Rule contains one declaration {background: green}",
			DeclarationsUtil.appendDeclaration(null, "background",
					tf.createColor(0, 128, 0)),
			rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:17,代码来源:SimpleTest.java


示例11: rectFunctions

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void rectFunctions() throws IOException, CSSException
{
       StyleSheet ss1 = CSSFactory.parseString(TEST_RECT1, null);
       assertEquals("Two properties are accepted", 2, ss1.get(0).size());
       Declaration d1 = (Declaration) ss1.get(0).get(0);
       TermRect r1 = (TermRect) d1.get(0);
       assertEquals("The last one is a correct length", tf.createLength(2f, Unit.ch), r1.getValue().get(3));
    
       StyleSheet ss2 = CSSFactory.parseString(TEST_RECT2, null);
       assertEquals("Two properties are accepted", 2, ss2.get(0).size());
       Declaration d2 = (Declaration) ss2.get(0).get(0);
       TermRect r2 = (TermRect) d2.get(0);
       assertEquals("The last one is a correct length", tf.createLength(2f, Unit.ch), r2.getValue().get(3));
       
       StyleSheet ss3 = CSSFactory.parseString(TEST_RECT3, null);
       assertEquals("Two properties are accepted", 2, ss3.get(0).size());
       Declaration d3 = (Declaration) ss3.get(0).get(0);
       TermRect r3 = (TermRect) d3.get(0);
       assertEquals("The last one is a correct length", null, r3.getValue().get(3));
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:22,代码来源:FunctionsTest.java


示例12: init

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@BeforeClass
public static void init() throws IOException, CSSException, SAXException {
	log.info("\n\n\n == AnalyzerTest test at {} == \n\n\n", new Date());

       DOMSource ds = new DOMSource(AnalyzerTest.class.getResourceAsStream("/simple/data.html"));
       doc = ds.parse();
       
	sheet = CSSFactory.parse(AnalyzerTest.class.getResource("/simple/data.css"), null);

	analyzer = new Analyzer(sheet);

	NodeList list = doc.getElementsByTagName("body");
	assertEquals("There is one <body> element", 1, list.getLength());

	//walker = new TidyTreeWalker(list.item(0), NodeFilter.SHOW_ELEMENT);
	DocumentTraversal traversal = (DocumentTraversal) doc;
	walker = traversal.createTreeWalker(list.item(0), NodeFilter.SHOW_ELEMENT, null, false);
	elements = new ElementMap(doc);
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:20,代码来源:AnalyzerTest.java


示例13: testFFMultiSrc

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testFFMultiSrc() throws IOException, CSSException {
    log.info("input:\n\n\n" + TEST_STRING2 + "\n\n\n");
    StyleSheet ss;

    ss = CSSFactory.parseString(TEST_STRING2, null);

    assertEquals("One rule is set", 1, ss.size());

    RuleFontFace rule = (RuleFontFace) ss.get(0);
    assertEquals("Rule contains 2 declarations ", 2, rule.size());
    assertEquals("Rule contains font-family declaration", "font-family: 'MyWebFont';\n", rule.get(0).toString());
    assertEquals("Rule contains scr declaration",
            "src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype');\n",
            rule.get(1).toString());

}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:18,代码来源:FontFaceTest.java


示例14: testFFMultiSrc2

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
    public void testFFMultiSrc2() throws IOException, CSSException {

        log.info("input:\n\n\n" + TEST_STRING3 + "\n\n\n");
        StyleSheet ss;

        ss = CSSFactory.parseString(TEST_STRING3, null);

        assertEquals("Two rules are set", 2, ss.size());

        RuleFontFace rule = (RuleFontFace) ss.get(0);
        assertEquals("Rule contains 3 declarations ", 3, rule.size());
        assertEquals("Rule contains font-family declaration", "font-family: 'MyWebFont';\n", rule.get(0).toString());
//        assertEquals("Rule contains scr declaration",
//                "src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'), url('myfont.ttf') format('truetype');\n",
//                rule.get(1).toString());

    }
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:19,代码来源:FontFaceTest.java


示例15: testFFSources

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testFFSources() throws IOException, CSSException {

    log.info("input:\n\n\n" + TEST_STRING4 + "\n\n\n");
    StyleSheet ss;

    ss = CSSFactory.parseString(TEST_STRING4, null);

    assertEquals("Four rules are set", 4, ss.size());

    RuleFontFace rule = (RuleFontFace) ss.get(0);
    assertEquals("Rule contains 5 declarations", 5, rule.size());
    List<RuleFontFace.Source> srcs = rule.getSources();
    assertEquals("There are 3 sources declared", 3, srcs.size());
    assertEquals("First name is correct", "Indie Flower", ((RuleFontFace.SourceLocal) srcs.get(0)).getName());
    assertEquals("Second name is correct", "IndieFlower", ((RuleFontFace.SourceLocal) srcs.get(1)).getName());
    assertEquals("Third name is correct URI", "https://fonts.gstatic.com/s/indieflower/v9/10JVD_humAd5zP2yrFqw6ugdm0LZdjqr5-oayXSOefg.woff2", ((RuleFontFace.SourceURL) srcs.get(2)).getURI().getValue());
    
    List<String> unirange = rule.getUnicodeRanges();
    assertEquals("There are 11 unicode ranges", 11, unirange.size());
    
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:23,代码来源:FontFaceTest.java


示例16: testDescendant

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testDescendant() throws CSSException, IOException {

	StyleSheet ss = CSSFactory.parseString(TEST_DESCENDANT, null);

	assertEquals("One rule is set", 1, ss.size());

	RuleSet rule = (RuleSet) ss.get(0);

	List<CombinedSelector> cslist = SelectorsUtil.appendCS(null);
	SelectorsUtil.appendSimpleSelector(cslist, "H1", null);
	SelectorsUtil.appendDescendant(cslist, "P");

	assertArrayEquals("Rule contains one combined selectors H1 P  ", cslist.toArray(),
			rule.getSelectors());

	assertEquals("Rule contains one declaration {display:inline;}",
			DeclarationsUtil.appendDeclaration(null, "display", tf
					.createIdent("inline")), rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:21,代码来源:SelectorTest.java


示例17: testAdjacent

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testAdjacent() throws CSSException, IOException {

	StyleSheet ss = CSSFactory.parseString(TEST_ADJACENT, null);
	assertEquals("One rule is set", 1, ss.size());

	RuleSet rule = (RuleSet) ss.get(0);

	List<CombinedSelector> cslist = SelectorsUtil.appendCS(null);
	SelectorsUtil.appendSimpleSelector(cslist, "DIV", null);
	SelectorsUtil.appendAdjacent(cslist, "P");

	assertArrayEquals("Rule contains one combined selectors DIV+P ", cslist.toArray(),
			rule.getSelectors());

	assertEquals("Rule contains one declaration {color:blue;}",
			DeclarationsUtil.appendDeclaration(null, "color", tf
					.createColor(0, 0, 255)), rule.asList());

}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:21,代码来源:SelectorTest.java


示例18: testPreceding

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testPreceding() throws CSSException, IOException {

    StyleSheet ss = CSSFactory.parseString(TEST_PRECEDING, null);
    assertEquals("One rule is set", 1, ss.size());

    RuleSet rule = (RuleSet) ss.get(0);

    List<CombinedSelector> cslist = SelectorsUtil.appendCS(null);
    SelectorsUtil.appendSimpleSelector(cslist, "DIV", null);
    SelectorsUtil.appendPreceding(cslist, "P");

    assertArrayEquals("Rule contains one combined selectors DIV~P ", cslist.toArray(),
            rule.getSelectors());

    assertEquals("Rule contains one declaration {color:blue;}",
            DeclarationsUtil.appendDeclaration(null, "color", tf
                    .createColor(0, 0, 255)), rule.asList());

}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:21,代码来源:SelectorTest.java


示例19: testClass

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testClass() throws CSSException, IOException {

	StyleSheet ss = CSSFactory.parseString(TEST_CLASS, null);
	assertEquals("One rule is set", 1, ss.size());

	RuleSet rule = (RuleSet) ss.get(0);

	List<CombinedSelector> cslist = SelectorsUtil.appendCS(null);
	SelectorsUtil.appendSimpleSelector(cslist, null, null, rf
			.createClass("fit"));

	assertArrayEquals("Rule contains one class selector .fit", cslist.toArray(), rule
			.getSelectors());

	assertEquals("Rule contains one declaration { width: 80%;}",
			DeclarationsUtil.appendDeclaration(null, "width", tf
					.createPercent(80.0f)), rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:20,代码来源:SelectorTest.java


示例20: testID

import cz.vutbr.web.css.CSSException; //导入依赖的package包/类
@Test
public void testID() throws CSSException, IOException {

	StyleSheet ss = CSSFactory.parseString(TEST_ID, null);
	assertEquals("One rule is set", 1, ss.size());

	RuleSet rule = (RuleSet) ss.get(0);

	List<CombinedSelector> cslist = SelectorsUtil.appendCS(null);
	SelectorsUtil.appendSimpleSelector(cslist, null, null, rf
			.createID("krysa"));

	assertArrayEquals("Rule contains one ID selector #krysa", cslist.toArray(), rule
			.getSelectors());

	assertEquals("Rule contains one declaration { font-size: 100px;}",
			DeclarationsUtil.appendDeclaration(null, "font-size", tf
					.createLength(100.0f).setUnit(TermNumeric.Unit.px)),
			rule.asList());
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:21,代码来源:SelectorTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegisterMapperFactory类代码示例发布时间:2022-05-22
下一篇:
Java R类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap