Example usage for com.vaadin.ui Button addListener

List of usage examples for com.vaadin.ui Button addListener

Introduction

In this page you can find the example usage for com.vaadin.ui Button addListener.

Prototype

@Override
    public Registration addListener(Component.Listener listener) 

Source Link

Usage

From source file:jp.primecloud.auto.ui.WinServerNetworkConfig.java

License:Open Source License

WinServerNetworkConfig(Application ap, Long instanceNo, Long platformNo, InstanceNetworkDto instanceNetworkDto,
        List<InstanceNetworkDto> instanceNetworkDtos) {
    this.ap = ap;
    this.instanceNo = instanceNo;
    this.platformNo = platformNo;
    this.instanceNetworkDto = instanceNetworkDto;
    this.isAddMode = (this.instanceNetworkDto == null) ? true : false;
    this.instanceNetworkDtos = instanceNetworkDtos;

    // Window/*from  ww  w .  j a  v  a 2  s .co  m*/
    if (isAddMode) {
        //?
        setIcon(Icons.ADD.resource());
        setCaption(ViewProperties.getCaption("window.WinServerAddNetwork"));
    } else {
        //?
        setIcon(Icons.EDIT.resource());
        setCaption(ViewProperties.getCaption("window.WinServerEditNetwork"));
    }
    setModal(true);
    setWidth("380px");
    setResizable(false);

    // Layout
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Form
    Form form = new Form();

    //??
    networkSelect = new ComboBox(ViewProperties.getCaption("field.netWork"));
    networkSelect.setWidth(COMBOBOX_WIDTH);
    networkSelect.setNullSelectionAllowed(false);
    networkSelect.setItemCaptionPropertyId(CID_NETWORK);
    networkSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    networkSelect.setImmediate(true);
    networkSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            changeNetwork(event);
        }
    });

    //IP?
    ipModeSelect = new ComboBox(ViewProperties.getCaption("caption.field.ipMode"));
    ipModeSelect.setWidth(COMBOBOX_WIDTH);
    ipModeSelect.setNullSelectionAllowed(false);
    ipModeSelect.setItemCaptionPropertyId(CID_IP_MODE);
    ipModeSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    ipModeSelect.setImmediate(true);
    ipModeSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            changeIpMode(event);
        }
    });

    //IP
    ipAddressField = new TextField(ViewProperties.getCaption("field.ipAddress"));
    ipAddressField.setWidth("100%");
    ipAddressField.setImmediate(true);

    //?
    netmaskField = new TextField(ViewProperties.getCaption("field.netmask"));
    netmaskField.setWidth("100%");
    netmaskField.setReadOnly(true);
    netmaskField.setImmediate(true);

    //
    gateWayField = new TextField(ViewProperties.getCaption("field.gateway"));
    gateWayField.setWidth("100%");
    gateWayField.setReadOnly(true);
    gateWayField.setImmediate(true);

    //DNS1
    dns1Field = new TextField(ViewProperties.getCaption("field.dns1"));
    dns1Field.setWidth("100%");
    dns1Field.setReadOnly(true);
    dns1Field.setImmediate(true);

    //DNS2
    dns2Field = new TextField(ViewProperties.getCaption("field.dns2"));
    dns2Field.setWidth("100%");
    dns2Field.setReadOnly(true);
    dns2Field.setImmediate(true);

    //Primary
    primaryOpg = new OptionGroup(ViewProperties.getCaption("field.primary"));
    primaryOpg.addItem(CID_PRIMARY);
    primaryOpg.setItemCaption(CID_PRIMARY, "");
    primaryOpg.setNullSelectionAllowed(false);
    primaryOpg.setImmediate(true);

    form.getLayout().addComponent(networkSelect);
    form.getLayout().addComponent(ipModeSelect);
    form.getLayout().addComponent(ipAddressField);
    form.getLayout().addComponent(netmaskField);
    form.getLayout().addComponent(gateWayField);
    form.getLayout().addComponent(dns1Field);
    form.getLayout().addComponent(dns2Field);
    form.getLayout().addComponent(primaryOpg);
    layout.addComponent(form);

    // ??
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.setMargin(false, true, true, false);
    layout.addComponent(buttonBar);
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    // OK Button
    Button btnOk = new Button(ViewProperties.getCaption("button.ok"));
    btnOk.setDescription(ViewProperties.getCaption("description.ok"));
    btnOk.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    buttonBar.addComponent(btnOk);
    // [Enter]?OK
    btnOk.setClickShortcut(KeyCode.ENTER);

    //Cancel Button
    Button btnCancel = new Button(ViewProperties.getCaption("button.cancel"));
    btnCancel.setDescription(ViewProperties.getCaption("description.cancel"));
    btnCancel.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttonBar.addComponent(btnCancel);

    //?
    initData();

    //
    showData();

    // ??
    initValidation();
}

From source file:jp.primecloud.auto.ui.WinServiceAdd.java

License:Open Source License

WinServiceAdd(Application ap) {
    apl = ap;/*from w ww.  jav a 2  s .c o  m*/

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.winServiceAdd"));
    setModal(true);
    setWidth("630px");
    //setHeight("500px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new BasicForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.addService"));
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinServiceAdd.this.addButtonClick(event);
        }
    });
    okbar.addComponent(addButton);
    // [Enter]?addButton
    addButton.setClickShortcut(KeyCode.ENTER);
    addButton.focus();

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinServiceAdd.this.close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ???
    initData();

    // 
    showServices();
}

From source file:jp.primecloud.auto.ui.WinServiceEdit.java

License:Open Source License

WinServiceEdit(Application ap, Long componentNo) {
    apl = ap;//  ww  w  .j a  v a  2  s  .c o m
    this.componentNo = componentNo;

    // ???
    initData();

    //
    setIcon(Icons.EDITMINI.resource());
    setCaption(ViewProperties.getCaption("window.winServiceEdit"));
    setModal(true);
    setWidth("600px");

    VerticalLayout layout = (VerticalLayout) getContent();
    //        layout.setWidth("100%");
    layout.setMargin(false, true, false, true);
    layout.setSpacing(true);

    // 
    layout.addComponent(tab);

    basicTab = new BasicTab();
    tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource());

    detailTab = new DetailTab();
    Boolean useCustomPara = BooleanUtils.toBooleanObject(Config.getProperty("userCustomize.useCustomParam"));
    if (BooleanUtils.isTrue(useCustomPara)) {
        tab.addTab(detailTab, ViewProperties.getCaption("tab.detail"), Icons.BASIC.resource());
    }

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editService.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ?
    basicTab.showData();

    // ?
    detailTab.showData();
}

From source file:jp.primecloud.auto.ui.WinUserAuthAddEdit.java

License:Open Source License

WinUserAuthAddEdit(Long masterUserNo, Long userNo) {

    this.masterUserNo = masterUserNo;
    this.userNo = userNo;

    //?// w  w w .  j ava  2 s  . c o m
    isAddUser = (userNo == null) ? true : false;

    // ???
    initData();

    //
    //????
    if (isAddUser) {
        //??
        setIcon(Icons.ADD.resource());
        setCaption(ViewProperties.getCaption("window.winUserAdd"));
    } else {
        //?
        setIcon(Icons.EDIT.resource());
        setCaption(ViewProperties.getCaption("window.winUserEdit"));
    }
    //
    setModal(true);
    setWidth("450px");
    //
    setResizable(false);

    //
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new AuthAddForm());

    // ?
    userAuthTable = new UserAuthTable();
    layout.addComponent(userAuthTable);

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(true, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    if (isAddUser) {
        //??
        okButton.setDescription(ViewProperties.getCaption("description.addUserAuth.ok"));
    } else {
        //?
        okButton.setDescription(ViewProperties.getCaption("description.editUserAuth.ok"));
    }
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinUserAuthAddEdit.this.okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);

    //Delete
    if (!isAddUser) {
        //?????
        Button deleteButton = new Button(ViewProperties.getCaption("button.delete"));
        deleteButton.setDescription(ViewProperties.getCaption("description.editUserAuth.delete"));
        deleteButton.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                WinUserAuthAddEdit.this.deleteButtonClick(event);
            }
        });
        okbar.addComponent(deleteButton);
    }

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinUserAuthAddEdit.this.cancelButtonClick(event);
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    showData();

    // ??
    initValidation();
}

From source file:jp.primecloud.auto.ui.WinUserAuthEditDetail.java

License:Open Source License

WinUserAuthEditDetail(Long userNo, Long farmNo) {

    this.userNo = userNo;
    this.farmNo = farmNo;

    ////w w  w .ja v a 2  s  .co m
    setIcon(Icons.EDIT.resource());
    setCaption(ViewProperties.getCaption("window.winUserDetailEdit"));

    //
    setModal(true);
    setWidth("300px");
    //
    setResizable(false);

    //
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    layout.addComponent(new AuthForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editUserAuthDetail.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinUserAuthEditDetail.this.okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinUserAuthEditDetail.this.cancelButtonClick(event);
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initData();

    // ?
    showData();

    // ??
    initValidation();
}

From source file:kn.uni.gis.ui.AdminWindow.java

License:Apache License

private Component loginComponent() {
    final VerticalLayout layout = new VerticalLayout();

    final PasswordField passwordField = new PasswordField("Old Hunters Age");
    passwordField.setWidth("-1px");
    passwordField.setHeight("-1px");
    passwordField.focus();/*from   w  ww  . j  a v a 2 s  . co  m*/

    Button button_2 = new Button();
    button_2.setCaption("Login");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (password.equals(passwordField.getValue())) {
                AdminWindow.this.removeComponent(layout);
                AdminWindow.this.addComponent(createTable());
            } else {
                AdminWindow.this.showNotification("Wrong age!");
            }
        }
    });

    layout.addComponent(passwordField);
    layout.addComponent(button_2);

    layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER);
    layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER);

    return layout;
}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);//from   w w  w.j a va  2 s  . co  m
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}

From source file:module.contents.presentationTier.component.AddSectionButton.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    final Button button = new Button("+ " + getMessage("label.add.section"));
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addListener(new Button.ClickListener() {
        @Override//from  w  ww. j  a v a  2s .c  o  m
        public void buttonClick(ClickEvent event) {
            final ContentEditorWindow editorWindow = new ContentEditorWindow(
                    getMessage("label.add.section.window.title"), "label.save");
            editorWindow.setContentEditorSaveListner(contentEditorSaveListner);
            getWindow().addWindow(editorWindow);
            editorWindow.center();
        }
    });
    setCompositionRoot(button);
}

From source file:module.contents.presentationTier.component.EditSectionButton.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    final String key = plainHtmlEditor ? "label.edit.html" : "label.edit";
    final Button button = new Button(getMessage(key));
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addListener(new Button.ClickListener() {
        @Override/*w w w .  jav  a 2  s.c o m*/
        public void buttonClick(ClickEvent event) {
            final ContentEditorLayout contentEditorLayout = new ContentEditorLayout("label.save",
                    section.getTitle().getContent(), section.getContents().getContent(), plainHtmlEditor);

            final AbstractComponentContainer parent = (AbstractComponentContainer) container.getParent();
            parent.replaceComponent(container, contentEditorLayout);

            contentEditorLayout.setContentEditorSaveListner(new ContentEditorSaveListner() {
                @Override
                public void save(final String title, final String content) {
                    editSectionSaveListner.save(title, content, contentEditorLayout);
                }
            });

            contentEditorLayout.setContentEditorCloseListner(new ContentEditorCloseListner() {
                @Override
                public void close() {
                    parent.replaceComponent(contentEditorLayout, container);
                }
            });
        }
    });
    setCompositionRoot(button);
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getButtonPreviews() {
    Layout grid = getPreviewLayout("Buttons");

    Button button = new Button("Button");
    grid.addComponent(button);//from  ww w . ja  v  a  2 s .  com

    button = new Button("Default");
    button.setStyleName("default");
    grid.addComponent(button);

    button = new Button("Small");
    button.setStyleName("small");
    grid.addComponent(button);

    button = new Button("Small Default");
    button.setStyleName("small default");
    grid.addComponent(button);

    button = new Button("Big");
    button.setStyleName("big");
    grid.addComponent(button);

    button = new Button("Big Default");
    button.setStyleName("big default");
    grid.addComponent(button);

    button = new Button("Disabled");
    button.setEnabled(false);
    grid.addComponent(button);

    button = new Button("Disabled default");
    button.setEnabled(false);
    button.setStyleName("default");
    grid.addComponent(button);

    button = new Button("Link style");
    button.setStyleName(BaseTheme.BUTTON_LINK);
    grid.addComponent(button);

    button = new Button("Disabled link");
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.setEnabled(false);
    grid.addComponent(button);

    button = new Button("120px overflows out of the button");
    button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    button.setWidth("120px");
    grid.addComponent(button);

    button = new Button("Small");
    button.setStyleName("small");
    button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(button);

    button = new Button("Big");
    button.setStyleName("big");
    button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(button);

    button = new Button("Big Default");
    button.setStyleName("big default");
    button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png"));
    grid.addComponent(button);

    button = new Button("Big link");
    button.setStyleName(BaseTheme.BUTTON_LINK + " big");
    button.setIcon(new ThemeResource("../runo/icons/32/document.png"));
    grid.addComponent(button);

    button = new Button("Borderless");
    button.setStyleName("borderless");
    button.setIcon(new ThemeResource("../runo/icons/32/note.png"));
    grid.addComponent(button);

    button = new Button("Borderless icon on top");
    button.setStyleName("borderless icon-on-top");
    button.setIcon(new ThemeResource("../runo/icons/32/note.png"));
    grid.addComponent(button);

    button = new Button("Icon on top");
    button.setStyleName("icon-on-top");
    button.setIcon(new ThemeResource("../runo/icons/32/users.png"));
    grid.addComponent(button);

    button = new Button("Wide Default");
    button.setStyleName("wide default");
    grid.addComponent(button);

    button = new Button("Wide");
    button.setStyleName("wide");
    grid.addComponent(button);

    button = new Button("Tall");
    button.setStyleName("tall");
    grid.addComponent(button);

    button = new Button("Wide, Tall & Big");
    button.setStyleName("wide tall big");
    grid.addComponent(button);

    button = new Button("Icon on right");
    button.setStyleName("icon-on-right");
    button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(button);

    button = new Button("Big icon");
    button.setStyleName("icon-on-right big");
    button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(button);

    button = new Button("Toggle (down)");
    button.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (event.getButton().getStyleName().endsWith("down")) {
                event.getButton().removeStyleName("down");
            } else {
                event.getButton().addStyleName("down");
            }
        }
    });
    button.addStyleName("down");
    grid.addComponent(button);
    button.setDescription(
            button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>");

    button = new Button();
    button.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (event.getButton().getStyleName().endsWith("down")) {
                event.getButton().removeStyleName("down");
            } else {
                event.getButton().addStyleName("down");
            }
        }
    });
    button.addStyleName("icon-only");
    button.addStyleName("down");
    button.setIcon(new ThemeResource("../runo/icons/16/user.png"));
    grid.addComponent(button);
    button.setDescription(
            button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>");

    Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com"));
    grid.addComponent(l);

    l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com"));
    l.setIcon(new ThemeResource("../runo/icons/32/globe.png"));
    grid.addComponent(l);

    return grid;
}