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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations