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


Java CSSException类代码示例

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


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


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