Example usage for com.vaadin.ui Button getDescription

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

Introduction

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

Prototype

@Override
    public String getDescription() 

Source Link

Usage

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 w w  w.j  ava 2  s  .  co  m

    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;
}