Package nextapp.echo2.app

Examples of nextapp.echo2.app.Label


    /**
     * Test property accessors and mutators.
     */
    public void testProperties() {
        Label label = new Label();
        label.setText("Label");
        label.setIcon(TestConstants.ICON);
        label.setTextAlignment(new Alignment(Alignment.LEFT, Alignment.TOP));
        label.setTextPosition(new Alignment(Alignment.DEFAULT, Alignment.BOTTOM));
        label.setLineWrap(false);
        assertEquals("Label", label.getText());
        assertEquals(TestConstants.ICON, label.getIcon());
        assertEquals(new Alignment(Alignment.LEFT, Alignment.TOP), label.getTextAlignment());
        assertEquals(new Alignment(Alignment.DEFAULT, Alignment.BOTTOM), label.getTextPosition());
        assertEquals(false, label.isLineWrap());
    }
View Full Code Here


    public ContentPaneTest() {
        super(SplitPane.ORIENTATION_HORIZONTAL, new Extent(250, Extent.PX));
        setStyleName("DefaultResizable");
       
        final ContentPane rootContentPane = InteractiveApp.getApp().getDefaultWindow().getContent();
        final Label contentLabel = new Label(StyleUtil.QUASI_LATIN_TEXT_1 + StyleUtil.QUASI_LATIN_TEXT_1);
       
        ButtonColumn controlsColumn = new ButtonColumn();
        controlsColumn.setStyleName("TestControlsColumn");
        add(controlsColumn);
       
        final ContentPane testContentPane = new ContentPane();
        add(testContentPane);

        controlsColumn.add(new Label("Root Content Pane"));

        controlsColumn.addButton("Reset", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rootContentPane.setBackground(null);
                rootContentPane.setForeground(null);
                rootContentPane.setFont(null);
            }
        });
        controlsColumn.addButton("Change Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rootContentPane.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Change Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rootContentPane.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Change Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rootContentPane.setFont(StyleUtil.randomFont());
            }
        });
       
        controlsColumn.add(new Label("Test Content Pane"));
       
        controlsColumn.addButton("Reset", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackground(null);
                testContentPane.setForeground(null);
                testContentPane.setFont(null);
            }
        });
        controlsColumn.addButton("Change Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Change Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
            }
        });
        controlsColumn.addButton("Background Image @ 50px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PX_REPEAT);
            }
        });
        controlsColumn.addButton("Background Image @ 1%", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT);
            }
        });
        controlsColumn.addButton("Background Image @ 50%", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PERCENT_REPEAT);
            }
        });
        controlsColumn.addButton("Background Null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setBackgroundImage(null);
            }
        });
        controlsColumn.addButton("Change Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testContentPane.setFont(StyleUtil.randomFont());
            }
        });
       
        controlsColumn.addButton("Add Label", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                removeAllContent(testContentPane);
                testContentPane.add(contentLabel);
            }
        });
        controlsColumn.addButton("Add SplitPane", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                removeAllContent(testContentPane);
                SplitPane splitPane = new SplitPane();
                splitPane.setResizable(true);
               
                Label label;
                SplitPaneLayoutData layoutData;

                layoutData = new SplitPaneLayoutData();
                layoutData.setBackground(new Color(0xafafff));
                label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                label.setLayoutData(layoutData);
                splitPane.add(label);

                layoutData = new SplitPaneLayoutData();
                layoutData.setBackground(new Color(0xafffaf));
                label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                label.setLayoutData(layoutData);
                splitPane.add(label);

                testContentPane.add(splitPane);
            }
        });
        controlsColumn.addButton("Add SplitPane / ContentPane / Button", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                removeAllContent(testContentPane);
                SplitPane splitPane = new SplitPane();
                splitPane.setResizable(true);
               
                Label label;
                SplitPaneLayoutData layoutData;

                layoutData = new SplitPaneLayoutData();
                layoutData.setBackground(new Color(0xafafff));
                ContentPane subContentPane = new ContentPane();
                subContentPane.setLayoutData(layoutData);
                splitPane.add(subContentPane);
               
                SplitPane splitPane2 = new SplitPane(SplitPane.ORIENTATION_VERTICAL);
                subContentPane.add(splitPane2);
               
                ContentPane subContentPane2 = new ContentPane();
                splitPane2.add(subContentPane2);
                subContentPane2.add(new Label("Test!"));
               
                ContentPane subContentPane3 = new ContentPane();
                splitPane2.add(subContentPane3);
               
               
                final Button button = new Button("Alpha");
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        button.setText("Alpha".equals(button.getText()) ? "Omega" : "Alpha");
                    }
                });
                subContentPane3.add(button);

                layoutData = new SplitPaneLayoutData();
                layoutData.setBackground(new Color(0xafffaf));
                label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                label.setLayoutData(layoutData);
                splitPane.add(label);

                testContentPane.add(splitPane);
            }
        });
View Full Code Here

        assertEquals(1, addedChildren.length);
        assertEquals(0, componentUpdates[0].getRemovedChildren().length);
        assertEquals(column1, addedChildren[0]);
       
        // Add a label to column.
        column1.add(new Label("A"));

        // Ensure only 1 update w/ 1 child added.
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(1, componentUpdates.length);
        addedChildren = componentUpdates[0].getAddedChildren();
        assertEquals(1, addedChildren.length);
        assertEquals(0, componentUpdates[0].getRemovedChildren().length);
        assertEquals(column1, addedChildren[0]);

        // Add another column.
        Column column2 = new Column();
        Label labelB = new Label("B");
        column2.add(labelB);
        columnApp.getColumn().add(column2);
       
        // Ensure only 1 update w/ 2 children added.
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
View Full Code Here

    public void testAddInvisibleComponent() {
        ServerComponentUpdate[] componentUpdates;
        manager.purge();
       
        Label label = new Label("Label1");
        label.setVisible(false);
        columnApp.getColumn().add(label);
       
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(0, componentUpdates.length);
    }
View Full Code Here

        manager.purge();
       
        Column column = new Column();
        columnApp.getColumn().add(column);
        Label label1 = new Label("Label1");
        column.add(label1);
        Label label2 = new Label("Label2");
        label2.setVisible(false);
        column.add(label2);
       
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(0, componentUpdates.length);
    }
View Full Code Here

        manager.purge();
       
        // Setup.
        Column column = new Column();
        columnApp.getColumn().add(column);
        Label label1 = new Label("Label1");
        column.add(label1);
        Label label2 = new Label("Label2");
        column.add(label2);
        label2.setLayoutData(new ColumnLayoutData());

        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(1, componentUpdates.length);
        assertEquals(false, componentUpdates[0].hasUpdatedLayoutDataChildren());
       
View Full Code Here

    /**
     * Ensure that component removes and descendant removes are properly stored.
     */
    public void testRemove1() {
        Column column = new Column();
        Label label = new Label();
        column.add(label);
        columnApp.getColumn().add(column);
        manager.purge();
       
        columnApp.getColumn().remove(column);
View Full Code Here

     */
    public void testRemove2() {
        Column column1 = new Column();
        Column column2 = new Column();
        column1.add(column2);
        Label label = new Label();
        column2.add(label);
        columnApp.getColumn().add(column1);
        manager.purge();
       
        column1.remove(column2);
View Full Code Here

     */
    public void testUpdateSorting2() {
        ServerComponentUpdate[] componentUpdates;
        Column column2 = new Column();
        columnApp.getColumn().add(column2);
        Label label2 = new Label();
        column2.add(label2);
        manager.purge();

        columnApp.getLabel().setBackground(Color.BLUE);
        columnApp.getContentPane().setBackground(Color.RED);
        columnApp.getColumn().setBackground(Color.GREEN);
        label2.setBackground(Color.YELLOW);
        column2.setBackground(Color.ORANGE);

        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(5, componentUpdates.length);
        assertEquals(columnApp.getContentPane(), componentUpdates[0].getParent());
View Full Code Here

        manager.purge();
       
        // Setup.
        Column column = new Column();
        columnApp.getColumn().add(column);
        Label label1 = new Label("Label1");
        column.add(label1);
        Label label2 = new Label("Label2");
        label2.setVisible(false);
        column.add(label2);
        label2.setLayoutData(new ColumnLayoutData());

        manager.purge();
       
        label1.setVisible(false);
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(1, componentUpdates.length);
        assertEquals(column, componentUpdates[0].getParent());
        assertFalse(componentUpdates[0].hasAddedChildren());
        assertTrue(componentUpdates[0].hasRemovedChildren());
        assertFalse(componentUpdates[0].hasUpdatedProperties());
        assertFalse(componentUpdates[0].hasUpdatedLayoutDataChildren());
       
        Component[] components = componentUpdates[0].getRemovedChildren();
        assertEquals(1, components.length);
        assertEquals(label1, components[0]);
       
        manager.purge();
       
        label2.setVisible(true);
        componentUpdates = manager.getServerUpdateManager().getComponentUpdates();
        assertEquals(1, componentUpdates.length);
        assertEquals(column, componentUpdates[0].getParent());
        assertTrue(componentUpdates[0].hasAddedChildren());
        assertFalse(componentUpdates[0].hasRemovedChildren());
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Label

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.