Example usage for com.vaadin.ui Button setData

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

Introduction

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

Prototype

public void setData(Object data) 

Source Link

Document

Sets the data object, that can be used for any application specific data.

Usage

From source file:de.steinwedel.messagebox.MessageBox.java

License:Apache License

/**
 * Adds a button.//from www.  j  a v  a2s.c  o m
 *
 * @param buttonType A {@link ButtonType}
 * @param runOnClick The Runnable, that is executed on clicking the button
 * @param options    Some optional {@link ButtonOption}s
 * @return The {@link MessageBox} instance
 */
public MessageBox withButton(ButtonType buttonType, Runnable runOnClick, ButtonOption... options) {
    Button button = new Button(BUTTON_DEFAULT_CAPTION_FACTORY.translate(buttonType, DIALOG_DEFAULT_LOCALE));
    buttons.put(buttonType, button);
    button.setData(runOnClick);
    if (buttonType != null) {
        button.addStyleName(buttonType.name().toLowerCase() + "Icon");
    }
    button.addStyleName("messageBoxIcon");
    if (BUTTON_DEFAULT_ICONS_VISIBLE) {
        button.setIcon(BUTTON_DEFAULT_ICON_FACTORY.getIcon(buttonType));
    }
    return withButton(button, options);
}

From source file:de.symeda.sormas.ui.caze.CaseContactsView.java

License:Open Source License

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth("100%");
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);

    statusButtons = new HashMap<>();

    Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> {
        criteria.contactStatus(null);/* w  w  w. j av  a  2s .c  o m*/
        navigateTo(criteria);
    });
    CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;

    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = new Button(status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        });
        statusButton.setData(status);
        CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
                CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }
    statusFilterLayout
            .setExpandRatio(statusFilterLayout.getComponent(statusFilterLayout.getComponentCount() - 1), 1);

    // Bulk operation dropdown
    if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
        statusFilterLayout.setWidth(100, Unit.PERCENTAGE);

        MenuBar bulkOperationsDropdown = new MenuBar();
        MenuItem bulkOperationsItem = bulkOperationsDropdown
                .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

        Command changeCommand = selectedItem -> {
            ControllerProvider.getContactController().showBulkContactDataEditComponent(
                    grid.asMultiSelect().getSelectedItems(), getCaseRef().getUuid());
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H,
                changeCommand);

        Command cancelFollowUpCommand = selectedItem -> {
            ControllerProvider.getContactController()
                    .cancelFollowUpOfAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE,
                cancelFollowUpCommand);

        Command lostToFollowUpCommand = selectedItem -> {
            ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(
                    grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK,
                lostToFollowUpCommand);

        Command deleteCommand = selectedItem -> {
            ControllerProvider.getContactController()
                    .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                deleteCommand);

        statusFilterLayout.addComponent(bulkOperationsDropdown);
        statusFilterLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
        statusFilterLayout.setExpandRatio(bulkOperationsDropdown, 1);
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {
        Button exportButton = new Button(I18nProperties.getCaption(Captions.export));
        exportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        exportButton.setIcon(VaadinIcons.DOWNLOAD);

        StreamResource streamResource = new GridExportStreamResource(grid, "sormas_contacts",
                "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        FileDownloader fileDownloader = new FileDownloader(streamResource);
        fileDownloader.extend(exportButton);

        statusFilterLayout.addComponent(exportButton);
        statusFilterLayout.setComponentAlignment(exportButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(exportButton, 1);
        }
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CREATE)) {
        newButton = new Button(
                I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, Captions.contactNewContact));
        newButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        newButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        newButton.addClickListener(e -> ControllerProvider.getContactController().create(this.getCaseRef()));
        statusFilterLayout.addComponent(newButton);
        statusFilterLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
    }

    statusFilterLayout.addStyleName("top-bar");
    activeStatusButton = statusAll;
    return statusFilterLayout;
}

From source file:de.symeda.sormas.ui.caze.CasesView.java

License:Open Source License

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setMargin(false);
    statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);

    statusButtons = new HashMap<>();

    Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> {
        criteria.investigationStatus(null);
        navigateTo(criteria);/*from  www .  j  a  v  a2  s  .  c  o m*/
    });
    CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;

    for (InvestigationStatus status : InvestigationStatus.values()) {
        Button statusButton = new Button(status.toString(), e -> {
            criteria.investigationStatus(status);
            navigateTo(criteria);
        });
        statusButton.setData(status);
        CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
                CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }

    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show archived/active cases button
        if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW_ARCHIVED)) {
            switchArchivedActiveButton = new Button(I18nProperties.getCaption(Captions.caseShowArchived));
            switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK);
            switchArchivedActiveButton.addClickListener(e -> {
                criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE);
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(switchArchivedActiveButton);
        }

        // Bulk operation dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            MenuBar bulkOperationsDropdown = new MenuBar();
            MenuItem bulkOperationsItem = bulkOperationsDropdown
                    .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

            Command changeCommand = selectedItem -> {
                ControllerProvider.getCaseController()
                        .showBulkCaseDataEditComponent(grid.asMultiSelect().getSelectedItems());
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H,
                    changeCommand);

            Command deleteCommand = selectedItem -> {
                ControllerProvider.getCaseController()
                        .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                    deleteCommand);

            Command archiveCommand = selectedItem -> {
                ControllerProvider.getCaseController()
                        .archiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            archiveItem = bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.actionArchive),
                    VaadinIcons.ARCHIVE, archiveCommand);

            Command dearchiveCommand = selectedItem -> {
                ControllerProvider.getCaseController()
                        .dearchiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            dearchiveItem = bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.actionDearchive),
                    VaadinIcons.ARCHIVE, dearchiveCommand);
            dearchiveItem.setVisible(false);

            actionButtonsLayout.addComponent(bulkOperationsDropdown);
        }
    }
    statusFilterLayout.addComponent(actionButtonsLayout);
    statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
    statusFilterLayout.setExpandRatio(actionButtonsLayout, 1);

    return statusFilterLayout;
}

From source file:de.symeda.sormas.ui.contact.ContactsView.java

License:Open Source License

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setMargin(false);
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);

    statusButtons = new HashMap<>();

    Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> {
        criteria.contactStatus(null);/*www. j a v a  2 s  . co m*/
        navigateTo(criteria);
    });
    CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;

    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = new Button(status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        });
        statusButton.setData(status);
        CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
                CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }

    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show archived/active cases button
        if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW_ARCHIVED)) {
            switchArchivedActiveButton = new Button(I18nProperties.getCaption(Captions.contactShowArchived));
            switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK);
            switchArchivedActiveButton.addClickListener(e -> {
                criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE);
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(switchArchivedActiveButton);
        }

        // Bulk operation dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setWidth(100, Unit.PERCENTAGE);

            MenuBar bulkOperationsDropdown = new MenuBar();
            MenuItem bulkOperationsItem = bulkOperationsDropdown
                    .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

            Command changeCommand = selectedItem -> {
                ControllerProvider.getContactController()
                        .showBulkContactDataEditComponent(grid.asMultiSelect().getSelectedItems(), null);
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H,
                    changeCommand);

            Command cancelFollowUpCommand = selectedItem -> {
                ControllerProvider.getContactController().cancelFollowUpOfAllSelectedItems(
                        grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp),
                    VaadinIcons.CLOSE, cancelFollowUpCommand);

            Command lostToFollowUpCommand = selectedItem -> {
                ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(
                        grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp),
                    VaadinIcons.UNLINK, lostToFollowUpCommand);

            Command deleteCommand = selectedItem -> {
                ControllerProvider.getContactController()
                        .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                    deleteCommand);

            actionButtonsLayout.addComponent(bulkOperationsDropdown);
        }
    }
    statusFilterLayout.addComponent(actionButtonsLayout);
    statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
    statusFilterLayout.setExpandRatio(actionButtonsLayout, 1);

    return statusFilterLayout;
}

From source file:de.symeda.sormas.ui.events.EventsView.java

License:Open Source License

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setMargin(false);
    statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);

    statusButtons = new HashMap<>();

    Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> {
        criteria.eventStatus(null);/*from   w w  w. j a  v  a 2  s .co  m*/
        navigateTo(criteria);
    });
    CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;

    for (EventStatus status : EventStatus.values()) {
        Button statusButton = new Button(status.toString(), e -> {
            criteria.eventStatus(status);
            navigateTo(criteria);
        });
        statusButton.setData(status);
        CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
                CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }

    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show archived/active cases button
        if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW_ARCHIVED)) {
            switchArchivedActiveButton = new Button(I18nProperties.getCaption(Captions.eventShowArchived));
            switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK);
            switchArchivedActiveButton.addClickListener(e -> {
                criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE);
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(switchArchivedActiveButton);
        }

        // Bulk operation dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            MenuBar bulkOperationsDropdown = new MenuBar();
            MenuItem bulkOperationsItem = bulkOperationsDropdown
                    .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

            Command changeCommand = selectedItem -> {
                ControllerProvider.getEventController()
                        .showBulkEventDataEditComponent(grid.asMultiSelect().getSelectedItems());
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H,
                    changeCommand);

            Command deleteCommand = selectedItem -> {
                ControllerProvider.getEventController()
                        .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                    deleteCommand);

            Command archiveCommand = selectedItem -> {
                ControllerProvider.getEventController()
                        .archiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            archiveItem = bulkOperationsItem.addItem(
                    I18nProperties.getCaption(I18nProperties.getCaption(Captions.actionArchive)),
                    VaadinIcons.ARCHIVE, archiveCommand);

            Command dearchiveCommand = selectedItem -> {
                ControllerProvider.getEventController()
                        .dearchiveAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                            public void run() {
                                grid.reload();
                            }
                        });
            };
            dearchiveItem = bulkOperationsItem.addItem(
                    I18nProperties.getCaption(I18nProperties.getCaption(Captions.actionDearchive)),
                    VaadinIcons.ARCHIVE, dearchiveCommand);
            dearchiveItem.setVisible(false);

            actionButtonsLayout.addComponent(bulkOperationsDropdown);
        }
    }
    statusFilterLayout.addComponent(actionButtonsLayout);
    statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
    statusFilterLayout.setExpandRatio(actionButtonsLayout, 1);

    return statusFilterLayout;
}

From source file:de.symeda.sormas.ui.samples.SampleGridComponent.java

License:Open Source License

private void initializeStatusButton(Button button, HorizontalLayout filterLayout, String status,
        String caption) {/*  www .  jav  a  2  s  .  co  m*/
    button.setData(status);
    CssStyles.style(button, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT);
    button.setCaptionAsHtml(true);
    filterLayout.addComponent(button);
    statusButtons.put(button, caption);
}

From source file:fr.amapj.view.views.producteur.livraison.ProducteurLivraisonsView.java

License:Open Source License

@Override
public void onPopupClose() {
    Long idProducteur = producteurSelector.getProducteurId();

    if (idProducteur == null) {
        central.removeAllComponents();// w  w w. j  a  va2 s  . c o m
        return;
    }

    //
    MesLivraisonsDTO res = new MesLivraisonsService().getLivraisonProducteur(gapViewer.getDateDebut(),
            gapViewer.getDateFin(), idProducteur);
    central.removeAllComponents();

    // Pour chaque jour, ajout des produits  livrer
    for (JourLivraisonsDTO jour : res.jours) {
        VerticalLayout vl = BaseUiTools.addPanel(central, PANEL_UNJOUR);

        String dateMessage = df1.format(jour.date);
        BaseUiTools.addStdLabel(vl, dateMessage, LABEL_DATEJOURLIV);

        for (ProducteurLivraisonsDTO producteurLiv : jour.producteurs) {
            BaseUiTools.addBandeau(vl, producteurLiv.modeleContrat, "nomcontrat");

            String msg = "<b>Quantits totales  livrer :</b><ul>";
            for (QteProdDTO cell : producteurLiv.produits) {
                msg += "<li>" + cell.qte + " " + cell.nomProduit + " , " + cell.conditionnementProduit
                        + "</li>";
            }
            msg += "</ul>";
            BaseUiTools.addHtmlLabel(vl, msg, LABEL_QTEPRODUIT);

            Button b = new Button("Voir le dtail par amapien");
            b.setIcon(FontAwesome.CHEVRON_DOWN);
            vl.addComponent(b);

            Label detail = BaseUiTools.addHtmlLabel(vl, "", LABEL_QTEPRODUIT);

            b.addStyleName("icon-align-right");
            b.addStyleName("large");
            b.addClickListener(e -> buttonClick(detail, b, producteurLiv.idModeleContratDate));
            b.setData(new Boolean(false));

            //
            Link extractFile = LinkCreator.createLink(new EGFeuilleDistributionProducteur(
                    producteurLiv.idModeleContrat, producteurLiv.idModeleContratDate));
            vl.addComponent(extractFile);

        }
    }
}

From source file:fr.amapj.view.views.producteur.livraison.ProducteurLivraisonsView.java

License:Open Source License

public void buttonClick(Label detail, Button b, Long idModeleContratDate) {
    boolean status = (Boolean) b.getData();
    status = !status;/*from   w ww  .ja  va  2  s.  c o  m*/
    b.setData(status);

    if (status) {
        //
        b.setCaption("Masquer le dtail par amapien");
        b.setIcon(FontAwesome.CHEVRON_UP);
        //
        String content = new GestionContratService().getDetailContrat(idModeleContratDate);
        detail.setValue("<br/>" + content);
    } else {
        //
        b.setCaption("Voir le dtail par amapien");
        b.setIcon(FontAwesome.CHEVRON_DOWN);
        //
        detail.setValue("");
    }
}

From source file:gov.va.ehtac.appsonfhir.ui.HCSLogs.java

private Button getButtonWithIcon(String val) {
    Button rButton = new Button();
    rButton.setStyleName(Runo.LABEL_SMALL);
    Label lbl = new Label();
    rButton.setData(val);
    if (val.contains("Condition")) {
        rButton.setCaption("Condition Bundle");
    } else if (val.contains("Observation")) {
        rButton.setCaption("Observation Bundle");
    } else if (val.contains("MedicationPrescription")) {
        rButton.setCaption("Medication Prescription Bundle");
    } else if (val.contains("Allergy")) {
        rButton.setCaption("Allergy Intolerence Bundle");
    } else if (val.contains("Immunization")) {
        rButton.setCaption("Immunization Bundle");
    } else if (val.contains("Encounter")) {
        rButton.setCaption("Encounter Bundle");
    } else {/*from  w  w w.  j  av a 2  s. c o  m*/
        rButton.setCaption("Unknown Resource Bundle");
    }
    rButton.setIcon(new ThemeResource("../runo/icons/16/document-web.png"));
    rButton.setData(val);

    //        rButton.addListener(new MouseEvents.ClickListener() {
    //
    //            @Override
    //            public void click(MouseEvents.ClickEvent event) {
    //                String data = (String)event.getButton().getData();
    //                String title = (String)event.getButton().getCaption();
    //                Popover p = getPopoverTextArea(data, title);
    //                p.showRelativeTo(getNavigationBar());
    //            }
    //        });

    return rButton;
}

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

License:Open Source License

Button getLoadBalancerButton(LoadBalancerDto lbDto) {
    Button btn = new Button();
    btn.setCaption(lbDto.getLoadBalancer().getLoadBalancerName());
    btn.setIcon(Icons.LOADBALANCER_TAB.resource());
    btn.setData(lbDto);
    btn.addStyleName("borderless");
    btn.addStyleName("loadbalancer-button");
    btn.addListener(new Button.ClickListener() {
        @Override// ww  w.j av  a2  s. com
        public void buttonClick(ClickEvent event) {
            loadBalancerButtonClick(event);
        }
    });
    return btn;
}