Example usage for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS.

Prototype

String BUTTON_BORDERLESS

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS.

Click Source Link

Document

Borderless button.

Usage

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

License:Open Source License

private void addShowMoreOrLessFiltersButtons(HorizontalLayout parentLayout) {
    expandFiltersButton = new Button(I18nProperties.getCaption(Captions.actionShowMoreFilters),
            VaadinIcons.CHEVRON_DOWN);// w w w  . j a  va  2 s . c om
    CssStyles.style(expandFiltersButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE,
            CssStyles.LABEL_PRIMARY);
    collapseFiltersButton = new Button(I18nProperties.getCaption(Captions.actionShowLessFilters),
            VaadinIcons.CHEVRON_UP);
    CssStyles.style(collapseFiltersButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE,
            CssStyles.LABEL_PRIMARY);

    expandFiltersButton.addClickListener(e -> {
        setFiltersExpanded(true);
    });

    collapseFiltersButton.addClickListener(e -> {
        setFiltersExpanded(false);
    });

    parentLayout.addComponent(expandFiltersButton);
    parentLayout.addComponent(collapseFiltersButton);
    parentLayout.setComponentAlignment(expandFiltersButton, Alignment.TOP_LEFT);
    parentLayout.setComponentAlignment(collapseFiltersButton, Alignment.TOP_LEFT);
    collapseFiltersButton.setVisible(false);
}

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);/*w  ww  .  ja v  a2  s  . 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());
    }

    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.dashboard.DashboardFilterLayout.java

License:Open Source License

private void initializeDateFilterButton(Button button) {
    if (button != customButton) {
        button.addClickListener(e -> {
            changeDateFilterButtonsStyles(button);
        });/*from  w  w  w. j  a  v  a 2 s  . c o m*/
    }
    CssStyles.style(button, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT);//, CssStyles.FORCE_CAPTION);
    dateFilterButtons.add(button);
}

From source file:de.symeda.sormas.ui.dashboard.statistics.AbstractDashboardStatisticsComponent.java

License:Open Source License

private void addShowMoreAndLessButtons() {
    showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases),
            VaadinIcons.CHEVRON_DOWN);/* w ww.  j a  v  a2  s .  c  o m*/
    CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_3);
    showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases),
            VaadinIcons.CHEVRON_UP);
    CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_3);

    showMoreButton.addClickListener(e -> {
        showMoreButton.setVisible(false);
        showLessButton.setVisible(true);
        updateStatistics(currentDisease);
    });

    showLessButton.addClickListener(e -> {
        showLessButton.setVisible(false);
        showMoreButton.setVisible(true);
        updateStatistics(currentDisease);
    });

    addComponent(showMoreButton);
    addComponent(showLessButton);
    setComponentAlignment(showMoreButton, Alignment.MIDDLE_CENTER);
    setComponentAlignment(showLessButton, Alignment.MIDDLE_CENTER);
    showLessButton.setVisible(false);
}

From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceOverviewLayout.java

License:Open Source License

private void addShowMoreAndLessButtons() {

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setHeightUndefined();//from   ww  w .  j  av a2s. c o m
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setMargin(new MarginInfo(false, true));

    showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases),
            VaadinIcons.CHEVRON_DOWN);
    CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4);
    showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases),
            VaadinIcons.CHEVRON_UP);
    CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4);
    hideOverview = new CheckBox(I18nProperties.getCaption(Captions.dashboardHideOverview));
    CssStyles.style(hideOverview, CssStyles.VSPACE_3);

    showMoreButton.addClickListener(e -> {
        isShowingAllDiseases = true;
        refresh();

        showMoreButton.setVisible(false);
        showLessButton.setVisible(true);
    });

    showLessButton.addClickListener(e -> {
        isShowingAllDiseases = false;
        refresh();

        showLessButton.setVisible(false);
        showMoreButton.setVisible(true);
    });

    hideOverview.addValueChangeListener(e -> {
        if (hideOverview.getValue()) {
            diseaseBurdenView.setVisible(false);
            diseaseDifferenceComponent.setVisible(false);
            showLessButton.setVisible(false);
            showMoreButton.setVisible(false);
        } else {
            diseaseBurdenView.setVisible(true);
            diseaseDifferenceComponent.setVisible(true);
            showLessButton.setVisible(isShowingAllDiseases);
            showMoreButton.setVisible(!isShowingAllDiseases);
        }
    });

    buttonsLayout.addComponent(showMoreButton);
    buttonsLayout.addComponent(showLessButton);
    buttonsLayout.setComponentAlignment(showMoreButton, Alignment.BOTTOM_CENTER);
    buttonsLayout.setExpandRatio(showMoreButton, 1);
    buttonsLayout.setComponentAlignment(showLessButton, Alignment.BOTTOM_CENTER);
    buttonsLayout.setExpandRatio(showLessButton, 1);
    buttonsLayout.addComponent(hideOverview);
    buttonsLayout.setComponentAlignment(hideOverview, Alignment.BOTTOM_RIGHT);
    buttonsLayout.setExpandRatio(hideOverview, 0);

    addComponent(buttonsLayout, EXTEND_BUTTONS_LOC);

    isShowingAllDiseases = false;
    showLessButton.setVisible(false);
    buttonsLayout.setExpandRatio(showLessButton, 1);
}

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   ww w.j  a v  a2  s  . c  om
        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

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

    statusButtons = new HashMap<>();

    HorizontalLayout buttonFilterLayout = new HorizontalLayout();
    buttonFilterLayout.setSpacing(true);
    {/*w  w w  .j  a v  a  2s.com*/
        Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> processStatusChange(null));
        CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
        statusAll.setCaptionAsHtml(true);
        buttonFilterLayout.addComponent(statusAll);
        statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
        activeStatusButton = statusAll;

        Button notShippedButton = new Button(I18nProperties.getCaption(Captions.sampleNotShipped),
                e -> processStatusChange(NOT_SHIPPED));
        initializeStatusButton(notShippedButton, buttonFilterLayout, NOT_SHIPPED,
                I18nProperties.getCaption(Captions.sampleNotShipped));
        Button shippedButton = new Button(I18nProperties.getCaption(Captions.sampleShipped),
                e -> processStatusChange(SHIPPED));
        initializeStatusButton(shippedButton, buttonFilterLayout, SHIPPED,
                I18nProperties.getCaption(Captions.sampleShipped));
        Button receivedButton = new Button(I18nProperties.getCaption(Captions.sampleReceived),
                e -> processStatusChange(RECEIVED));
        initializeStatusButton(receivedButton, buttonFilterLayout, RECEIVED,
                I18nProperties.getCaption(Captions.sampleReceived));
        Button referredButton = new Button(I18nProperties.getCaption(Captions.sampleReferred),
                e -> processStatusChange(REFERRED));
        initializeStatusButton(referredButton, buttonFilterLayout, REFERRED,
                I18nProperties.getCaption(Captions.sampleReferred));
    }

    shipmentFilterLayout.addComponent(buttonFilterLayout);

    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.sampleShowArchived));
            switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK);
            switchArchivedActiveButton.addClickListener(e -> {
                criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE);
                samplesView.navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(switchArchivedActiveButton);
        }

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

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

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

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

    return shipmentFilterLayout;
}

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) {/*ww  w . j a  v  a  2s.c  om*/
    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:de.symeda.sormas.ui.task.TaskGridComponent.java

License:Open Source License

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

    statusButtons = new HashMap<>();

    HorizontalLayout buttonFilterLayout = new HorizontalLayout();
    buttonFilterLayout.setSpacing(true);
    {/*from   ww w  .  ja  v  a2  s. com*/
        Button allTasks = new Button(I18nProperties.getCaption(Captions.all),
                e -> processAssigneeFilterChange(null));
        CssStyles.style(allTasks, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
        allTasks.setCaptionAsHtml(true);
        buttonFilterLayout.addComponent(allTasks);
        statusButtons.put(allTasks, I18nProperties.getCaption(Captions.all));

        Button officerTasks = new Button(I18nProperties.getCaption(Captions.taskOfficerTasks),
                e -> processAssigneeFilterChange(OFFICER_TASKS));
        initializeStatusButton(officerTasks, buttonFilterLayout, OFFICER_TASKS,
                I18nProperties.getCaption(Captions.taskOfficerTasks));
        Button myTasks = new Button(I18nProperties.getCaption(Captions.taskMyTasks),
                e -> processAssigneeFilterChange(MY_TASKS));
        initializeStatusButton(myTasks, buttonFilterLayout, MY_TASKS,
                I18nProperties.getCaption(Captions.taskMyTasks));

        // Default filter for lab users (that don't have any other role) is "My tasks"
        if ((UserProvider.getCurrent().hasUserRole(UserRole.LAB_USER)
                || UserProvider.getCurrent().hasUserRole(UserRole.EXTERNAL_LAB_USER))
                && UserProvider.getCurrent().getUserRoles().size() == 1) {
            activeStatusButton = myTasks;
        } else {
            activeStatusButton = allTasks;
        }
    }
    assigneeFilterLayout.addComponent(buttonFilterLayout);

    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show archived/active cases button
        if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_VIEW_ARCHIVED)) {
            switchArchivedActiveButton = new Button(
                    I18nProperties.getCaption(I18nProperties.getCaption(Captions.taskShowArchived)));
            switchArchivedActiveButton.setStyleName(ValoTheme.BUTTON_LINK);
            switchArchivedActiveButton.addClickListener(e -> {
                criteria.archived(Boolean.TRUE.equals(criteria.getArchived()) ? null : Boolean.TRUE);
                tasksView.navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(switchArchivedActiveButton);
        }
        // Bulk operation dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            assigneeFilterLayout.setWidth(100, Unit.PERCENTAGE);

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

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

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

    return assigneeFilterLayout;
}

From source file:de.symeda.sormas.ui.utils.PaginationList.java

License:Open Source License

private void initializePaginationLayout() {
    firstPageButton = new Button("|<");
    CssStyles.style(firstPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    firstPageButton.addClickListener(e -> {
        showPage(1);/*from ww w  .  j ava 2 s .  c  om*/
    });
    paginationLayout.addComponent(firstPageButton);

    previousGapLabel = new Label("...");
    CssStyles.style(previousGapLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_PRIMARY);
    paginationLayout.addComponent(previousGapLabel);

    previousPreviousPageButton = new Button();
    CssStyles.style(previousPreviousPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    previousPreviousPageButton.addClickListener(e -> {
        showPage(currentPage - 2);
    });
    paginationLayout.addComponent(previousPreviousPageButton);

    previousPageButton = new Button();
    CssStyles.style(previousPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    previousPageButton.addClickListener(e -> {
        showPage(currentPage - 1);
    });
    paginationLayout.addComponent(previousPageButton);

    currentPageButton = new Button();
    CssStyles.style(currentPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_DARK, CssStyles.BUTTON_FILTER_SMALL);
    paginationLayout.addComponent(currentPageButton);

    nextPageButton = new Button();
    CssStyles.style(nextPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    nextPageButton.addClickListener(e -> {
        showPage(currentPage + 1);
    });
    paginationLayout.addComponent(nextPageButton);

    nextNextPageButton = new Button();
    CssStyles.style(nextNextPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    nextNextPageButton.addClickListener(e -> {
        showPage(currentPage + 2);
    });
    paginationLayout.addComponent(nextNextPageButton);

    nextGapLabel = new Label("...");
    CssStyles.style(nextGapLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_PRIMARY);
    paginationLayout.addComponent(nextGapLabel);

    lastPageButton = new Button(">|");
    CssStyles.style(lastPageButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
            CssStyles.BUTTON_FILTER_LIGHT, CssStyles.BUTTON_FILTER_SMALL);
    lastPageButton.addClickListener(e -> {
        showPage(calculateLastPageNumber());
    });
    paginationLayout.addComponent(lastPageButton);
}