Search in sources :

Example 46 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.

the class PointsOfEntryView method createFilterBar.

private HorizontalLayout createFilterBar() {
    filterLayout = new HorizontalLayout();
    filterLayout.setMargin(false);
    filterLayout.setSpacing(true);
    filterLayout.setWidth(100, Unit.PERCENTAGE);
    searchField = new SearchField();
    searchField.addTextChangeListener(e -> {
        criteria.nameLike(e.getText());
        grid.reload();
    });
    CssStyles.style(searchField, CssStyles.FORCE_CAPTION);
    filterLayout.addComponent(searchField);
    countryFilter = addCountryFilter(filterLayout, country -> {
        criteria.country(country);
        grid.reload();
    }, regionFilter);
    countryFilter.addValueChangeListener(country -> {
        CountryReferenceDto countryReferenceDto = (CountryReferenceDto) country.getProperty().getValue();
        criteria.country(countryReferenceDto);
        navigateTo(criteria);
        FieldHelper.updateItems(regionFilter, countryReferenceDto != null ? FacadeProvider.getRegionFacade().getAllActiveByCountry(countryReferenceDto.getUuid()) : null);
    });
    regionFilter = ComboBoxHelper.createComboBoxV7();
    regionFilter.setId(PointOfEntryDto.REGION);
    regionFilter.setWidth(140, Unit.PIXELS);
    regionFilter.setCaption(I18nProperties.getPrefixCaption(PointOfEntryDto.I18N_PREFIX, PointOfEntryDto.REGION));
    regionFilter.addItems(FacadeProvider.getRegionFacade().getAllActiveAsReference());
    regionFilter.addValueChangeListener(e -> {
        RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
        criteria.region(region);
        navigateTo(criteria);
        FieldHelper.updateItems(districtFilter, region != null ? FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()) : null);
    });
    filterLayout.addComponent(regionFilter);
    districtFilter = ComboBoxHelper.createComboBoxV7();
    districtFilter.setId(PointOfEntryDto.DISTRICT);
    districtFilter.setWidth(140, Unit.PIXELS);
    districtFilter.setCaption(I18nProperties.getPrefixCaption(PointOfEntryDto.I18N_PREFIX, PointOfEntryDto.DISTRICT));
    districtFilter.addValueChangeListener(e -> {
        criteria.district((DistrictReferenceDto) e.getProperty().getValue());
        navigateTo(criteria);
    });
    filterLayout.addComponent(districtFilter);
    typeFilter = ComboBoxHelper.createComboBoxV7();
    typeFilter.setId(PointOfEntryDto.POINT_OF_ENTRY_TYPE);
    typeFilter.setWidth(140, Unit.PIXELS);
    typeFilter.setCaption(I18nProperties.getPrefixCaption(PointOfEntryDto.I18N_PREFIX, PointOfEntryDto.POINT_OF_ENTRY_TYPE));
    typeFilter.addItems(PointOfEntryType.values());
    typeFilter.addValueChangeListener(e -> {
        criteria.type((PointOfEntryType) e.getProperty().getValue());
        navigateTo(criteria);
    });
    filterLayout.addComponent(typeFilter);
    activeFilter = ComboBoxHelper.createComboBoxV7();
    activeFilter.setId(PointOfEntryDto.ACTIVE);
    activeFilter.setWidth(140, Unit.PIXELS);
    activeFilter.setCaption(I18nProperties.getPrefixCaption(PointOfEntryDto.I18N_PREFIX, PointOfEntryDto.ACTIVE));
    activeFilter.addItem(Boolean.TRUE);
    activeFilter.addItem(Boolean.FALSE);
    activeFilter.setItemCaption(Boolean.TRUE, DataHelper.stringifyBoolean(Boolean.TRUE));
    activeFilter.setItemCaption(Boolean.FALSE, DataHelper.stringifyBoolean(Boolean.FALSE));
    activeFilter.addValueChangeListener(e -> {
        criteria.active((Boolean) e.getProperty().getValue());
        navigateTo(criteria);
    });
    filterLayout.addComponent(activeFilter);
    resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
        ViewModelProviders.of(PointsOfEntryView.class).remove(PointOfEntryCriteria.class);
        navigateTo(null);
    }, CssStyles.FORCE_CAPTION);
    resetButton.setVisible(false);
    filterLayout.addComponent(resetButton);
    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show active/archived/all dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
            relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
            relevanceStatusFilter.setId("relevanceStatus");
            relevanceStatusFilter.setWidth(220, Unit.PERCENTAGE);
            relevanceStatusFilter.setNullSelectionAllowed(false);
            relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.pointOfEntryActivePointsOfEntry));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.pointOfEntryArchivedPointsOfEntry));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.pointOfEntryAllPointsOfEntry));
            relevanceStatusFilter.addValueChangeListener(e -> {
                criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(relevanceStatusFilter);
            // Bulk operation dropdown
            if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
                bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionArchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(true, grid.asMultiSelect().getSelectedItems(), InfrastructureType.POINT_OF_ENTRY, () -> navigateTo(criteria));
                }, EntityRelevanceStatus.ACTIVE.equals(criteria.getRelevanceStatus())), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionDearchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
                    ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(false, grid.asMultiSelect().getSelectedItems(), InfrastructureType.POINT_OF_ENTRY, () -> navigateTo(criteria));
                }, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
                bulkOperationsDropdown.setVisible(viewConfiguration.isInEagerMode() && !EntityRelevanceStatus.ALL.equals(criteria.getRelevanceStatus()));
                actionButtonsLayout.addComponent(bulkOperationsDropdown);
            }
        }
    }
    filterLayout.addComponent(actionButtonsLayout);
    filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
    filterLayout.setExpandRatio(actionButtonsLayout, 1);
    return filterLayout;
}
Also used : RowCount(de.symeda.sormas.ui.utils.RowCount) StreamResource(com.vaadin.server.StreamResource) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) Window(com.vaadin.ui.Window) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) PointOfEntryType(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryType) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) AbstractConfigurationView(de.symeda.sormas.ui.configuration.AbstractConfigurationView) UserProvider(de.symeda.sormas.ui.UserProvider) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ValoTheme(com.vaadin.ui.themes.ValoTheme) PointOfEntryDto(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryDto) DataHelper(de.symeda.sormas.api.utils.DataHelper) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) InfrastructureType(de.symeda.sormas.api.infrastructure.InfrastructureType) FieldHelper(de.symeda.sormas.ui.utils.FieldHelper) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) FileDownloader(com.vaadin.server.FileDownloader) Descriptions(de.symeda.sormas.api.i18n.Descriptions) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout) Strings(de.symeda.sormas.api.i18n.Strings) PointOfEntryCriteria(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryCriteria) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) PointOfEntryCriteria(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryCriteria) SearchField(de.symeda.sormas.ui.configuration.infrastructure.components.SearchField) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Example 47 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.

the class OutbreakRegionConfigurationForm method createHeader.

private HorizontalLayout createHeader() {
    HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidth(100, Unit.PERCENTAGE);
    headerLayout.setSpacing(true);
    style(headerLayout, VSPACE_2);
    // Headline and info text
    Label infoTextLabel = new Label(I18nProperties.getString(Strings.headingDefineOutbreakDistricts));
    infoTextLabel.setWidthUndefined();
    style(infoTextLabel, VSPACE_TOP_4);
    headerLayout.addComponent(infoTextLabel);
    // Number of affected districts and options to toggle outbreak mode for all districts
    HorizontalLayout allDistrictsLayout = new HorizontalLayout();
    allDistrictsLayout.setWidthUndefined();
    allDistrictsLayout.setSpacing(true);
    {
        Label allDistrictsLabel = new Label(I18nProperties.getString(Strings.headingSetOutbreakStatus));
        allDistrictsLabel.setWidthUndefined();
        style(allDistrictsLabel, VSPACE_TOP_4);
        allDistrictsLayout.addComponent(allDistrictsLabel);
        OptionGroup outbreakToggle = new OptionGroup();
        style(outbreakToggle, ValoTheme.OPTIONGROUP_HORIZONTAL, CssStyles.OPTIONGROUP_HORIZONTAL_SWITCH_CRITICAL);
        outbreakToggle.addItem(OUTBREAK);
        outbreakToggle.addItem(NORMAL);
        if (affectedDistricts.isEmpty()) {
            outbreakToggle.setValue(NORMAL);
        } else if (affectedDistricts.size() == totalDistricts) {
            outbreakToggle.setValue(OUTBREAK);
        }
        outbreakToggle.addValueChangeListener(e -> {
            for (OptionGroup districtOutbreakToggle : outbreakToggles) {
                districtOutbreakToggle.setValue(e.getProperty().getValue());
            }
        });
        outbreakToggle.setWidthUndefined();
        allDistrictsLayout.addComponent(outbreakToggle);
        affectedDistrictsNumberLabel = new Label();
        affectedDistrictsNumberLabel.setWidthUndefined();
        allDistrictsLayout.addComponent(affectedDistrictsNumberLabel);
    }
    headerLayout.addComponent(allDistrictsLayout);
    headerLayout.setComponentAlignment(allDistrictsLayout, Alignment.TOP_RIGHT);
    headerLayout.setExpandRatio(infoTextLabel, 1);
    return headerLayout;
}
Also used : ValoTheme(com.vaadin.ui.themes.ValoTheme) CssStyles.style(de.symeda.sormas.ui.utils.CssStyles.style) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) Set(java.util.Set) Captions(de.symeda.sormas.api.i18n.Captions) HashSet(java.util.HashSet) OptionGroup(com.vaadin.v7.ui.OptionGroup) List(java.util.List) CssStyles(de.symeda.sormas.ui.utils.CssStyles) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Label(com.vaadin.ui.Label) VSPACE_TOP_4(de.symeda.sormas.ui.utils.CssStyles.VSPACE_TOP_4) VSPACE_2(de.symeda.sormas.ui.utils.CssStyles.VSPACE_2) VSPACE_3(de.symeda.sormas.ui.utils.CssStyles.VSPACE_3) Strings(de.symeda.sormas.api.i18n.Strings) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) OptionGroup(com.vaadin.v7.ui.OptionGroup) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 48 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.

the class DashboardMapComponent method createFooter.

private HorizontalLayout createFooter() {
    HorizontalLayout mapFooterLayout = new HorizontalLayout();
    mapFooterLayout.setWidth(100, Unit.PERCENTAGE);
    mapFooterLayout.setSpacing(true);
    CssStyles.style(mapFooterLayout, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_3);
    // Map key dropdown button
    legendDropdown = ButtonHelper.createPopupButton(Captions.dashboardMapKey, null, CssStyles.BUTTON_SUBTLE);
    legendDropdown.setContent(createLegend());
    mapFooterLayout.addComponent(legendDropdown);
    mapFooterLayout.setComponentAlignment(legendDropdown, Alignment.MIDDLE_RIGHT);
    mapFooterLayout.setExpandRatio(legendDropdown, 1);
    // Layers dropdown button
    VerticalLayout layersLayout = new VerticalLayout();
    {
        layersLayout.setMargin(true);
        layersLayout.setSpacing(false);
        layersLayout.setSizeUndefined();
        // Add check boxes and apply button
        {
            // case classifications
            OptionGroup caseClassificationOptions = new OptionGroup();
            caseClassificationOptions.addItems((Object[]) MapCaseClassificationOption.values());
            caseClassificationOptions.setValue(caseClassificationOption);
            caseClassificationOptions.addValueChangeListener(event -> {
                caseClassificationOption = (MapCaseClassificationOption) event.getProperty().getValue();
                refreshMap(true);
            });
            // Optiongroup to select what property the coordinates should be based on
            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(true);
            });
            HorizontalLayout showCasesLayout = new HorizontalLayout();
            {
                showCasesLayout.setMargin(false);
                showCasesLayout.setSpacing(false);
                CheckBox showCasesCheckBox = new CheckBox();
                showCasesCheckBox.setId(Captions.dashboardShowCases);
                showCasesCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowCases));
                showCasesCheckBox.setValue(showCases);
                showCasesCheckBox.addValueChangeListener(e -> {
                    showCases = (boolean) e.getProperty().getValue();
                    mapCaseDisplayModeSelect.setEnabled(showCases);
                    mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode);
                    caseClassificationOptions.setEnabled(showCases);
                    refreshMap(true);
                });
                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);
            layersLayout.addComponent(caseClassificationOptions);
            caseClassificationOptions.setEnabled(showCases);
            CheckBox showConfirmedContactsCheckBox = new CheckBox();
            showConfirmedContactsCheckBox.setId(Captions.dashboardShowConfirmedContacts);
            CheckBox showUnconfirmedContactsCheckBox = new CheckBox();
            showUnconfirmedContactsCheckBox.setId(Captions.dashboardShowUnconfirmedContacts);
            CheckBox showContactsCheckBox = new CheckBox();
            showContactsCheckBox.setId(Captions.dashboardShowContacts);
            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(true);
            });
            layersLayout.addComponent(showContactsCheckBox);
            showConfirmedContactsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowConfirmedContacts));
            showConfirmedContactsCheckBox.setValue(showConfirmedContacts);
            showConfirmedContactsCheckBox.addValueChangeListener(e -> {
                showConfirmedContacts = (boolean) e.getProperty().getValue();
                refreshMap(true);
            });
            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(true);
            });
            layersLayout.addComponent(showUnconfirmedContactsCheckBox);
            showConfirmedContactsCheckBox.setEnabled(showContacts);
            showUnconfirmedContactsCheckBox.setEnabled(showContacts);
            CheckBox showEventsCheckBox = new CheckBox();
            showEventsCheckBox.setId(Captions.dashboardShowEvents);
            CssStyles.style(showEventsCheckBox, CssStyles.VSPACE_3);
            showEventsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowEvents));
            showEventsCheckBox.setValue(showEvents);
            showEventsCheckBox.addValueChangeListener(e -> {
                showEvents = (boolean) e.getProperty().getValue();
                refreshMap(true);
            });
            layersLayout.addComponent(showEventsCheckBox);
            if (nonNull(UserProvider.getCurrent()) && UserProvider.getCurrent().hasNationJurisdictionLevel()) {
                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(true);
                });
                HorizontalLayout showRegionsLayout = new HorizontalLayout();
                {
                    showRegionsLayout.setMargin(false);
                    showRegionsLayout.setSpacing(false);
                    CheckBox showRegionsCheckBox = new CheckBox();
                    showRegionsCheckBox.setId(Captions.dashboardShowRegions);
                    showRegionsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowRegions));
                    showRegionsCheckBox.setValue(showRegions);
                    showRegionsCheckBox.addValueChangeListener(e -> {
                        showRegions = (boolean) e.getProperty().getValue();
                        regionMapVisualizationSelect.setEnabled(showRegions);
                        regionMapVisualizationSelect.setValue(caseMeasure);
                        refreshMap(true);
                    });
                    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);
            }
            CheckBox hideOtherCountriesCheckBox = new CheckBox();
            hideOtherCountriesCheckBox.setId(Captions.dashboardHideOtherCountries);
            hideOtherCountriesCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardHideOtherCountries));
            hideOtherCountriesCheckBox.setValue(hideOtherCountries);
            hideOtherCountriesCheckBox.addValueChangeListener(e -> {
                hideOtherCountries = (boolean) e.getProperty().getValue();
                refreshMap(true);
            });
            CssStyles.style(hideOtherCountriesCheckBox, CssStyles.VSPACE_3);
            layersLayout.addComponent(hideOtherCountriesCheckBox);
            CheckBox showCurrentEpiSituationCB = new CheckBox();
            showCurrentEpiSituationCB.setId(Captions.dashboardMapShowEpiSituation);
            showCurrentEpiSituationCB.setCaption(I18nProperties.getCaption(Captions.dashboardMapShowEpiSituation));
            showCurrentEpiSituationCB.setValue(false);
            showCurrentEpiSituationCB.addValueChangeListener(e -> {
                showCurrentEpiSituation = (boolean) e.getProperty().getValue();
                refreshMap(true);
            });
            layersLayout.addComponent(showCurrentEpiSituationCB);
        }
    }
    PopupButton layersDropdown = ButtonHelper.createPopupButton(Captions.dashboardMapLayers, layersLayout, CssStyles.BUTTON_SUBTLE);
    mapFooterLayout.addComponent(layersDropdown);
    mapFooterLayout.setComponentAlignment(layersDropdown, Alignment.MIDDLE_RIGHT);
    return mapFooterLayout;
}
Also used : Date(java.util.Date) CheckBox(com.vaadin.v7.ui.CheckBox) DashboardEventDto(de.symeda.sormas.api.dashboard.DashboardEventDto) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) Window(com.vaadin.ui.Window) LeafletMarker(de.symeda.sormas.ui.map.LeafletMarker) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) GeoShapeProvider(de.symeda.sormas.api.geo.GeoShapeProvider) BigDecimal(java.math.BigDecimal) CssStyles(de.symeda.sormas.ui.utils.CssStyles) GeoLatLon(de.symeda.sormas.api.geo.GeoLatLon) VaadinIcons(com.vaadin.icons.VaadinIcons) LeafletMap(de.symeda.sormas.ui.map.LeafletMap) LeafletMapUtil(de.symeda.sormas.ui.map.LeafletMapUtil) UserProvider(de.symeda.sormas.ui.UserProvider) RoundingMode(java.math.RoundingMode) ValoTheme(com.vaadin.ui.themes.ValoTheme) InfrastructureHelper(de.symeda.sormas.api.infrastructure.InfrastructureHelper) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) DashboardCssStyles(de.symeda.sormas.ui.dashboard.DashboardCssStyles) DashboardType(de.symeda.sormas.ui.dashboard.DashboardType) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) DashboardDataProvider(de.symeda.sormas.ui.dashboard.DashboardDataProvider) List(java.util.List) ExternalResource(com.vaadin.server.ExternalResource) AbstractComponent(com.vaadin.ui.AbstractComponent) DistrictDto(de.symeda.sormas.api.infrastructure.district.DistrictDto) Optional(java.util.Optional) Objects.nonNull(java.util.Objects.nonNull) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) FacilityDto(de.symeda.sormas.api.infrastructure.facility.FacilityDto) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) MapContactDto(de.symeda.sormas.api.contact.MapContactDto) CaseMeasure(de.symeda.sormas.api.CaseMeasure) CaseClassification(de.symeda.sormas.api.caze.CaseClassification) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) CssLayout(com.vaadin.ui.CssLayout) LeafletPolygon(de.symeda.sormas.ui.map.LeafletPolygon) EventStatus(de.symeda.sormas.api.event.EventStatus) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) OptionGroup(com.vaadin.v7.ui.OptionGroup) Image(com.vaadin.ui.Image) Label(com.vaadin.ui.Label) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) DataHelper(de.symeda.sormas.api.utils.DataHelper) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) UserDto(de.symeda.sormas.api.user.UserDto) CaseFacade(de.symeda.sormas.api.caze.CaseFacade) Pair(de.symeda.sormas.api.utils.DataHelper.Pair) MapCaseDto(de.symeda.sormas.api.caze.MapCaseDto) Captions(de.symeda.sormas.api.i18n.Captions) FacilityReferenceDto(de.symeda.sormas.api.infrastructure.facility.FacilityReferenceDto) Consumer(java.util.function.Consumer) Button(com.vaadin.ui.Button) Disease(de.symeda.sormas.api.Disease) MarkerIcon(de.symeda.sormas.ui.map.MarkerIcon) HeightMode(com.vaadin.v7.shared.ui.grid.HeightMode) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Strings(de.symeda.sormas.api.i18n.Strings) OptionGroup(com.vaadin.v7.ui.OptionGroup) PopupButton(org.vaadin.hene.popupbutton.PopupButton) CheckBox(com.vaadin.v7.ui.CheckBox) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 49 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.

the class SurveillanceDiseaseCarouselLayout method createCarouselMenuLayout.

private HorizontalLayout createCarouselMenuLayout() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setMargin(false);
    CssStyles.style(layout, CssStyles.HSPACE_LEFT_2);
    CheckBox autoSlide = this.setupSlideShow();
    layout.addComponent(autoSlide);
    layout.setComponentAlignment(autoSlide, Alignment.MIDDLE_LEFT);
    carouselMenu = new SubMenu();
    for (Disease disease : diseases) {
        carouselMenu.addView(disease.getName(), disease.toShortString(), (e) -> {
            this.changeSelectedDisease(disease, true);
        });
    }
    if (diseases.size() > 0) {
        this.setActiveDisease(diseases.get(0), false);
    }
    layout.addComponent(carouselMenu);
    return layout;
}
Also used : Disease(de.symeda.sormas.api.Disease) CheckBox(com.vaadin.v7.ui.CheckBox) SubMenu(de.symeda.sormas.ui.SubMenu) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 50 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.

the class AbstractTableField method initContent.

@Override
protected Component initContent() {
    this.addStyleName(CssStyles.CAPTION_HIDDEN);
    this.addStyleName(CssStyles.VSPACE_2);
    layout = new VerticalLayout();
    layout.setSpacing(false);
    layout.setMargin(false);
    HorizontalLayout headerLayout = new HorizontalLayout();
    {
        headerLayout.setWidth(100, Unit.PERCENTAGE);
        captionLabel = new Label(getCaption());
        captionLabel.setSizeUndefined();
        headerLayout.addComponent(captionLabel);
        headerLayout.setComponentAlignment(captionLabel, Alignment.BOTTOM_LEFT);
        headerLayout.setExpandRatio(captionLabel, 0);
        addButton = createAddButton();
        headerLayout.addComponent(addButton);
        headerLayout.setComponentAlignment(addButton, Alignment.BOTTOM_RIGHT);
        headerLayout.setExpandRatio(addButton, 1);
    }
    layout.addComponent(headerLayout);
    table = createTable();
    table.addItemSetChangeListener(new ItemSetChangeListener() {

        @Override
        public void containerItemSetChange(ItemSetChangeEvent event) {
            applyTablePageLength();
        }
    });
    layout.addComponent(table);
    return layout;
}
Also used : ItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ItemSetChangeEvent(com.vaadin.v7.data.Container.ItemSetChangeEvent) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

HorizontalLayout (com.vaadin.ui.HorizontalLayout)53 Button (com.vaadin.ui.Button)37 Label (com.vaadin.ui.Label)32 VerticalLayout (com.vaadin.ui.VerticalLayout)32 ComboBox (com.vaadin.v7.ui.ComboBox)29 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)29 CssStyles (de.symeda.sormas.ui.utils.CssStyles)29 Alignment (com.vaadin.ui.Alignment)28 ValoTheme (com.vaadin.ui.themes.ValoTheme)28 Captions (de.symeda.sormas.api.i18n.Captions)28 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)27 FacadeProvider (de.symeda.sormas.api.FacadeProvider)26 Strings (de.symeda.sormas.api.i18n.Strings)26 VaadinIcons (com.vaadin.icons.VaadinIcons)25 UserProvider (de.symeda.sormas.ui.UserProvider)25 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)24 ComboBoxHelper (de.symeda.sormas.ui.utils.ComboBoxHelper)23 MenuBar (com.vaadin.ui.MenuBar)22 UserRight (de.symeda.sormas.api.user.UserRight)22 ViewModelProviders (de.symeda.sormas.ui.ViewModelProviders)22