Java 8 ViewCSS - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ViewCSS class.

This code example shows how to use the following methods:getComputedStyle
		String css = "Label, Button.special { color: black; }\n"
				+ "Button { color: blue; font-weight: bold; }\n"; 
		ViewCSS viewCSS = createViewCss(css);
 
		TestElement button = new TestElement("Button", engine);
		CSSStyleDeclaration style = viewCSS.getComputedStyle(button, null);
		assertEquals("blue", style.getPropertyCSSValue("color").getCssText());
 
		button.setClass("special");
		style = viewCSS.getComputedStyle(button, null);
		assertEquals("black", style.getPropertyCSSValue("color").getCssText());
		assertEquals("bold", style.getPropertyCSSValue("font-weight")
				.getCssText());
	} 
 
	@Test
	public void testSpecificities() throws Exception {
		// Different specificities 
		String css = "* { color: black; }\n"
				+ "Button { color: blue; }\n" 
4
CodeRank
This code example shows how to use the following methods:getComputedStyle
		String css = "Label { color: black; }" + "Button { color: blue; font-weight: bold; }\n"
				+ "Button { color: green; }\n"; 
		ViewCSS viewCSS = createViewCss(css);
 
		TestElement shell = new TestElement("Shell", engine);
		CSSStyleDeclaration shellStyle = viewCSS.getComputedStyle(shell, null);
		assertNull(shellStyle);
 
		TestElement label = new TestElement("Label", engine);
		CSSStyleDeclaration labelStyle = viewCSS.getComputedStyle(label, null);
		assertNotNull(labelStyle);
		assertEquals(1, labelStyle.getLength());
 
		TestElement button = new TestElement("Button", engine);
		CSSStyleDeclaration buttonStyle = viewCSS.getComputedStyle(button, null);
		assertNotNull(buttonStyle);
		assertEquals(2, buttonStyle.getLength());
	} 
 
	@Test
4
CodeRank
This code example shows how to use the following methods:getComputedStyle
		buttonAlpha.setClass("ClassAlpha");
 
		TestElement buttonBeta = new TestElement("Button", engine);
		buttonBeta.setClass("ClassBeta");
 
		CSSStyleDeclaration styleAlpha = viewCSS.getComputedStyle(buttonAlpha,
				null); 
		CSSStyleDeclaration styleBeta = viewCSS.getComputedStyle(buttonBeta,
				null); 
 
		assertEquals("value", styleAlpha.getPropertyCSSValue("property")
				.getCssText());
		assertEquals("value2", styleBeta.getPropertyCSSValue("property")
				.getCssText());
	} 
 
	private File createTempCssFile(String cssString) throws Exception {
		File result = File.createTempFile("e4.ui.tests-", ".css");
		FileWriter fileWriter = new FileWriter(result);
		try { 
4
CodeRank
See Code Examples for Java 8 ViewCSS Methods: