Package nextapp.echo2.app

Examples of nextapp.echo2.app.Button


        add(layoutColumn);
       
        layoutColumn.add(new Label(new ResourceImageReference("/echo2tutorial/numberguess/CongratulationsBanner.png")));
        layoutColumn.add(new Label("You got the correct answer in " + numberOfTries + (numberOfTries == 1 ? " try." : " tries.")));

        Button button = new Button("Play Again");
        button.setForeground(Color.WHITE);
        button.setBackground(Color.RED);
        button.setWidth(new Extent(200));
        button.addActionListener(this);
        layoutColumn.add(button);
    }
View Full Code Here


       
        sessionExpirationMessageText = new TextField();
        sessionExpirationMessageText.setStyleName("Default");
        grid.add(sessionExpirationMessageText);
       
        Button updateButton = new Button("Update ClientConfiguration");
        updateButton.setStyleName("Default");
        updateButton.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                updateClientConfiguration();
            }
        });
        add(updateButton);
       
        Button exceptionButton = new Button("Throw a RuntimeException");
        exceptionButton.setStyleName("Default");
        exceptionButton.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                throw new RuntimeException("Test RuntimeException thrown at user request by ClientConfigurationTest.");
            }
        });
        add(exceptionButton);
       
        Button expireSessionButton = new Button("Expire Session");
        expireSessionButton.setStyleName("Default");
        expireSessionButton.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                WebRenderServlet.getActiveConnection().getRequest().getSession().invalidate();
            }
        });
        add(expireSessionButton);
View Full Code Here

       
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        Button button = new Button("Throw a RuntimeException");
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                throw new RuntimeException("Deliberately thrown InteractiveTestApp RuntimeException.");
            }
        });
        add(button);
View Full Code Here

       
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        Button delayButton = new Button("Test 3 second delay");
        delayButton.setStyleName("Default");
        delayButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException ex) {
                }
            }
        });
        add(delayButton);
       
        final Button blockedButton = new Button("This button has been clicked 0 times");
        blockedButton.setStyleName("Default");
        blockedButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                blockedButton.setText("This button has been clicked " + ++clickCount + " times");
            }
        });
        add(blockedButton);
       
        Button setNullButton = new Button("Set ServerDelayMessage to None");
        setNullButton.setStyleName("Default");
        setNullButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(null);
            }
        });
        add(setNullButton);
       
        Button setDefaultButton = new Button("Set ServerDelayMessage to Default");
        setDefaultButton.setStyleName("Default");
        setDefaultButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(DefaultServerDelayMessage.INSTANCE);
            }
        });
        add(setDefaultButton);
       
        Button setCustomDefaultButton = new Button("Set ServerDelayMessage to Custom DefaultServerDelayMessage");
        setCustomDefaultButton.setStyleName("Default");
        setCustomDefaultButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(new DefaultServerDelayMessage("Well, this seems to be taking a while.  "
                        + "Now might be a good time to grab a snack or a frosty beverage from the kitchen."));
            }
        });
        add(setCustomDefaultButton);
       
        Button coolButton = new Button("Set ServerDelayMessage to CoolDelayMessage");
        coolButton.setStyleName("Default");
        coolButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(new CoolDelayMessage(containerContext, "PLEASE WAIT"));
            }
View Full Code Here

        setCellSpacing(new Extent(20));
       
        Column controlsColumn = new Column();
        add(controlsColumn);
       
        Button defaultButton = new Button("Slate Blue Style Sheet (DEFAULT)");
        defaultButton.setStyleName("Default");
        defaultButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setStyleSheet(Styles.DEFAULT_STYLE_SHEET);
            }
        });
        controlsColumn.add(defaultButton);
       
        Button greenButton = new Button("Forest Green Style Sheet");
        greenButton.setStyleName("Default");
        greenButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setStyleSheet(Styles.GREEN_STYLE_SHEET);
            }
        });
        controlsColumn.add(greenButton);
       
        Button nullButton = new Button("No Style Sheet");
        nullButton.setStyleName("Default");
        nullButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setStyleSheet(null);
            }
        });
        controlsColumn.add(nullButton);
       
        Button customButton = new Button("Custom Style Sheet (Edit Below)");
        customButton.setStyleName("Default");
        customButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    StyleSheet styleSheet = loadStyleSheet(styleSheetEntryTextArea.getDocument().getText());
                    getApplicationInstance().setStyleSheet(styleSheet);
                } catch (ComponentXmlException ex) {
View Full Code Here

     * buttons when invoked.
     *
     * @param clickCount the number of buttons to click
     */
    private void addRandomClickButton(final int clickCount) {
        Button button = new Button("Perform " + clickCount + " Random Click" + (clickCount == 1 ? "" : "s"));
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < clickCount; ++i) {
                    RandomClick.clickRandomButton();
                }
            }
View Full Code Here

            }
        });

        controlsColumn.addButton("Append New Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Button button = createGridCellButton();
                grid.add(button);
                selectCellButton(button);
            }
        });

        controlsColumn.addButton("Append 10 New Cells", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Button button = null;
                for (int i = 0; i < 10; ++i) {
                    button = createGridCellButton();
                    grid.add(button);
                }
                selectCellButton(button);
            }
        });

        controlsColumn.addButton("Delete Selected Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    int index = grid.indexOf(selectedButton);
                    grid.remove(selectedButton);
                    if (grid.getComponentCount() != 0) {
                        if (index < grid.getComponentCount()) {
                            selectCellButton((Button) grid.getComponent(index));
                        } else {
                            selectCellButton((Button) grid.getComponent(grid.getComponentCount() - 1));
                        }
                    } else {
                        selectCellButton(null);
                    }
                }
            }
        });
       
        controlsColumn.addButton("Delete All Cells", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.removeAll();
            }
        });
       
        controlsColumn.addButton("Add Row-Button Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Row row = new Row();
                for (int i = 0; i < 3; ++i) {
                    Button button = new Button("Test (" + i + ") Test");
                    button.setStyleName("Default");
                    row.add(button);
                }
                grid.add(row);
            }
        });
View Full Code Here

            }
        });       
    }

    public Button createGridCellButton() {
        Button button = new Button("Grid Cell #" + nextCellNumber++);
        GridLayoutData layoutData = new GridLayoutData();
        button.setLayoutData(layoutData);
        button.addActionListener(cellButtonActionListener);
        return button;
    }
View Full Code Here

       
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        Button button;
       
        button = new Button("Enqueue Redirect Command");
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().enqueueCommand(new BrowserRedirectCommand("http://echo.nextapp.com"));
            }
        });
        add(button);
       
        button = new Button("Enqueue Redirect Command to mailto: URL");
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().enqueueCommand(new BrowserRedirectCommand("mailto:info@nextapp.com"));
            }
        });
        add(button);
       
        button = new Button("Enqueue Simple Window Open Command");
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().enqueueCommand(
                        new BrowserOpenWindowCommand("http://echo.nextapp.com", null, null));
            }
        });
        add(button);
       
        button = new Button("Enqueue 640x240 Named Window Open Command");
        button.setStyleName("Default");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().enqueueCommand(
                        new BrowserOpenWindowCommand("http://echo.nextapp.com",
                        "auxwindow", "width=640,height=240"));
            }
View Full Code Here

     * @param groupTitle The title of the group
     * @return The group as a <code>Column</code>
     */
    public Column addGroup(String groupName, String groupTitle) {
        //Look for an existing group with the given name:
        Column newColumn = (Column) getComponent(groupName);
        //If nor group is found then create a new one:
        if (newColumn == null) {
            newColumn = new Column();
            newColumn.setId(groupName);
            newColumn.setStyleName("Default");
            AccordionPaneLayoutData layoutData = new AccordionPaneLayoutData();
            layoutData.setTitle(groupTitle);
            newColumn.setLayoutData(layoutData);
            this.add(newColumn);
        }
        return newColumn;
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Button

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.