Example usage for com.vaadin.ui Button setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

private Component getBennuInterface() {
    GridSystemLayout gsl = new GridSystemLayout();
    gsl.setMargin(false);/*from  w  ww .  j  a  va2  s.  com*/

    Label lblBigTitle = new Label("A Big Title (H1)", Label.CONTENT_TEXT);
    lblBigTitle.setStyleName(BennuTheme.LABEL_H1);

    Label lblBigText = new Label(LOREM_TEXT_LARGE, Label.CONTENT_TEXT);

    gsl.setCell("big_title", 16, lblBigTitle);
    gsl.setCell("big_text", 16, lblBigText);

    Label lblOneLink = new Label(
            "<a href='http://www.google.com'>Label Link : One link a day keeps the doctor away</a>",
            Label.CONTENT_XHTML);
    gsl.setCell("label_one_link", 16, lblOneLink);

    Button btOneLink = new Button("Button Link: One link a day keeps the doctor away", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().showNotification("You just clicked a button link!");
        }
    });

    btOneLink.setStyleName(BaseTheme.BUTTON_LINK);
    gsl.setCell("button_one_link", 16, btOneLink);

    Label lblTitleH2 = new Label("A Not So Big Title (H2)", Label.CONTENT_TEXT);
    lblTitleH2.setStyleName(BennuTheme.LABEL_H2);
    gsl.setCell("not_so_big_title", 16, lblTitleH2);

    Label lblSmallText = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("small_text", 16, lblSmallText);

    Table table = new Table();
    table.setSizeFull();
    table.setPageLength(0);
    table.addContainerProperty("Name", String.class, "");
    table.addContainerProperty("Age", Integer.class, "");
    table.addContainerProperty("Nickname", String.class, "");

    table.addItem(new Object[] { "Giacomo Guilizzoni", 34, "Peidi" }, 1);
    table.addItem(new Object[] { "Giodp Jack Guilizzoni", 4, "The Guids" }, 2);
    table.addItem(new Object[] { "Marco Botton", 31, "" }, 3);
    table.addItem(new Object[] { "Mariah Maciachlan", 35, "Patata" }, 4);
    table.addItem(new Object[] { "Valerie Libery WOW! Division", 23, "Val" }, 5);
    table.addItem(new Object[] { "Guido Master lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum", 99,
            "Booya Master" }, 6);

    gsl.setCell("table", 16, table);

    Label lblTitleH3 = new Label("A Getting Smaller Title (H3)", Label.CONTENT_TEXT);
    lblTitleH3.setStyleName(BennuTheme.LABEL_H3);
    gsl.setCell("getting_smaller_title", 16, lblTitleH3);

    Panel panelLeft = new Panel();
    panelLeft.setScrollable(true);
    panelLeft.setSizeFull();
    panelLeft.setHeight("145px");
    panelLeft.addComponent(new Label(LOREM_TEXT_ALL));

    Panel panelRight = new Panel();
    panelRight.addComponent(new Label(LOREM_TEXT_LARGE));

    gsl.setCell("panel_left", 8, panelLeft);
    gsl.setCell("panel_right", 8, panelRight);

    Label lblTitleH4 = new Label("A Smaller Title (H4)", Label.CONTENT_TEXT);
    lblTitleH4.setStyleName(BennuTheme.LABEL_H4);
    gsl.setCell("smaller_title", 16, lblTitleH4);

    Label lblTextb4Form = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("txtB4Form", 0, 8, 8, lblTextb4Form);

    Form form = new Form();
    form.setSizeFull();
    form.addField("form_label", new TextField("Form Label"));
    form.addField("large_form_label", new DateField("Large Form Label"));
    form.addField("much_larger_form_label", new Select("Much Larger Form Label"));
    form.addField("something_diff", new TextArea("And now for something completely different"));

    final OptionGroup checkboxes = new OptionGroup("Checkboxes fun");
    checkboxes.setMultiSelect(true);
    checkboxes.addItem("not selected");
    checkboxes.addItem("selected");
    checkboxes.select("selected");
    checkboxes.addItem("disabled");
    checkboxes.setItemEnabled("disabled", false);
    checkboxes.addItem("disabled selected");
    checkboxes.select("disabled selected");
    checkboxes.setItemEnabled("disabled selected", false);

    form.addField("checkboxes", checkboxes);

    final OptionGroup radiobuttons = new OptionGroup("Radio on/off");
    radiobuttons.addItem("option 1(selected)");
    radiobuttons.select("option 1(selected)");
    radiobuttons.addItem("option 2");
    radiobuttons.addItem("option 3 (disabled)");
    radiobuttons.setItemEnabled("option 3 (disabled)", false);

    radiobuttons.addItem("option 4 (disabled and selected)");
    radiobuttons.select("option 4 (disabled and selected)");
    radiobuttons.setItemEnabled("option 4 (disabled and selected)", false);

    form.addField("radiobuttons", radiobuttons);

    form.getFooter().addComponent(new Button("Submit the info"));
    form.getFooter().addComponent(new Button("Cancel the info"));

    final Panel rightFormPanel = new Panel();
    rightFormPanel.setScrollable(true);
    rightFormPanel.setSizeFull();
    rightFormPanel.setHeight("400px");
    rightFormPanel.addComponent(new Label(LOREM_TEXT_ALL, Label.CONTENT_TEXT));

    gsl.setCell("form", 12, form);
    gsl.setCell("rightFormPanel", 4, rightFormPanel);

    return gsl;
}

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);/*  w ww  .j  a  v  a2 s  . c o 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;
}

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

License:Open Source License

Layout getCompoundButtons() {
    Layout grid = getPreviewLayout("Compound Buttons");

    Label title = new Label("Segment");
    title.setStyleName("h1");
    grid.addComponent(title);//from www.  j  av a  2  s . c  om
    ((GridLayout) grid).newLine();

    Label segments = new Label(
            "The segment control is just a set of buttons inside a HorizontalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.",
            Label.CONTENT_XHTML);
    grid.addComponent(segments);
    segments = new Label(
            "HorizontalLayout.setStyleName(\"segment\") and .addStyleName(\"segment-alternate\")\n  +  Button.addStyleName(\"first\") and .addStyleName(\"down\")\n  +  Button\n\t...\n  +  Button.addStyleName(\"last\")",
            Label.CONTENT_PREFORMATTED);
    ((GridLayout) grid).addComponent(segments, 1, 1, 2, 1);

    Segment segment = new Segment();
    segment.setCaption("Segment");
    Button b = new Button("One");
    b.setStyleName("down");
    b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png"));
    segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three"))
            .addButton(new Button("Four"));
    grid.addComponent(segment);

    segment = new Segment();
    segment.addStyleName("segment-alternate");
    segment.setCaption("Segment (alternate)");
    b = new Button("One");
    b.setStyleName("down");
    b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png"));
    segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three"))
            .addButton(new Button("Four"));
    grid.addComponent(segment);

    segment = new Segment();
    segment.setCaption("Small segment");
    b = new Button("Apples");
    b.setStyleName("small");
    b.addStyleName("down");
    segment.addButton(b);
    b = new Button("Oranges");
    b.setStyleName("small");
    segment.addButton(b);
    b = new Button("Bananas");
    b.setStyleName("small");
    segment.addButton(b);
    b = new Button("Grapes");
    b.setStyleName("small");
    segment.addButton(b);
    grid.addComponent(segment);

    return grid;
}

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

License:Open Source License

Layout getCompoundMenus() {
    Layout grid = getPreviewLayout("Compound Menus");

    Label title = new Label("Sidebar Menu");
    title.setStyleName("h1");
    grid.addComponent(title);/*from  w  w w  . j av a 2  s. c  o m*/
    ((GridLayout) grid).newLine();

    Label menus = new Label(
            "<strong>The sidebar menu</strong> control is just a set of labels and buttons inside a CssLayout or a VerticalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.<br><br>You can also use the <a href=\"http://vaadin.com/forum/-/message_boards/message/119172\">DetachedTabs add-on</a> inside the sidebar-menu, it will style automatically.<br><br><strong>Note: only NativeButtons are styled inside the menu, normal buttons are left untouched.</strong>",
            Label.CONTENT_XHTML);
    grid.addComponent(menus);
    menus = new Label(
            "CssLayout.setStyleName(\"sidebar-menu\")\n  +  Label\n  +  NativeButton\n  +  NativeButton\n\t...\n  +  Label\n  +  DetachedTabs\n\t...",
            Label.CONTENT_PREFORMATTED);
    grid.addComponent(menus);

    SidebarMenu sidebar = new SidebarMenu();
    sidebar.setWidth("200px");
    sidebar.addComponent(new Label("Fruits"));
    NativeButton b = new NativeButton("Apples");
    b.setIcon(new ThemeResource("../runo/icons/16/note.png"));
    sidebar.addButton(b);
    sidebar.setSelected(b);
    sidebar.addButton(new NativeButton("Oranges"));
    sidebar.addButton(new NativeButton("Bananas"));
    sidebar.addButton(new NativeButton("Grapes"));
    sidebar.addComponent(new Label("Vegetables"));
    sidebar.addButton(new NativeButton("Tomatoes"));
    sidebar.addButton(new NativeButton("Cabbages"));
    sidebar.addButton(new NativeButton("Potatoes"));
    sidebar.addButton(new NativeButton("Carrots"));
    grid.addComponent(sidebar);
    ((GridLayout) grid).setColumnExpandRatio(0, 1);
    ((GridLayout) grid).setColumnExpandRatio(1, 1);

    title = new Label("Toolbar");
    title.setStyleName("h1");
    grid.addComponent(title);
    ((GridLayout) grid).newLine();

    CssLayout toolbars = new CssLayout();

    menus = new Label(
            "<strong>Toolbar</strong> is a simple CssLayout with a stylename. It provides the background and a little padding for its contents. Normally you will want to put buttons inside it, but segment controls fit in nicely as well.",
            Label.CONTENT_XHTML);
    grid.addComponent(menus);
    menus = new Label("CssLayout.setStyleName(\"toolbar\")", Label.CONTENT_PREFORMATTED);
    grid.addComponent(menus);

    CssLayout toolbar = new CssLayout();
    toolbar.setStyleName("toolbar");
    toolbar.setWidth("300px");

    Button b2 = new Button("Action");
    b2.setStyleName("small");
    toolbar.addComponent(b2);

    Segment segment = new Segment();
    segment.addStyleName("segment-alternate");
    b2 = new Button("Apples");
    b2.setStyleName("small");
    b2.addStyleName("down");
    segment.addButton(b2);
    b2 = new Button("Oranges");
    b2.setStyleName("small");
    segment.addButton(b2);
    toolbar.addComponent(segment);

    b2 = new Button("Notes");
    b2.setStyleName("small borderless");
    b2.setIcon(new ThemeResource("../runo/icons/16/note.png"));
    toolbar.addComponent(b2);
    toolbars.addComponent(toolbar);

    toolbar = new CssLayout();
    toolbar.setStyleName("toolbar");
    toolbar.setWidth("300px");

    b2 = new Button("Action");
    b2.setIcon(new ThemeResource("../runo/icons/32/document.png"));
    b2.setStyleName("borderless");
    toolbar.addComponent(b2);

    b2 = new Button("Action 2");
    b2.setStyleName("borderless");
    b2.setIcon(new ThemeResource("../runo/icons/32/user.png"));
    toolbar.addComponent(b2);

    b2 = new Button("Action 3");
    b2.setStyleName("borderless");
    b2.setIcon(new ThemeResource("../runo/icons/32/note.png"));
    toolbar.addComponent(b2);
    toolbars.addComponent(toolbar);

    grid.addComponent(toolbars);

    return grid;
}

From source file:my.vaadin.profile.MainLayout.java

public MainLayout() {

    Label header = new Label("Student");
    header.addStyleName("colored");
    header.addStyleName("h2");
    //header.addStyleName("alignRight");
    header.setSizeUndefined();// ww w  .  jav  a  2s  .c  om

    Button signOut = new Button("Sign-Out");
    signOut.setSizeUndefined();
    signOut.addStyleName("small");

    Label menu = new Label("Menu");
    menu.addStyleName("colored");
    menu.addStyleName("h2");

    upperSection.setSizeFull();

    innerUpperSection.addComponent(header);
    innerUpperSection.addComponent(signOut);
    innerUpperSection.setExpandRatio(signOut, 1);
    innerUpperSection.setSpacing(true);
    innerUpperSection.setComponentAlignment(signOut, Alignment.MIDDLE_RIGHT);

    upperSection.addComponent(innerUpperSection);
    upperSection.setMargin(new MarginInfo(false, true, false, false));
    upperSection.setComponentAlignment(innerUpperSection, Alignment.TOP_RIGHT);
    upperSection.addStyleName("borderBottom");

    menuTitle.addComponent(menu);
    menuLayout.addComponent(menuTitle);
    menuLayout.setWidth("100%");
    menuLayout.setComponentAlignment(menuTitle, Alignment.MIDDLE_CENTER);
    //menuLayout.addStyleName("whiteStuff");
    //        menuLayout.setExpandRatio(, 1);

    //contentLayout.addComponent();

    lowerSection.addComponent(menuLayout);
    lowerSection.addComponent(contentLayout);

    addComponent(upperSection);
    addComponent(lowerSection);

    upperSection.setHeight(4, UNITS_EM);

    //showBorders();
    setSizeFull();
    lowerSection.setSizeFull();
    //menuLayout.setSizeFull();
    contentLayout.setSizeFull();

    setExpandRatio(lowerSection, 1);

    lowerSection.setSplitPosition(15);

    Button lolol = new Button("hi");
    menuLayout.addComponent(lolol);
    lolol.setWidth("100%");
    lolol.setStyleName("borderless");

}

From source file:my.vaadin.profile.MainLayout.java

public void addMenuOption(String caption, final Component component) {
    Button button = new Button(caption);
    button.setWidth("100%");
    button.setStyleName("borderless");
    menuLayout.addComponent(button);/*from w ww.ja va2s .c o m*/
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            contentLayout.removeAllComponents();
            contentLayout.addComponent(component);
        }
    });
}

From source file:org.abstractform.binding.vaadin.internal.VaadinBindingFormInstanceImpl.java

License:Apache License

@Override
public void refreshValidationSummary() {
    validationSummaryComponent.removeAllComponents();
    for (ValidationError error : validationErrosSummaryList) {
        if (error != null) {
            Component errorComponent = null;
            if (error.getFieldId() != null) {
                errorComponent = getComponentById(error.getFieldId());
            }/*w  ww.  j ava  2s  .co m*/
            if (errorComponent != null) {
                HorizontalLayout layout = new HorizontalLayout();
                if (errorComponent instanceof AbstractField) {
                    final AbstractField component = (AbstractField) errorComponent;
                    Button but = new Button(errorComponent.getCaption());
                    but.setStyleName(BaseTheme.BUTTON_LINK);

                    but.addListener(new Button.ClickListener() {

                        private static final long serialVersionUID = -635674369175495232L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            component.focus();
                            if (component instanceof AbstractField) {
                                AbstractTextField field = (AbstractTextField) component;
                                field.selectAll();
                            }
                        }
                    });
                    layout.addComponent(but);
                } else {
                    layout.addComponent(new Label(errorComponent.getCaption()));
                }
                layout.addComponent(new Label(" : " + error.getMessage()));
                validationSummaryComponent.addComponent(layout);

            } else {
                validationSummaryComponent.addComponent(new Label(error.getMessage()));
            }
        }
    }

}

From source file:org.activiti.kickstart.ui.panel.SelectAdhocWorkflowPanel.java

License:Apache License

protected void initWorkflowTableContents() {
    List<KickstartWorkflowInfo> processDefinitions = adhocWorkflowService.findKickstartWorkflowInformation();
    for (final KickstartWorkflowInfo infoDto : processDefinitions) {
        Item workflowItem = workflowTable.getItem(workflowTable.addItem());
        Button nameButton = new Button(infoDto.getName());
        nameButton.setStyleName("link");
        nameButton.addListener(new Button.ClickListener() {

            private static final long serialVersionUID = 5671158538486627690L;

            public void buttonClick(ClickEvent event) {
                viewManager.showPopupWindow(new ProcessImagePopupWindow(viewManager, infoDto.getId()));
            }//from w w w.j  av a2 s .  co m

        });
        workflowItem.getItemProperty("name").setValue(nameButton);
        workflowItem.getItemProperty("key").setValue(infoDto.getKey());
        workflowItem.getItemProperty("version").setValue(infoDto.getVersion());
        workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime());
        workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances());
        workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances());

        HorizontalLayout actions = new HorizontalLayout();
        actions.setSpacing(true);

        Button editButton = new Button("edit");
        editButton.setStyleName("link");
        //      editButton.setIcon(editImage);
        editButton.setData(infoDto.getId());
        editButton
                .addListener(new EditExistingKickstartWorkflowClickListener(viewManager, adhocWorkflowService));
        actions.addComponent(editButton);

        StreamResource.StreamSource streamSource = new StreamSource() {

            private static final long serialVersionUID = -8875067466181823014L;

            public InputStream getStream() {
                return ServiceLocator.getAdhocWorkflowService().getProcessBpmnXml(infoDto.getId());
            }
        };
        Link bpmnXmlLink = new Link("get xml", new StreamResource(streamSource,
                infoDto.getKey() + ".bpmn20.xml", viewManager.getApplication()));
        //      bpmnXmlLink.setIcon(xmlImage);
        actions.addComponent(bpmnXmlLink);

        workflowItem.getItemProperty("actions").setValue(actions);
    }
    workflowTable.setPageLength(workflowTable.size());
}

From source file:org.activiti.kickstart.ui.panel.SelectWorkflowPanel.java

License:Apache License

protected void initWorkflowTableContents() {
    List<KickstartWorkflowInfo> processDefinitions = kickstartService.findWorkflowInformation(true);
    for (final KickstartWorkflowInfo infoDto : processDefinitions) {
        Item workflowItem = workflowTable.getItem(workflowTable.addItem());
        Button nameButton = new Button(infoDto.getName());
        nameButton.setStyleName("link");
        nameButton.addListener(new Button.ClickListener() {

            private static final long serialVersionUID = 5671158538486627690L;

            public void buttonClick(ClickEvent event) {
                KickstartApplication.get().getViewManager()
                        .showPopupWindow(new ProcessImagePopupWindow(infoDto.getId()));
            }/*from  w  w  w  .j  ava  2  s .c om*/

        });
        workflowItem.getItemProperty("name").setValue(nameButton);
        workflowItem.getItemProperty("key").setValue(infoDto.getKey());
        workflowItem.getItemProperty("version").setValue(infoDto.getVersion());
        workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime());
        workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances());
        workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances());

        HorizontalLayout actions = new HorizontalLayout();
        actions.setSpacing(true);

        Button editButton = new Button("edit");
        editButton.setStyleName("link");
        //      editButton.setIcon(editImage);
        editButton.setData(infoDto.getId());
        editButton.addListener(new EditExistingKickstartWorkflowClickListener(kickstartService));
        actions.addComponent(editButton);

        StreamResource.StreamSource streamSource = new StreamSource() {

            private static final long serialVersionUID = -8875067466181823014L;

            public InputStream getStream() {
                return KickstartApplication.get().getKickstartService().getBpmnXml(infoDto.getId());
            }
        };
        Link bpmnXmlLink = new Link("get xml",
                new StreamResource(streamSource, infoDto.getKey() + ".bpmn20.xml", KickstartApplication.get()));
        //      bpmnXmlLink.setIcon(xmlImage);
        actions.addComponent(bpmnXmlLink);

        workflowItem.getItemProperty("actions").setValue(actions);
    }
    workflowTable.setPageLength(workflowTable.size());
}

From source file:org.adho.dhconvalidator.ui.ConverterPanel.java

/** Setup GUI. */
private void initComponents() {
    setMargin(true);//from   w ww.  j  a  v a 2  s .com
    setSizeFull();
    setSpacing(true);
    HeaderPanel headerPanel = new HeaderPanel(null);
    addComponent(headerPanel);

    Label title = new Label(Messages.getString("ConverterPanel.title"));
    title.addStyleName("title-caption");
    addComponent(title);
    setComponentAlignment(title, Alignment.TOP_LEFT);

    Label info = new Label(Messages.getString("ConverterPanel.info"), ContentMode.HTML);
    addComponent(info);

    HorizontalLayout inputPanel = new HorizontalLayout();
    inputPanel.setSpacing(true);
    addComponent(inputPanel);

    upload = new Upload(Messages.getString("ConverterPanel.uploadCaption"), new Receiver() {
        @Override
        public OutputStream receiveUpload(String filename, String mimeType) {
            // we store the uploaded content in the panel instance

            ConverterPanel.this.filename = filename;
            ConverterPanel.this.uploadContent = new ByteArrayOutputStream();

            return ConverterPanel.this.uploadContent;
        }
    });

    inputPanel.addComponent(upload);

    progressBar = new ProgressBar();
    progressBar.setIndeterminate(true);
    progressBar.setVisible(false);
    inputPanel.addComponent(progressBar);
    inputPanel.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    progressBar.addStyleName("converterpanel-progressbar");

    resultCaption = new Label(Messages.getString("ConverterPanel.previewTitle2"));
    resultCaption.setWidth("100%");
    resultCaption.addStyleName("converterpanel-resultcaption");
    addComponent(resultCaption);
    setComponentAlignment(resultCaption, Alignment.MIDDLE_CENTER);

    resultPanel = new HorizontalSplitPanel();
    addComponent(resultPanel);
    resultPanel.setSizeFull();
    setExpandRatio(resultPanel, 1.0f);

    preview = new Label("", ContentMode.HTML);
    preview.addStyleName("tei-preview");
    resultPanel.addComponent(preview);
    VerticalLayout rightPanel = new VerticalLayout();
    rightPanel.setMargin(new MarginInfo(false, false, true, true));
    rightPanel.setSpacing(true);
    resultPanel.addComponent(rightPanel);

    logArea = new Label("", ContentMode.HTML);
    logArea.setSizeFull();
    logArea.setReadOnly(true);
    rightPanel.addComponent(logArea);

    downloadInfo = new Label(Messages.getString("ConverterPanel.downloadMsg"));
    rightPanel.addComponent(downloadInfo);
    downloadInfo.setVisible(false);

    btDownloadResult = new Button(Messages.getString("ConverterPanel.downloadBtCaption"));
    btDownloadResult.setVisible(false);
    rightPanel.addComponent(btDownloadResult);
    rightPanel.setComponentAlignment(btDownloadResult, Alignment.BOTTOM_CENTER);
    btDownloadResult.setHeight("50px");

    rightPanel.addComponent(new Label(Messages.getString("ConverterPanel.exampleMsg")));
    Button btExample = new Button(Messages.getString("ConverterPanel.exampleButtonCaption"));
    btExample.setStyleName(BaseTheme.BUTTON_LINK);
    btExample.addStyleName("plain-link");
    rightPanel.addComponent(btExample);

    confToolLabel = new Label(
            Messages.getString("ConverterPanel.gotoConfToolMsg", PropertyKey.conftool_login_url.getValue()),
            ContentMode.HTML);
    confToolLabel.setVisible(false);
    confToolLabel.addStyleName("postDownloadInfoRedAndBold");

    rightPanel.addComponent(confToolLabel);

    new BrowserWindowOpener(DHConvalidatorExample.class).extend(btExample);
}