Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_RIGHT.

Prototype

Alignment MIDDLE_RIGHT

To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.

Click Source Link

Usage

From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java

License:Open Source License

private HorizontalLayout createFooter() {
    HorizontalLayout mapFooterLayout = new HorizontalLayout();
    mapFooterLayout.setWidth(100, Unit.PERCENTAGE);
    mapFooterLayout.setSpacing(true);//ww w.j  a  va 2s.  c o  m
    CssStyles.style(mapFooterLayout, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_3);

    // Map key dropdown button
    legendDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapKey));
    CssStyles.style(legendDropdown, CssStyles.BUTTON_SUBTLE);
    legendDropdown.setContent(createLegend());
    mapFooterLayout.addComponent(legendDropdown);
    mapFooterLayout.setComponentAlignment(legendDropdown, Alignment.MIDDLE_RIGHT);
    mapFooterLayout.setExpandRatio(legendDropdown, 1);

    // Layers dropdown button
    PopupButton layersDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapLayers));
    {
        CssStyles.style(layersDropdown, CssStyles.BUTTON_SUBTLE);

        VerticalLayout layersLayout = new VerticalLayout();
        layersLayout.setMargin(true);
        layersLayout.setSpacing(false);
        layersLayout.setSizeUndefined();
        layersDropdown.setContent(layersLayout);

        // Add check boxes and apply button
        {
            OptionGroup mapCaseDisplayModeSelect = new OptionGroup();
            mapCaseDisplayModeSelect.setWidth(100, Unit.PERCENTAGE);
            mapCaseDisplayModeSelect.addItems((Object[]) MapCaseDisplayMode.values());
            mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode);
            mapCaseDisplayModeSelect.addValueChangeListener(event -> {
                mapCaseDisplayMode = (MapCaseDisplayMode) event.getProperty().getValue();
                refreshMap();
            });

            HorizontalLayout showCasesLayout = new HorizontalLayout();
            {
                showCasesLayout.setMargin(false);
                showCasesLayout.setSpacing(false);
                CheckBox showCasesCheckBox = new CheckBox();
                showCasesCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowCases));
                showCasesCheckBox.setValue(showCases);
                showCasesCheckBox.addValueChangeListener(e -> {
                    showCases = (boolean) e.getProperty().getValue();
                    mapCaseDisplayModeSelect.setEnabled(showCases);
                    mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode);
                    refreshMap();
                });
                showCasesLayout.addComponent(showCasesCheckBox);

                Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML);
                infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseMap));
                CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY,
                        CssStyles.HSPACE_LEFT_3);
                infoLabel.setHeightUndefined();
                showCasesLayout.addComponent(infoLabel);
                showCasesLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER);
            }
            layersLayout.addComponent(showCasesLayout);

            layersLayout.addComponent(mapCaseDisplayModeSelect);
            mapCaseDisplayModeSelect.setEnabled(showCases);

            CheckBox showConfirmedContactsCheckBox = new CheckBox();
            CheckBox showUnconfirmedContactsCheckBox = new CheckBox();

            CheckBox showContactsCheckBox = new CheckBox();
            showContactsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowContacts));
            showContactsCheckBox.setValue(showContacts);
            showContactsCheckBox.addValueChangeListener(e -> {
                showContacts = (boolean) e.getProperty().getValue();
                showConfirmedContactsCheckBox.setEnabled(showContacts);
                showConfirmedContactsCheckBox.setValue(true);
                showUnconfirmedContactsCheckBox.setEnabled(showContacts);
                showUnconfirmedContactsCheckBox.setValue(true);
                refreshMap();
            });
            layersLayout.addComponent(showContactsCheckBox);

            showConfirmedContactsCheckBox
                    .setCaption(I18nProperties.getCaption(Captions.dashboardShowConfirmedContacts));
            showConfirmedContactsCheckBox.setValue(showConfirmedContacts);
            showConfirmedContactsCheckBox.addValueChangeListener(e -> {
                showConfirmedContacts = (boolean) e.getProperty().getValue();
                refreshMap();
            });
            layersLayout.addComponent(showConfirmedContactsCheckBox);

            CssStyles.style(showUnconfirmedContactsCheckBox, CssStyles.VSPACE_3);
            showUnconfirmedContactsCheckBox
                    .setCaption(I18nProperties.getCaption(Captions.dashboardShowUnconfirmedContacts));
            showUnconfirmedContactsCheckBox.setValue(showUnconfirmedContacts);
            showUnconfirmedContactsCheckBox.addValueChangeListener(e -> {
                showUnconfirmedContacts = (boolean) e.getProperty().getValue();
                refreshMap();
            });
            layersLayout.addComponent(showUnconfirmedContactsCheckBox);

            showConfirmedContactsCheckBox.setEnabled(showContacts);
            showUnconfirmedContactsCheckBox.setEnabled(showContacts);

            CheckBox showEventsCheckBox = new CheckBox();
            CssStyles.style(showEventsCheckBox, CssStyles.VSPACE_3);
            showEventsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowEvents));
            showEventsCheckBox.setValue(showEvents);
            showEventsCheckBox.addValueChangeListener(e -> {
                showEvents = (boolean) e.getProperty().getValue();
                refreshMap();
            });
            layersLayout.addComponent(showEventsCheckBox);

            if (UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_USER)
                    || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_CLINICIAN)
                    || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_OBSERVER)) {
                OptionGroup regionMapVisualizationSelect = new OptionGroup();
                regionMapVisualizationSelect.setWidth(100, Unit.PERCENTAGE);
                regionMapVisualizationSelect.addItems((Object[]) CaseMeasure.values());
                regionMapVisualizationSelect.setValue(caseMeasure);
                regionMapVisualizationSelect.addValueChangeListener(event -> {
                    caseMeasure = (CaseMeasure) event.getProperty().getValue();
                    refreshMap();
                });

                HorizontalLayout showRegionsLayout = new HorizontalLayout();
                {
                    showRegionsLayout.setMargin(false);
                    showRegionsLayout.setSpacing(false);
                    CheckBox showRegionsCheckBox = new CheckBox();
                    showRegionsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowRegions));
                    showRegionsCheckBox.setValue(showRegions);
                    showRegionsCheckBox.addValueChangeListener(e -> {
                        showRegions = (boolean) e.getProperty().getValue();
                        regionMapVisualizationSelect.setEnabled(showRegions);
                        regionMapVisualizationSelect.setValue(caseMeasure);
                        refreshMap();
                    });
                    showRegionsLayout.addComponent(showRegionsCheckBox);

                    Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML);
                    infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseIncidence));
                    CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY,
                            CssStyles.HSPACE_LEFT_3);
                    infoLabel.setHeightUndefined();
                    showRegionsLayout.addComponent(infoLabel);
                    showRegionsLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER);
                }
                layersLayout.addComponent(showRegionsLayout);
                layersLayout.addComponent(regionMapVisualizationSelect);
                regionMapVisualizationSelect.setEnabled(showRegions);
            }
        }
    }
    mapFooterLayout.addComponent(layersDropdown);
    mapFooterLayout.setComponentAlignment(layersDropdown, Alignment.MIDDLE_RIGHT);

    return mapFooterLayout;
}

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

License:Open Source License

public DashboardStatisticsComparisonElement(String leftCaption, String rightCaption) {
    this.setMargin(false);
    this.setSpacing(false);

    this.leftCaption = leftCaption;
    this.rightCaption = rightCaption;

    countLabel = new Label();
    CssStyles.style(countLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD, CssStyles.LABEL_REALLY_LARGE);
    addComponent(countLabel);// w ww .  j  a  v  a  2s .c  o m

    captionLabel = new Label();
    CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_UPPERCASE, CssStyles.LABEL_BOLD);
    addComponent(captionLabel);
    setComponentAlignment(captionLabel, Alignment.MIDDLE_RIGHT);
}

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

License:Open Source License

public DashboardStatisticsGraphicalGrowthElement(String caption, String svgFillClass) {
    this.setMargin(false);
    this.setSpacing(false);

    HorizontalLayout captionAndValueLayout = new HorizontalLayout();
    captionAndValueLayout.setMargin(false);
    captionAndValueLayout.setSpacing(false);
    captionAndValueLayout.setWidth(100, Unit.PERCENTAGE);

    Label captionLabel = new Label(caption);
    CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD);
    captionAndValueLayout.addComponent(captionLabel);

    countLabel = new Label();
    CssStyles.style(countLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD, CssStyles.HSPACE_RIGHT_4);
    countLabel.setWidthUndefined();//  w  w w .jav a2s . c o m
    captionAndValueLayout.addComponent(countLabel);
    growthLabel = new Label();
    growthLabel.setHeightUndefined();
    growthLabel.setWidthUndefined();
    growthLabel.setContentMode(ContentMode.HTML);
    CssStyles.style(growthLabel, CssStyles.LABEL_SMALL, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD,
            CssStyles.HSPACE_RIGHT_4);
    captionAndValueLayout.addComponent(growthLabel);
    percentageLabel = new Label();
    CssStyles.style(percentageLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD);
    percentageLabel.setWidthUndefined();
    captionAndValueLayout.addComponent(percentageLabel);

    captionAndValueLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT);
    captionAndValueLayout.setComponentAlignment(countLabel, Alignment.MIDDLE_RIGHT);
    captionAndValueLayout.setComponentAlignment(growthLabel, Alignment.MIDDLE_RIGHT);
    captionAndValueLayout.setComponentAlignment(percentageLabel, Alignment.MIDDLE_RIGHT);
    captionAndValueLayout.setExpandRatio(captionLabel, 1);

    addComponent(captionAndValueLayout);

    svgBarElement = new SvgBarElement(svgFillClass);
    svgBarElement.setWidth(100, Unit.PERCENTAGE);
    addComponent(svgBarElement);
}

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

License:Open Source License

public DashboardStatisticsPercentageElement(String caption, String svgFillClass) {
    this.setMargin(false);
    this.setSpacing(false);

    HorizontalLayout captionAndValueLayout = new HorizontalLayout();
    captionAndValueLayout.setWidth(100, Unit.PERCENTAGE);

    Label captionLabel = new Label(caption);
    captionLabel.setWidthUndefined();/*from   w  w w .  j  a v a  2  s . co m*/
    CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD);
    captionAndValueLayout.addComponent(captionLabel);

    percentageLabel = new Label();
    CssStyles.style(percentageLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD);
    percentageLabel.setWidthUndefined();
    captionAndValueLayout.addComponent(percentageLabel);

    captionAndValueLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT);
    captionAndValueLayout.setComponentAlignment(percentageLabel, Alignment.MIDDLE_RIGHT);

    addComponent(captionAndValueLayout);

    svgBarElement = new SvgBarElement(svgFillClass);
    svgBarElement.setWidth(100, Unit.PERCENTAGE);
    addComponent(svgBarElement);
}

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

License:Open Source License

private Layout createCaseFatalityComponent() {
    HorizontalLayout component = new HorizontalLayout();
    component.setMargin(false);//from   w  w w  . jav  a  2 s  .  com
    component.setSpacing(false);
    component.setWidth(100, Unit.PERCENTAGE);

    // rate
    {
        HorizontalLayout rateLayout = new HorizontalLayout();
        rateLayout.setMargin(false);
        rateLayout.setSpacing(false);

        // value
        caseFatalityRateValue = new Label("00.0%");
        CssStyles.style(caseFatalityRateValue, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD,
                CssStyles.LABEL_LARGE, CssStyles.HSPACE_RIGHT_3, CssStyles.VSPACE_TOP_5);
        rateLayout.addComponent(caseFatalityRateValue);

        // title
        Label titleLabel = new Label(I18nProperties.getCaption(Captions.dashboardCaseFatalityRate));
        CssStyles.style(titleLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_UPPERCASE, CssStyles.VSPACE_TOP_4);
        rateLayout.addComponent(titleLabel);

        component.addComponent(rateLayout);
        component.setExpandRatio(rateLayout, 1);
    }

    // count      
    {
        HorizontalLayout countLayout = new HorizontalLayout();
        countLayout.setMargin(false);
        countLayout.setSpacing(false);

        // title
        Label titleLabel = new Label(I18nProperties.getCaption(Captions.dashboardFatalities));
        CssStyles.style(titleLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_UPPERCASE, CssStyles.VSPACE_TOP_4,
                CssStyles.HSPACE_RIGHT_3);
        countLayout.addComponent(titleLabel);

        // value
        caseFatalityCountValue = new Label("0");
        CssStyles.style(caseFatalityCountValue, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD,
                CssStyles.LABEL_LARGE, CssStyles.HSPACE_RIGHT_5, CssStyles.VSPACE_TOP_5);
        countLayout.addComponent(caseFatalityCountValue);

        // growth
        caseFatalityCountGrowth = new Label("", ContentMode.HTML);
        CssStyles.style(caseFatalityCountGrowth, CssStyles.VSPACE_TOP_5);
        countLayout.addComponent(caseFatalityCountGrowth);

        component.addComponent(countLayout);
        component.setExpandRatio(countLayout, 0);
        component.setComponentAlignment(countLayout, Alignment.MIDDLE_RIGHT);
    }

    return component;
}

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

License:Open Source License

public HorizontalLayout createTopBar() {
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setSpacing(true);//from w w  w.j  a va2 s. c o  m
    topLayout.setWidth("100%");

    Label header = new Label(I18nProperties.getPrefixCaption(EventDto.I18N_PREFIX, EventDto.EVENT_PERSONS));
    header.setSizeUndefined();
    CssStyles.style(header, CssStyles.H2, CssStyles.VSPACE_NONE);
    topLayout.addComponent(header);

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

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

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

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

    if (UserProvider.getCurrent().hasUserRight(UserRight.EVENTPARTICIPANT_CREATE)) {
        addButton = new Button(I18nProperties.getCaption(Captions.eventParticipantAddPerson));
        addButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        addButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        addButton.addClickListener(e -> {
            ControllerProvider.getEventParticipantController().createEventParticipant(this.getEventRef(),
                    r -> grid.reload());
        });
        topLayout.addComponent(addButton);
        topLayout.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
    }

    topLayout.addStyleName(CssStyles.VSPACE_3);
    return topLayout;
}

From source file:de.symeda.sormas.ui.importer.ImportProgressLayout.java

License:Open Source License

public ImportProgressLayout(int totalCount, UI currentUI, Runnable cancelCallback) {
    this.totalCount = totalCount;
    this.currentUI = currentUI;

    setWidth(100, Unit.PERCENTAGE);/*  w  w w.ja  v  a 2  s  .c om*/
    setMargin(true);

    // Info text and icon/progress circle
    infoLayout = new HorizontalLayout();
    infoLayout.setWidth(100, Unit.PERCENTAGE);
    infoLayout.setSpacing(true);
    initializeInfoComponents();
    currentInfoComponent = progressCircle;
    infoLayout.addComponent(currentInfoComponent);
    infoLabel = new Label(String.format(I18nProperties.getString(Strings.infoImportProcess), totalCount));
    infoLabel.setContentMode(ContentMode.HTML);
    infoLayout.addComponent(infoLabel);
    infoLayout.setExpandRatio(infoLabel, 1);

    addComponent(infoLayout);

    // Progress bar
    progressBar = new ProgressBar(0.0f);
    CssStyles.style(progressBar, CssStyles.VSPACE_TOP_3);
    addComponent(progressBar);
    progressBar.setWidth(100, Unit.PERCENTAGE);

    // Progress info
    HorizontalLayout progressInfoLayout = new HorizontalLayout();
    CssStyles.style(progressInfoLayout, CssStyles.VSPACE_TOP_5);
    progressInfoLayout.setSpacing(true);
    processedImportsLabel = new Label(
            String.format(I18nProperties.getCaption(Captions.importProcessed), 0, totalCount));
    progressInfoLayout.addComponent(processedImportsLabel);
    successfulImportsLabel = new Label(String.format(I18nProperties.getCaption(Captions.importImports), 0));
    CssStyles.style(successfulImportsLabel, CssStyles.LABEL_POSITIVE);
    progressInfoLayout.addComponent(successfulImportsLabel);
    importErrorsLabel = new Label(String.format(I18nProperties.getCaption(Captions.importErrors), 0));
    CssStyles.style(importErrorsLabel, CssStyles.LABEL_CRITICAL);
    progressInfoLayout.addComponent(importErrorsLabel);
    importDuplicatesLabel = new Label(String.format(I18nProperties.getCaption(Captions.importDuplicates), 0));
    CssStyles.style(importDuplicatesLabel, CssStyles.LABEL_WARNING);
    progressInfoLayout.addComponent(importDuplicatesLabel);
    importSkipsLabel = new Label(String.format(I18nProperties.getCaption(Captions.importSkips), 0));
    CssStyles.style(importSkipsLabel, CssStyles.LABEL_MINOR);
    progressInfoLayout.addComponent(importSkipsLabel);
    addComponent(progressInfoLayout);
    setComponentAlignment(progressInfoLayout, Alignment.TOP_RIGHT);

    // Cancel button
    closeCancelButton = new Button(I18nProperties.getCaption(Captions.actionCancel));
    CssStyles.style(closeCancelButton, CssStyles.VSPACE_TOP_2);
    cancelListener = e -> {
        cancelCallback.run();
    };
    closeCancelButton.addClickListener(cancelListener);
    addComponent(closeCancelButton);
    setComponentAlignment(closeCancelButton, Alignment.MIDDLE_RIGHT);
}

From source file:de.symeda.sormas.ui.reports.ReportsView.java

License:Open Source License

public HorizontalLayout createFilterBar() {
    HorizontalLayout filterLayout = new HorizontalLayout();
    filterLayout.setMargin(false);/*  w  ww .ja v a  2  s.c  om*/
    filterLayout.setSpacing(true);
    filterLayout.addStyleName(CssStyles.VSPACE_3);
    filterLayout.setWidth(100, Unit.PERCENTAGE);

    EpiWeek prevEpiWeek = DateHelper.getPreviousEpiWeek(new Date());
    int year = prevEpiWeek.getYear();
    int week = prevEpiWeek.getWeek();

    yearFilter = new ComboBox();
    yearFilter.setWidth(200, Unit.PIXELS);
    yearFilter.addItems(DateHelper.getYearsToNow());
    yearFilter.select(year);
    yearFilter.setCaption(I18nProperties.getString(Strings.year));
    yearFilter.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING);
    yearFilter.addValueChangeListener(e -> {
        updateEpiWeeks((int) e.getProperty().getValue(), (int) epiWeekFilter.getValue());
        reloadGrid();
    });
    filterLayout.addComponent(yearFilter);

    epiWeekFilter = new ComboBox();
    epiWeekFilter.setWidth(200, Unit.PIXELS);
    updateEpiWeeks(year, week);
    epiWeekFilter.setCaption(I18nProperties.getString(Strings.epiWeek));
    epiWeekFilter.addValueChangeListener(e -> {
        reloadGrid();
    });
    filterLayout.addComponent(epiWeekFilter);

    Button lastWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardLastWeek));
    lastWeekButton.addStyleName(CssStyles.FORCE_CAPTION);
    lastWeekButton.addClickListener(e -> {
        EpiWeek epiWeek = DateHelper.getPreviousEpiWeek(new Date());
        yearFilter.select(epiWeek.getYear());
        epiWeekFilter.select(epiWeek.getWeek());
    });
    filterLayout.addComponent(lastWeekButton);

    Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML);
    infoLabel.setDescription(I18nProperties.getString(Strings.infoWeeklyReportsView));
    infoLabel.setSizeUndefined();
    CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY);
    filterLayout.addComponent(infoLabel);
    filterLayout.setComponentAlignment(infoLabel, Alignment.MIDDLE_RIGHT);
    filterLayout.setExpandRatio(infoLabel, 1);

    return filterLayout;
}

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

License:Open Source License

public PathogenTestListComponent(SampleReferenceDto sampleRef,
        BiConsumer<PathogenTestResultType, Boolean> testChangedCallback) {
    setWidth(100, Unit.PERCENTAGE);/*from w  ww.j a va2  s  .c  om*/

    HorizontalLayout componentHeader = new HorizontalLayout();
    componentHeader.setWidth(100, Unit.PERCENTAGE);
    addComponent(componentHeader);

    list = new PathogenTestList(sampleRef, testChangedCallback);
    addComponent(list);
    list.reload();

    Label testsHeader = new Label(I18nProperties.getString(Strings.headingTests));
    testsHeader.addStyleName(CssStyles.H3);
    componentHeader.addComponent(testsHeader);

    if (UserProvider.getCurrent().hasUserRight(UserRight.PATHOGEN_TEST_CREATE)) {
        createButton = new Button(I18nProperties.getCaption(Captions.pathogenTestNewTest));
        createButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        createButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        createButton.addClickListener(e -> ControllerProvider.getPathogenTestController().create(sampleRef, 0,
                list::reload, testChangedCallback));
        componentHeader.addComponent(createButton);
        componentHeader.setComponentAlignment(createButton, Alignment.MIDDLE_RIGHT);
    }
}

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

License:Open Source License

public void addEditListener(ClickListener editClickListener) {
    if (editButton == null) {
        editButton = new Button(VaadinIcons.PENCIL);
        CssStyles.style(editButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT);
        addComponent(editButton);//  w  w  w  . j a  v a2  s  .  com
        setComponentAlignment(editButton, Alignment.MIDDLE_RIGHT);
        setExpandRatio(editButton, 0);
    }
    editButton.addClickListener(editClickListener);
}