Package com.vaadin.ui

Examples of com.vaadin.ui.Button$ClickListener


        addComponent(calendarComponent);
        setRowExpandRatio(getRows() - 1, 1.0f);
    }

    private void initNavigationButtons() {
        monthButton = new Button("Month", new ClickListener() {

            private static final long serialVersionUID = 1L;

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

        weekButton = new Button("Week", new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                // simulate week click
                WeekClickHandler handler = (WeekClickHandler) calendarComponent
                        .getHandler(WeekClick.EVENT_ID);
                handler.weekClick(new WeekClick(calendarComponent, calendar
                        .get(GregorianCalendar.WEEK_OF_YEAR), calendar
                        .get(GregorianCalendar.YEAR)));
            }
        });

        dayButton = new Button("Day", new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                // simulate day click
                BasicDateClickHandler handler = (BasicDateClickHandler) calendarComponent
                        .getHandler(DateClickEvent.EVENT_ID);
                handler.dateClick(new DateClickEvent(calendarComponent,
                        calendar.getTime()));
            }
        });

        nextButton = new Button("Next", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

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

        prevButton = new Button("Prev", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

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


                    }
                });
    }

    public void initAddNewEventButton() {
        addNewEvent = new Button("Add new event");
        addNewEvent.addClickListener(new Button.ClickListener() {

            private static final long serialVersionUID = -8307244759142541067L;

            @Override
View Full Code Here

        scheduleEventFieldLayout.addStyleName("light");
        scheduleEventFieldLayout.setMargin(false);
        layout.addComponent(scheduleEventFieldLayout);

        applyEventButton = new Button("Apply", new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                try {
                    commitCalendarEvent();
                } catch (CommitException e) {
                    e.printStackTrace();
                }
            }
        });
        applyEventButton.addStyleName("primary");
        Button cancel = new Button("Cancel", new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                discardCalendarEvent();
            }
        });
        deleteEventButton = new Button("Delete", new ClickListener() {

            private static final long serialVersionUID = 1L;

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

        final VerticalLayout verticalLayout = new VerticalLayout();

        final Label label1 = new Label("1");
        final Label label2 = new Label("2");

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

            @Override
            public void buttonClick(ClickEvent event) {
                if (verticalLayout.getComponentIndex(label1) > -1) {
                    verticalLayout.replaceComponent(label1, label2);
View Full Code Here

        }
        rta = new RichTextArea();
        rta.setVisible(false);
        ts.addTab(rta, "Hidden rta", null);

        Button b = new Button("Show area", new ClickListener() {

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

        layout.addComponent(b);

        b = new Button("Show tab", new ClickListener() {

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

        // setTheme("tests-tickets");
        createUI((AbstractOrderedLayout) w.getContent());
    }

    private void createUI(AbstractOrderedLayout layout) {
        Button b = new Button("This is a button");
        CheckBox cb = new CheckBox("This is a checkbox");
        cb.setImmediate(true);
        setTheme("tests-tickets");
        layout.setStyleName("mylayout");
        status = new Label("Result:");
View Full Code Here

        labelLong = new Label(
                "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");
        gl.addComponent(combo);
        gl.addComponent(labelLong);

        Button b = new Button("Add label text", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                labelLong.setValue(labelLong.getValue() + "-12345");
            }
View Full Code Here

        table.setWidth("400px");
        table.setPageLength(-1);
        table.setContainerDataSource(cont);
        table.setSelectable(true);

        Button buttonRestore = new Button("Restore table rows");
        buttonRestore.setId("buttonRestore");
        buttonRestore.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                cont.addAll(restoringItemList);
            }
        });

        Button buttonReAddAllViaAddAll = new Button("Re-add rows all at once");
        buttonReAddAllViaAddAll.setId("buttonReAddAllViaAddAll");
        buttonReAddAllViaAddAll.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                List<TableItem> originalItemIds = new ArrayList<TableItem>(cont
                        .getItemIds());
                cont.removeAllItems();
                cont.addAll(originalItemIds);
            }
        });

        Button buttonReplaceByAnotherCollectionViaAddAll = new Button(
                "Replace by another items (via addAll())");
        buttonReplaceByAnotherCollectionViaAddAll
                .setId("buttonReplaceByAnotherCollectionViaAddAll");
        buttonReplaceByAnotherCollectionViaAddAll
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        // create new collection (of different items) with other
                        // size
                        List<TableItem> itemList = new ArrayList<TableItem>();
                        for (int i = 0; i < 79; i++) {
                            TableItem ti = new TableItem();
                            ti.setName("AnotherItem1_" + i);
                            itemList.add(ti);
                        }
                        cont.addAll(itemList);
                    }
                });

        Button buttonReplaceByAnotherCollectionViaAdd = new Button(
                "Replace by another items (via add(), add()..)");
        buttonReplaceByAnotherCollectionViaAdd
                .setId("buttonReplaceByAnotherCollectionViaAdd");
        buttonReplaceByAnotherCollectionViaAdd
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        for (int i = 0; i < 81; i++) {
                            TableItem ti = new TableItem();
                            ti.setName("AnotherItem2_" + i);
                            // add one by one in container
                            cont.addBean(ti);
                        }
                    }
                });

        Button buttonReplaceBySubsetOfSmallerSize = new Button(
                "Replace rows by sub-set of smaller size (size not enought for restoring scroll position)");
        buttonReplaceBySubsetOfSmallerSize
                .setId("buttonReplaceBySubsetOfSmallerSize");
        buttonReplaceBySubsetOfSmallerSize
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        cont.addAll(restoringItemList.subList(0, 20));
                    }
                });

        Button buttonReplaceByWholeSubsetPlusOneNew = new Button(
                "Replace rows by whole subset plus one new item");
        buttonReplaceByWholeSubsetPlusOneNew
                .setId("buttonReplaceByWholeSubsetPlusOneNew");
        buttonReplaceByWholeSubsetPlusOneNew
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();

                        List<TableItem> list = new ArrayList<TableItem>(
                                restoringItemList);
                        TableItem ti = new TableItem();
                        ti.setName("AnotherItem3_" + 80);
                        list.add(ti);
                        cont.addAll(list);
                    }
                });

        Button buttonRemoveAllAddOne = new Button(
                "Remove all items and add only one new item");
        buttonRemoveAllAddOne.setId("buttonRemoveAllAddOne");
        buttonRemoveAllAddOne.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                TableItem ti = new TableItem();
                ti.setName("Item_" + 20);
                cont.addBean(ti);
            }
        });

        // This should be the last test as it changes the table datasource
        Button buttonReplaceByNewDatasource = new Button(
                "Remove all items and add new datasource");
        buttonReplaceByNewDatasource.setId("buttonReplaceByNewDatasource");
        buttonReplaceByNewDatasource.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                BeanItemContainer<TableItem> newContainer = new BeanItemContainer<TableItem>(
View Full Code Here

        createUI(layout);
    }

    private void createUI(GridLayout layout) {
        HorizontalLayout buttonLayout = new HorizontalLayout();
        button1 = new Button("Button which is 50px wide");
        button1.setWidth("50px");
        button2 = new Button("Button without width");
        button3 = new Button("Click to repaint buttons", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                button1.markAsDirty();
                button2.markAsDirty();
View Full Code Here

        GridLayout gl = new GridLayout(units.length, sizes.length);
        main.addComponent(gl);
        for (int i = 0; i < sizes.length; i++) {
            for (int j = 0; j < units.length; j++) {
                String s = sizes[i] + units[j];
                gl.addComponent(new Button(s, this));
            }
        }

        gl.addComponent(new Button("null", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                c.setWidth(null);
                c.setHeight(null);
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.