Package com.vaadin.ui

Examples of com.vaadin.ui.Button


        createUI(layout);
    }

    private void createUI(GridLayout layout) {
        layout.addComponent(new Label("abc"));
        layout.addComponent(new Button("B", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification n = new Notification("Test");
                getMainWindow().showNotification(n);
View Full Code Here


    private Component getTestComponent() {
        Panel p = new Panel();
        p.setSizeFull();

        Button b = new Button("toggle Values", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                toggleStyleName();
            }
        });
View Full Code Here

        final VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setSizeFull();

        HorizontalLayout buttonBar = new HorizontalLayout();
        buttonBar.setSizeUndefined();
        Button first = new Button("First layout");
        Button second = new Button("Second layout");
        first.setId("FirstButton");
        second.setId("SecondButton");
        buttonBar.addComponent(first);
        buttonBar.addComponent(second);
        mainLayout.addComponent(buttonBar);

        final HorizontalLayout firstLayout = buildTestLayout(true);
        final HorizontalLayout secondLayout = buildTestLayout(false);

        mainLayout.addComponent(firstLayout);
        mainLayout.setExpandRatio(firstLayout, 1);

        first.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                if (mainLayout.getComponent(1).equals(secondLayout)) {
                    mainLayout.replaceComponent(secondLayout, firstLayout);
                    mainLayout.setExpandRatio(firstLayout, 1);
                }
            }
        });
        second.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                if (mainLayout.getComponent(1).equals(firstLayout)) {
                    mainLayout.replaceComponent(firstLayout, secondLayout);
View Full Code Here

    class TestColumnGenerator implements ColumnGenerator {
        @Override
        public Component generateCell(Table source, Object rowId,
                Object columnId) {
            return new Button("1");
        }
View Full Code Here

        final LegacyWindow main = new LegacyWindow(getClass().getName()
                .substring(getClass().getName().lastIndexOf(".") + 1));
        setMainWindow(main);

        Button b = new Button("Add content");
        main.addComponent(b);

        final GridLayout gridLayout = new GridLayout(2, 2);
        main.addComponent(gridLayout);

        b.addListener(new Button.ClickListener() {
            int counter = 0;

            @Override
            public void buttonClick(ClickEvent event) {
View Full Code Here

    @Override
    public void init() {

        final LegacyWindow main = new LegacyWindow("#2053");
        setMainWindow(main);
        Button nothing = new Button("Do nothing");
        main.addComponent(nothing);
        nothing.setDescription("Even though no action is taked, this window is refreshed to "
                + "draw changes not originating from this window. Such changes include changes "
                + "made by other browser-windows.");
        Button add = new Button("Add a window", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                final String name = "Child " + (++childs);
                LegacyWindow c = new LegacyWindow(name);

                addWindow(c);
                main.open(new ExternalResource(c.getURL()), "_new");
                main.addComponent(new Label(name + " opened"));
                final TextField tf = new TextField("Non immediate textfield");
                c.addComponent(tf);
                tf.addListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        main.addComponent(new Label(name + " send text:"
                                + tf.getValue()));
                    }
                });
                for (int i = 0; i < 3; i++) {
                    final String caption = "Slow button " + i;
                    c.addComponent(new Button(caption,
                            new Button.ClickListener() {
                                @Override
                                public synchronized void buttonClick(
                                        ClickEvent event) {
                                    try {
                                        this.wait(2000);
                                    } catch (InterruptedException e) {
                                    }
                                    main.addComponent(new Label(caption
                                            + " pressed"));
                                }
                            }));
                }

            }
        });
        main.addComponent(add);
        add.setDescription("This button opens a new browser window. Closing the browser "
                + "window should do two things: 1) submit all unsubmitted state to server "
                + "(print any changes to textfield to main window) and 2) call window.close()"
                + " on the child window (print closed on the main window)");

    }
View Full Code Here

    @Override
    public void setup(VaadinRequest request) {
        table.setWidth("100%");
        table.setContainerDataSource(container);

        Button button = new Button("START");
        button.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                ++clickCount;
View Full Code Here

            imageTable.addItem(new Integer(i));
        }

        imageTable.setCurrentPageFirstItemIndex(index);

        vl.addComponent(new Button("Click", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                try {
                    Thread.sleep(500);
View Full Code Here

        main.addComponent(new Label(
                "Use debug dialog and trac number of registered paintables. It should not grow on subsequant b clicks."));

        final Layout lo = new VerticalLayout();

        Button b = new Button("b");

        main.addComponent(b);
        main.addComponent(lo);
        b.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

                repopupate(lo);
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow();
        setMainWindow(w);
        Button b = new Button("add", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                gl.addComponent(new Label("asd"), 0, gl.getCursorY(), 2,
                        gl.getCursorY());

            }

        });
        w.addComponent(b);

        b = new Button("empty", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                gl.removeAllComponents();
View Full Code Here

TOP

Related Classes of com.vaadin.ui.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.