Package nextapp.echo2.app

Examples of nextapp.echo2.app.MutableStyle


        JbsGrid grdMain = new JbsGrid(2);
        grdMain.setInsets(new Insets(5, 5));
        grdMain.setColumnWidth(0, new JbsExtent(300));

        grdMain.add(new Label(JbsL10N.getString("Permissions.user")));
        grdMain.add(cbbUsers);
        grdMain.add(new Label(JbsL10N.getString("Permissions.read")));
        grdMain.add(cbReadUser);
       
        grdMain.add(new Label(JbsL10N.getString("Permissions.write")));
        grdMain.add(cbWriteUser);

        grdMain.add(new Label(JbsL10N.getString("Permissions.group")));
        grdMain.add(cbbGroups);
        grdMain.add(new Label(JbsL10N.getString("Permissions.read")));
        grdMain.add(cbReadGroup);
        grdMain.add(new Label(JbsL10N.getString("Permissions.write")));
        grdMain.add(cbWriteGroup);

        grdMain.add(new Label(JbsL10N.getString("Permissions.others")));
        grdMain.add(new Label(""));
        grdMain.add(new Label(JbsL10N.getString("Permissions.read")));
        grdMain.add(cbReadOther);
        grdMain.add(new Label(JbsL10N.getString("Permissions.write")));
        grdMain.add(cbWriteOther);
       
        this.add(grdMain);
    }
View Full Code Here


        JbsGrid grdMain = new JbsGrid(2);
        grdMain.setInsets(new Insets(5, 5));
        //grdMain.setColumnWidth(0,new JbsExtent(200));

        grdMain.add(new Label(JbsL10N.getString("JbsCompany.company")));
        grdMain.add(cbbCompanies);

        this.getPnMain().add(grdMain);
    }
View Full Code Here

* 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

        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

   
    /**
     * 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

        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

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

* 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

        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

        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

TOP

Related Classes of nextapp.echo2.app.MutableStyle

Copyright © 2018 www.massapicom. 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.