Examples of MutableStyle


Examples of nextapp.echo2.app.MutableStyle

* Unit tests for <code>DerivedMutableStyle</code>s.
*/
public class DerivedMutableStyleTest extends TestCase {
   
    public void testIndexed() {
        MutableStyle baseStyle = new MutableStyle();
        baseStyle.setIndexedProperty("alpha", 1, "a");
        baseStyle.setIndexedProperty("bravo", 2"b");
        baseStyle.setIndexedProperty("bravo", 1"b3");
       
        DerivedMutableStyle derivedStyle = new DerivedMutableStyle(baseStyle);
        derivedStyle.setIndexedProperty("bravo", 2, "b2");
        derivedStyle.setIndexedProperty("charlie", 3, "c");

        assertEquals("b", baseStyle.getIndexedProperty("bravo", 2));
       
        assertEquals("b2", derivedStyle.getIndexedProperty("bravo", 2));
        assertEquals("c", derivedStyle.getIndexedProperty("charlie", 3));
       
        assertEquals("a", derivedStyle.getIndexedProperty("alpha", 1));
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        assertTrue(derivedStyle.isIndexedPropertySet("bravo", 2));
        assertFalse(derivedStyle.isIndexedPropertySet("bravo", 3));
    }

    public void testSimple() {
        MutableStyle baseStyle = new MutableStyle();
        baseStyle.setProperty("alpha", "a");
        baseStyle.setProperty("bravo", "b");
       
        DerivedMutableStyle derivedStyle = new DerivedMutableStyle(baseStyle);
        baseStyle.setProperty("bravo", "b2");
        baseStyle.setProperty("charlie", "c");
       
        assertEquals("a", derivedStyle.getProperty("alpha"));
        assertEquals("b2", derivedStyle.getProperty("bravo"));
        assertEquals("c", derivedStyle.getProperty("charlie"));
    }
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

   
    /**
     * Test basic features of style <code>Component</code>.
     */
    public void testStyle() {
        MutableStyle style = new MutableStyle();
        style.setProperty(Component.PROPERTY_BACKGROUND, Color.GREEN);
       
        TextField textField = new TextField();
        textField.setForeground(Color.YELLOW);
       
        assertEquals(Color.YELLOW, textField.getRenderProperty(Component.PROPERTY_FOREGROUND));
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        app.doInit();
        assertTrue(app.getLabel().isRegistered());
       
        MutableStyleSheet styleSheet = new MutableStyleSheet();

        MutableStyle alphaButtonStyle = new MutableStyle();
        alphaButtonStyle.setProperty(Button.PROPERTY_BORDER, TestConstants.BORDER_THICK_ORANGE);
        alphaButtonStyle.setProperty(Button.PROPERTY_BACKGROUND, Color.YELLOW);
        styleSheet.addStyle(Button.class, "alpha", alphaButtonStyle);

        MutableStyle bravoButtonStyle = new MutableStyle();
        bravoButtonStyle.setProperty(Button.PROPERTY_BORDER, TestConstants.BORDER_THIN_YELLOW);
        bravoButtonStyle.setProperty(Button.PROPERTY_BACKGROUND, Color.GREEN);
        styleSheet.addStyle(Button.class, "bravo", bravoButtonStyle);

        MutableStyle bravoLabelStyle = new MutableStyle();
        bravoLabelStyle.setProperty(Label.PROPERTY_FOREGROUND, Color.RED);
        styleSheet.addStyle(Label.class, "bravo", bravoLabelStyle);
       
        app.setStyleSheet(styleSheet);

        assertNull(app.getLabel().getRenderProperty(Label.PROPERTY_FOREGROUND));
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

public class StyleSheetTest extends TestCase {
   
    public void testBasicOperation() {
        MutableStyleSheet styleSheet = new MutableStyleSheet();
       
        MutableStyle alphaButtonStyle = new MutableStyle();
        alphaButtonStyle.setProperty(Button.PROPERTY_BORDER, TestConstants.BORDER_THICK_ORANGE);
        alphaButtonStyle.setProperty(Button.PROPERTY_BACKGROUND, Color.YELLOW);
        styleSheet.addStyle(Button.class, "alpha", alphaButtonStyle);
       
        assertEquals(alphaButtonStyle, styleSheet.getStyle(Button.class, "alpha"));
        assertNull(styleSheet.getStyle(Button.class, "bravo"));
       
        MutableStyle bravoButtonStyle = new MutableStyle();
        bravoButtonStyle.setProperty(Button.PROPERTY_BORDER, TestConstants.BORDER_THIN_YELLOW);
        bravoButtonStyle.setProperty(Button.PROPERTY_BACKGROUND, Color.GREEN);
        styleSheet.addStyle(Button.class, "bravo", bravoButtonStyle);

        assertEquals(alphaButtonStyle, styleSheet.getStyle(Button.class, "alpha"));
        assertEquals(bravoButtonStyle, styleSheet.getStyle(Button.class, "bravo"));
       
        MutableStyle bravoLabelStyle = new MutableStyle();
        bravoLabelStyle.setProperty(Label.PROPERTY_FOREGROUND, Color.RED);
        styleSheet.addStyle(Label.class, "bravo", bravoLabelStyle);

        assertEquals(alphaButtonStyle, styleSheet.getStyle(Button.class, "alpha"));
        assertEquals(bravoButtonStyle, styleSheet.getStyle(Button.class, "bravo"));
        assertEquals(bravoLabelStyle, styleSheet.getStyle(Label.class, "bravo"));
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

* Unit test(s) for the <code>nextapp.echo2.app.MutableStyle</code>.
*/
public class MutableStyleTest extends TestCase {
   
    public void testAddStyle() {
        MutableStyle style1 = new MutableStyle();
        style1.setIndexedProperty("alpha", 0, "tango");
        style1.setIndexedProperty("alpha", 2, "uniform");
        style1.setIndexedProperty("alpha", 3, "victor");
        style1.setProperty("charlie", "delta");
        style1.setProperty("echo", "foxtrot");
       
        MutableStyle style2 = new MutableStyle();
        style2.setProperty("charlie", "golf");
        assertEquals("golf", style2.getProperty("charlie"));
       
        style2.addStyleContent(style1);
       
        assertEquals("tango", style2.getIndexedProperty("alpha", 0));
        assertEquals("uniform", style2.getIndexedProperty("alpha", 2));
        assertEquals("victor", style2.getIndexedProperty("alpha", 3));
        assertEquals("delta", style2.getProperty("charlie"));
        assertEquals("foxtrot", style2.getProperty("echo"));
       
        style2.setIndexedProperty("alpha", 3, "whiskey");
        assertEquals("whiskey", style2.getIndexedProperty("alpha", 3));
        assertEquals("victor", style1.getIndexedProperty("alpha", 3));
       
        style2.setProperty("echo", "hotel");
        assertEquals("hotel", style2.getProperty("echo"));
        assertEquals("foxtrot", style1.getProperty("echo"));
    }
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        assertEquals("hotel", style2.getProperty("echo"));
        assertEquals("foxtrot", style1.getProperty("echo"));
    }
   
    public void testBasic() {
        MutableStyle style = new MutableStyle();
        assertEquals(0, style.size());
        assertFalse(style.isPropertySet("alpha"));
        assertNull(style.getProperty("alpha"));
       
        style.setProperty("alpha", "bravo");
        assertEquals(1, style.size());
        assertTrue(style.isPropertySet("alpha"));
        assertFalse(style.isPropertySet("bravo"));
       
        style.setProperty("bravo", "charlie");
        assertEquals(2, style.size());
        assertEquals("bravo", style.getProperty("alpha"));
        assertEquals("charlie", style.getProperty("bravo"));
       
        style.setProperty("bravo", "delta");
        assertEquals(2, style.size());
        assertEquals("bravo", style.getProperty("alpha"));
        assertEquals("delta", style.getProperty("bravo"));
       
        style.setProperty("echo", "foxtrot");
        style.setProperty("golf", "hotel");
        style.setProperty("india", "juliet");
        style.setProperty("kilo", "lima");
        assertEquals(6, style.size());
        assertEquals("juliet", style.getProperty("india"));
       
        style.removeProperty("kilo");
        assertEquals(5, style.size());
        assertNull(style.getProperty("kilo"));

        style.removeProperty("alpha");
        assertEquals(4, style.size());
        assertNull(style.getProperty("alpha"));
       
        style.removeProperty("mike");
        assertEquals(4, style.size());
       
        style.removeProperty("echo");
        style.removeProperty("golf");
        style.removeProperty("india");
        assertEquals(1, style.size());
       
        style.removeProperty("bravo");
        assertEquals(0, style.size());
    }
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        style.removeProperty("bravo");
        assertEquals(0, style.size());
    }
   
    public void testGetPropertyIndices() {
        MutableStyle style = new MutableStyle();
        style.setIndexedProperty("alpha", 0, "zero");
        style.setIndexedProperty("alpha", 1, "one");
        style.setIndexedProperty("alpha", 5, "five");
        Iterator it = style.getPropertyIndices("alpha");
        assertNotNull(it);
        Set indices = new HashSet();
        while (it.hasNext()) {
            indices.add(it.next());
        }
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        assertFalse(indices.contains(new Integer(2)));
        assertTrue(indices.contains(new Integer(5)));
    }
   
    public void testGetPropertyNames() {
        MutableStyle style = new MutableStyle();
        style.setProperty("alpha", "bravo");
        style.setProperty("charlie", "delta");
        style.setProperty("echo", "foxtrot");
        Iterator it = style.getPropertyNames();
        assertNotNull(it);
        Set names = new HashSet();
        while (it.hasNext()) {
            names.add(it.next());
        }
View Full Code Here

Examples of nextapp.echo2.app.MutableStyle

        assertFalse(names.contains("delta"));
        assertFalse(names.contains("foxtrot"));
    }
   
    public void testIndexedProperty() {
        MutableStyle style = new MutableStyle();
        style.setIndexedProperty("alpha", 0, "0");
        style.setIndexedProperty("alpha", 1, "1");
        style.setIndexedProperty("alpha", 2, "2");
        style.setIndexedProperty("alpha", 0, "3");
       
        assertFalse(style.isIndexedPropertySet("alpha", -1));
        assertTrue(style.isIndexedPropertySet("alpha", 0));
        assertTrue(style.isIndexedPropertySet("alpha", 1));
        assertTrue(style.isIndexedPropertySet("alpha", 2));
        assertFalse(style.isIndexedPropertySet("alpha", 3));
        assertEquals("3", style.getIndexedProperty("alpha", 0));
        assertEquals("1", style.getIndexedProperty("alpha", 1));
        assertEquals("2", style.getIndexedProperty("alpha", 2));
       
        style.removeIndexedProperty("alpha", 1);
        assertFalse(style.isIndexedPropertySet("alpha", 1));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.