Package nextapp.echo2.app

Examples of nextapp.echo2.app.Label


        controlsColumn.add(windowTestControls);
        windowTestControls = new WindowTestControls("Embedded", contentPane);
        controlsColumn.add(windowTestControls);
       
        Column componentSamplerControlsColumn = new Column();
        componentSamplerControlsColumn.add(new Label("Component \"Sampler\""));
        controlsColumn.add(componentSamplerControlsColumn);

        Button button;

        button = new Button("Add Component Sampler to Embedded ContentPane");
View Full Code Here


       final Column mainColumn = new Column();
      
       Grid grid = new Grid();
       mainColumn.add(grid);
      
       grid.add(new Label("User"));
       TextField tf = new TextField();
       tf.setText("This Text will render somewhere");
       grid.add(tf);
       grid.add(new Label("Subject"));
       tf = new TextField();
       tf.setText("BLANK OUT THIS FIELD!!!");
       grid.add(tf);
       grid.add(new Label("Message"));
       grid.add(new TextArea());
       grid.add(new Label("Stuff"));
       grid.add(new ListBox(new Object[]{"one", "two", "three"}));
       grid.add(new Label("Things"));
       grid.add(new SelectField(new Object[]{"four", "five", "six"}));
      
       Button okButton = new Button("Ok");
       okButton.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
               Column errorColumn = new Column();
               errorColumn.add(new Label("Did Mozilla break?"));
               errorColumn.add(new Label("Did Mozilla break?"));
               mainColumn.add(errorColumn, 0);
               //**** UNCOMMENT THE FOLLWOING LINE FOR "FIXING" THIS BUG
               //windowPane.setHeight(windowPane.getHeight());
           }
       });
View Full Code Here

        windowPane.setTitleInsets(new Insets(10, 5));
        windowPane.setInsets(new Insets(10));
        windowPane.setWidth(new Extent(500));
        windowPane.setHeight(new Extent(280));
        windowPane.setStyleName("Default");
        windowPane.add(new Label(StyleUtil.QUASI_LATIN_TEXT_1));
        return windowPane;
    }
View Full Code Here

                labelValue = out.toString();
            } else {
                labelValue = value.toString();
            }
           
            Label label = new Label(labelValue);
            label.setStyleName(row % 2 == 0 ? "EvenCellLabel" : "OddCellLabel");
            return label;
        }
View Full Code Here

        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        setCellSpacing(new Extent(3));
       
        Label label;
        label = new Label("This test will cause the application to continuously push asynchronous updates "
                + "to the client by clicking buttons randomly on the screen.  Once started, the test cannot be "
                + "stopped until your application session is destroyed, i.e., by exiting your browser or "
                + "manually clearing the session cookie.");
        add(label);
       
        if (InteractiveApp.LIVE_DEMO_SERVER) {
            label = new Label("Because you are visiting this application on the nextapp.com server, we have disabled "
                    + "the options to run this test indefinitely and/or with a 0ms callback interval.  If you install this "
                    + "application on your own server, you will be given the option of running the more extreme version "
                    + "of this test.  A binary Web Archive (WAR file) version of this application is provided by the "
                    + "standard Echo2 download.");
            add(label);
View Full Code Here

        ButtonColumn controlsColumn;
       
        // Content
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Content"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Content = Small Label", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new Label("Hello, World!"));
            }
        });
       
        controlsColumn.addButton("Set Content = Big Label", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new Label(StyleUtil.QUASI_LATIN_TEXT_1));
            }
        });
       
        controlsColumn.addButton("Set Content = WindowPaneTest", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new WindowPaneTest());
            }
        });
       
        controlsColumn.addButton("Set Content = Nothing", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
            }
        });
       
        controlsColumn.addButton("Add-Remove-Add", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                Label label = new Label("Hello, World!");
                windowPane.add(label);
                windowPane.remove(label);
                windowPane.add(label);
            }
        });
       
        // Properties
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Properties"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Style Name = Default", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setStyleName("Default");
            }
        });
        controlsColumn.addButton("Clear Style Name", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setStyleName(null);
            }
        });
       
        controlsColumn.addButton("Set Border 1", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBorder(new FillImageBorder(Color.GREEN, new Insets(20), new Insets(5)));
            }
        });

        controlsColumn.addButton("Set Border 2 (L/R only)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImageBorder fib = new FillImageBorder(Color.GREEN, new Insets(20), new Insets(5));
                fib.setFillImage(FillImageBorder.LEFT, Styles.BG_SHADOW_DARK_BLUE);
                fib.setFillImage(FillImageBorder.RIGHT, Styles.BG_SHADOW_LIGHT_BLUE);
                windowPane.setBorder(fib);
            }
        });

        controlsColumn.addButton("Clear Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBorder(null);
            }
        });

        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackground(null);
            }
        });
        controlsColumn.addButton("Set Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setFont(StyleUtil.randomFont());
            }
        });
        controlsColumn.addButton("Clear Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setFont(null);
            }
        });
        controlsColumn.addButton("Set Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
            }
        });
        controlsColumn.addButton("Clear Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackgroundImage(null);
            }
        });
        controlsColumn.addButton("Set Content Insets to 0", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Set Content Insets to 5", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Set Content Insets to 10/20/40/80", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(10, 20, 40, 80));
            }
        });
        controlsColumn.addButton("Clear Content Insets", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(null);
            }
        });

        controlsColumn.addButton("Set Position Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setPositionX(new Extent((int) (Math.random() * 600)));
                windowPane.setPositionY(new Extent((int) (Math.random() * 500)));
            }
        });
        controlsColumn.addButton("Set Size Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setWidth(new Extent(100 + (int) (Math.random() * 400)));
                windowPane.setHeight(new Extent(100 + (int) (Math.random() * 300)));
            }
        });
        controlsColumn.addButton("Set Position&Size Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setPositionX(new Extent((int) (Math.random() * 600)));
                windowPane.setPositionY(new Extent((int) (Math.random() * 500)));
                windowPane.setWidth(new Extent(100 + (int) (Math.random() * 400)));
                windowPane.setHeight(new Extent(100 + (int) (Math.random() * 300)));
            }
        });       
       
        // Title-Related Properties
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Properties"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Title", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle("Window Title");
            }
        });
        controlsColumn.addButton("Set Title Long", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle("This is a fairly long window title that goes on for a little to long to see if " +
                        "wrapping is handled properly and such.");
            }
        });
        controlsColumn.addButton("Clear Title", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle(null);
            }
        });
        controlsColumn.addButton("Set Title Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleHeight(new Extent(((int) (Math.random() * 24)) + 24));
            }
        });
        controlsColumn.addButton("Clear Title Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleHeight(null);
            }
        });
        controlsColumn.addButton("Set Title Insets to 0", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Set Title Insets to 5", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Set Title Insets to 10/20/40/80", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleInsets(new Insets(10, 20, 40, 80));
            }
        });
        controlsColumn.addButton("Clear Title Insets", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleInsets(null);
            }
        });
        controlsColumn.addButton("Set Title Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Title Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleForeground(null);
            }
        });
        controlsColumn.addButton("Set Title Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Title Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleBackground(null);
            }
        });
        controlsColumn.addButton("Set Title Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleFont(StyleUtil.randomFont());
            }
        });
        controlsColumn.addButton("Clear Title Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleFont(null);
            }
        });

        // Integration Tests
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Content"));
        groupContainerColumn.add(controlsColumn);

        controlsColumn.addButton("Add Component", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (contentPane.getComponentCount() == 0) {
View Full Code Here

     */
    public void testIllegalChildren() {
        Button button = new Button();
        boolean exceptionThrown = false;
        try {
            button.add(new Label("you can't add children to this component, right?"));
        } catch (IllegalChildException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
    }
View Full Code Here

   
    /**
     * Test default property values.
     */
    public void testDefaults() {
        Label label = new Label();
        assertTrue(label.isLineWrap());
    }
View Full Code Here

        grid.add(selectField2);
       
        listBox2 = new ListBox(NUMBERS);
        grid.add(listBox2);
       
        controlsColumn.add(new Label("Global"));

        controlsColumn.addButton("Add ActionListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.addActionListener(actionListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Remove ActionListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.removeActionListener(actionListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Add ChangeListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.getSelectionModel().addChangeListener(changeListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Remove ChangeListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.getSelectionModel().removeChangeListener(changeListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Add ListDataListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.getModel().addListDataListener(listDataListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Remove ListDataListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.getModel().removeListDataListener(listDataListener);
                    }
                });
            }
        });
        controlsColumn.addButton("Toggle Enabled State", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setEnabled(!listComponent.isEnabled());
                    }
                });
            }
        });
        controlsColumn.addButton("Set ListCellRenderer", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setCellRenderer(evenOddListCellRenderer);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear ListCellRenderer", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setCellRenderer(AbstractListComponent.DEFAULT_LIST_CELL_RENDERER);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Border border = StyleUtil.randomBorder();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setBorder(border);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setBorder(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setBackground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Font font = StyleUtil.randomFont();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setFont(font);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setFont(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Border border = StyleUtil.randomBorder();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBorder(border);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Disabled Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBorder(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBackground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Font font = StyleUtil.randomFont();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledFont(font);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Disabled Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledFont(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Toggle ToolTip Text", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent.getToolTipText() == null) {
                            listComponent.setToolTipText("This is a tool tip.");
                        } else {
                            listComponent.setToolTipText(null);
                        }
                    }
                });
            }
        });
        controlsColumn.addButton("Enable Rollover Effects", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverEnabled(true);
                    }
                });
            }
        });
        controlsColumn.addButton("Disable Rollover Effects", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverEnabled(false);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Rollover Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Rollover Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverBackground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Rollover Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Font font = StyleUtil.randomFont();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverFont(font);
                    }
                });
            }
        });
        controlsColumn.addButton("Increase Width (15 px)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Extent width = listBox1.getWidth() == null ? new Extent(75) : listBox1.getWidth();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setWidth(Extent.add(width, new Extent(15)));
                    }
                });
            }
        });
        controlsColumn.addButton("Decrease Width (15 px)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Extent width = listBox1.getWidth() == null ? new Extent(75) : listBox1.getWidth();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setWidth(Extent.add(width, new Extent(-15)));
                    }
                });
            }
        });
        controlsColumn.addButton("Increase Height (15 px)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Extent height = listBox1.getHeight() == null ? new Extent(75) : listBox1.getHeight();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setHeight(Extent.add(height, new Extent(15)));
                    }
                });
            }
        });
        controlsColumn.addButton("Decrease Height (15 px)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Extent height = listBox1.getHeight() == null ? new Extent(75) : listBox1.getHeight();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setHeight(Extent.add(height, new Extent(-15)));
                    }
                });
            }
        });

        controlsColumn.addButton("Select Index 0", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent instanceof ListBox) {
                            ((ListBox) listComponent).setSelectedIndices(new int[] {0});
                        } else if (listComponent instanceof SelectField) {
                            ((SelectField) listComponent).setSelectedIndex(0);
                        }
                    }
                });
            }
        });
       
        controlsColumn.addButton("Select Index 2", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent instanceof ListBox) {
                            ((ListBox) listComponent).setSelectedIndices(new int[] {2});
                        } else if (listComponent instanceof SelectField) {
                            ((SelectField) listComponent).setSelectedIndex(2);
                        }
                    }
                });
            }
        });
       
        controlsColumn.addButton("Select Index 1502", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent instanceof ListBox) {
                            ((ListBox) listComponent).setSelectedIndices(new int[] {1502});
                        } else if (listComponent instanceof SelectField) {
                            ((SelectField) listComponent).setSelectedIndex(1502);
                        }
                    }
                });
            }
        });
       
        controlsColumn.addButton("Clear Selections", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent instanceof ListBox) {
                            ((ListBox) listComponent).setSelectedIndices(new int[] {});
                        } else if (listComponent instanceof SelectField) {
                            ((SelectField) listComponent).setSelectedIndex(-1);
                        }
                    }
                });
            }
        });
       
        controlsColumn.addButton("Empty ListModel", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setModel(new DefaultListModel());
                    }
                });
            }
        });
       
        controlsColumn.addButton("Set ListModel = Numbers", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator(){
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setModel(new DefaultListModel(NUMBERS));
                    }
                });
            }
        });
        controlsColumn.addButton("Focus SelectField1", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setFocusedComponent(selectField1);
            }
        });
        controlsColumn.addButton("Focus SelectField2", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setFocusedComponent(selectField2);
            }
        });
       
        controlsColumn.add(new Label("ListBox-specific"));
       
        controlsColumn.addButton("Toggle Multiple Select", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final int mode = ListSelectionModel.MULTIPLE_SELECTION == listBox1.getSelectionMode()
                        ? ListSelectionModel.SINGLE_SELECTION : ListSelectionModel.MULTIPLE_SELECTION;
View Full Code Here

    /**
     * Attempt to illegally add children, test for failure.
     */
    public void testIllegalChildren() {
        Label label = new Label();
        boolean exceptionThrown = false;
        try {
            label.add(new Label("you can't add children to this component, right?"));
        } catch (IllegalChildException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
    }
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.