Package com.vaadin.ui

Examples of com.vaadin.ui.Button$ClickListener


        addInfo();

        result = new Label();
        main.addComponent(result);

        main.addComponent(new Button("click when rendered",
                new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        endTest();
                    }
                }));

        main.addComponent(new Button(
                "Click for layout repaint (cached components)",
                new ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        testContainer.markAsDirty();
View Full Code Here


                        + contentLenght);
            }

        });

        final Button b = new Button("Update status",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        readState();
                    }
                });

        final Button c = new Button("Update status with gc",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        gc();
                    }
                });

        main.addComponent(up);
        l = new Label("Idle");
        main.addComponent(l);

        pi.setVisible(false);
        pi.setPollingInterval(300);
        main.addComponent(pi);
        main.addComponent(transferred);

        memoryStatus = new Label();
        main.addComponent(memoryStatus);

        statusLayout.setMargin(true);
        status.setVisible(false);
        main.addComponent(status);

        Button cancel = new Button("Cancel current upload");
        cancel.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                buffer.cancel();
            }
        });

        main.addComponent(cancel);

        final Button restart = new Button("Restart demo application");
        restart.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                TestForStyledUpload.this.close();
            }
View Full Code Here

                refreshMemUsage();
            }

        });

        final Button b = new Button("Reed state from upload",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        readState();
                    }
                });

        final Button c = new Button("Force GC", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                gc();
            }
        });

        main.addComponent(b);
        main.addComponent(c);
        main.addComponent(beSluggish);
        main.addComponent(throwExecption);
        main.addComponent(interrupt);
        interrupt.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                up.interruptUpload();
            }
        });

        uploadBufferSelector = new Select("StreamVariable type");
        uploadBufferSelector.setImmediate(true);
        uploadBufferSelector.addItem("memory");
        uploadBufferSelector.setValue("memory");
        uploadBufferSelector.addItem("tempfile");
        uploadBufferSelector
                .addListener(new AbstractField.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        setBuffer();
                    }
                });
        main.addComponent(uploadBufferSelector);

        main.addComponent(up);
        l = new Label("Idle");
        main.addComponent(l);

        pi.setVisible(false);
        pi.setPollingInterval(1000);
        main.addComponent(pi);

        pi2.setVisible(false);
        pi2.setPollingInterval(1000);
        main.addComponent(pi2);

        memoryStatus = new Label();
        main.addComponent(memoryStatus);

        statusLayout.setMargin(true);
        status.setVisible(false);
        main.addComponent(status);

        final Button restart = new Button("R");
        restart.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                LegacyWindow window = (LegacyWindow) event.getButton().getUI();
                window.getApplication().close();
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        final SimpleJavascriptExtension simpleJavascriptExtension = new SimpleJavascriptExtension();
        simpleJavascriptExtension.setPrefix("Prefix: ");
        addExtension(simpleJavascriptExtension);
        addComponent(new Button("Send rpc greeting",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        simpleJavascriptExtension.greetRpc("Rpc greeting");
                    }
                }));
        addComponent(new Button("Send callback greeting",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        simpleJavascriptExtension
                                .greetCallback("Callback greeting");
View Full Code Here

        MyComponent(String name) {
            HorizontalLayout ol = new HorizontalLayout();
            ol.setId(name.replaceAll(" ", ""));
            ol.addComponent(new Label(name));
            up = new Button("up");
            up.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    int newIndex = order.indexOf(MyComponent.this) - 1;
                    MyComponent old = order.get(newIndex);
                    main.replaceComponent(old, MyComponent.this);
                    order.remove(MyComponent.this);
                    order.add(newIndex, MyComponent.this);
                    if (newIndex == 0) {
                        MyComponent.this.setMode(FIRST);
                    } else {
                        MyComponent.this.setMode(69);
                    }
                }
            });
            ol.addComponent(up);

            down = new Button("down");
            down.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    int newIndex = order.indexOf(MyComponent.this) + 1;
                    MyComponent old = order.get(newIndex);
View Full Code Here

        for (int i = 0; i < rows; i++) {
            final Vector<Object> content = new Vector<Object>();
            for (int j = 0; j < cols; j++) {
                content.add(rndString());
            }
            content.add(new Button("b" + i, new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    Button b = event.getButton();
                    System.out.println(b.getCaption() + " click: "
                            + (new Date()).toString());
                    System.out.println(b.getUI().getSession());

                }
            }));
            t.addItem(content.toArray(), "" + i);
        }
View Full Code Here

    private static final String INSTALLED_ATRIBUTE_NAME = BootstrapModifyUI.class
            .getName() + ".installed";

    @Override
    protected void setup(VaadinRequest request) {
        Button c = new Button("Add bootstrap listener",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        getSession().addBootstrapListener(
                                createBootstrapListener());
                        event.getButton().setEnabled(false);
                        getSession().setAttribute(INSTALLED_ATRIBUTE_NAME,
                                Boolean.TRUE);
                    }
                });
        addComponent(c);
        c.setEnabled(getSession().getAttribute(INSTALLED_ATRIBUTE_NAME) == null);
    }
View Full Code Here

            result = new Label();
            result.setCaption("Label component " + caption);
            break;
        case 1:
            // Button
            result = new Button();
            result.setCaption("Button component " + caption);
            break;
        case 2:
            // TextField
            result = new TextField();
View Full Code Here

        main.addComponent(new Label("Testing multiple listeners."));

        //
        // Button listeners
        //
        b1 = new Button("Button 1");
        main.addComponent(b1);

        MyClickListener mutualListener = new MyClickListener("mutual1");

        addListeners(b1, 1);
View Full Code Here

        addComponent(new Label("The button's text is the client token:"));
        addComponent(new CsrfButton());
        addComponent(new Label("This one is from the server"));
        addComponent(new Label(getSession().getCsrfToken()));
        Button pressMe = new Button("Click me to send a request");
        pressMe.setId(PRESS_ID);
        addComponent(pressMe);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Button$ClickListener

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.