use of de.symeda.sormas.ui.configuration.infrastructure.components.SearchField in project SORMAS-Project by hzi-braunschweig.
the class ContinentsView 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();
});
filterLayout.addComponent(searchField);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(ContinentsView.class).remove(ContinentCriteria.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.continentActiveContinents));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.continentArchivedContinents));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.continentAllContinents));
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.CONTINENT, () -> 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.CONTINENT, () -> navigateTo(criteria));
}, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
bulkOperationsDropdown.setVisible(isBulkOperationsDropdownVisible());
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
}
}
filterLayout.addComponent(actionButtonsLayout);
filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
filterLayout.setExpandRatio(actionButtonsLayout, 1);
return filterLayout;
}
use of de.symeda.sormas.ui.configuration.infrastructure.components.SearchField in project SORMAS-Project by hzi-braunschweig.
the class CountriesView 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.nameCodeLike(e.getText());
grid.reload();
});
filterLayout.addComponent(searchField);
subcontinentFilter = ComboBoxHelper.createComboBoxV7();
subcontinentFilter.setId(CountryDto.SUBCONTINENT);
subcontinentFilter.setWidth(140, Unit.PIXELS);
subcontinentFilter.setCaption(I18nProperties.getPrefixCaption(CountryDto.I18N_PREFIX, CountryDto.SUBCONTINENT));
subcontinentFilter.addItems(FacadeProvider.getSubcontinentFacade().getAllActiveAsReference());
subcontinentFilter.addValueChangeListener(e -> {
criteria.subcontinent((SubcontinentReferenceDto) e.getProperty().getValue());
navigateTo(criteria);
});
filterLayout.addComponent(subcontinentFilter);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(CountriesView.class).remove(CountryCriteria.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.countryActiveCountries));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.countryArchivedCountries));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.countryAllCountries));
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.COUNTRY, () -> 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.COUNTRY, () -> navigateTo(criteria));
}, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
bulkOperationsDropdown.setVisible(isBulkOperationsDropdownVisible());
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
}
}
filterLayout.addComponent(actionButtonsLayout);
filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
filterLayout.setExpandRatio(actionButtonsLayout, 1);
return filterLayout;
}
use of de.symeda.sormas.ui.configuration.infrastructure.components.SearchField in project SORMAS-Project by hzi-braunschweig.
the class FacilitiesView method createFilterBar.
// TODO additional filter bar (active, archived and other)
// private HorizontalLayout createHeaderBar() {
// headerLayout = new HorizontalLayout();
// headerLayout.setSpacing(true);
// headerLayout.setWidth(100, Unit.PERCENTAGE);
//
// return headerLayout;
// }
private HorizontalLayout createFilterBar() {
filterLayout = new HorizontalLayout();
filterLayout.setMargin(false);
filterLayout.setSpacing(true);
filterLayout.setWidth(100, Unit.PERCENTAGE);
searchField = new SearchField();
searchField.addTextChangeListener(e -> {
criteria.nameCityLike(e.getText());
grid.reload();
rowCount.update(grid.getItemCount());
});
filterLayout.addComponent(searchField);
typeGroupFilter = ComboBoxHelper.createComboBoxV7();
typeGroupFilter.setId("typeGroup");
typeGroupFilter.setWidth(220, Unit.PIXELS);
typeGroupFilter.setCaption(I18nProperties.getCaption(Captions.Facility_typeGroup));
typeGroupFilter.addItems(FacilityTypeGroup.values());
typeGroupFilter.addValueChangeListener(e -> {
criteria.typeGroup((FacilityTypeGroup) e.getProperty().getValue());
FieldHelper.updateItems(typeFilter, FacilityType.getTypes((FacilityTypeGroup) typeGroupFilter.getValue()));
});
filterLayout.addComponent(typeGroupFilter);
typeFilter = ComboBoxHelper.createComboBoxV7();
typeFilter.setId(FacilityDto.TYPE);
typeFilter.setWidth(220, Unit.PIXELS);
typeFilter.setCaption(I18nProperties.getPrefixCaption(FacilityDto.I18N_PREFIX, FacilityDto.TYPE));
typeFilter.addValueChangeListener(e -> {
criteria.type((FacilityType) e.getProperty().getValue());
navigateTo(criteria);
});
filterLayout.addComponent(typeFilter);
countryFilter = addCountryFilter(filterLayout, country -> {
criteria.country(country);
grid.reload();
rowCount.update(grid.getItemCount());
}, 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(FacilityDto.REGION);
regionFilter.setWidth(140, Unit.PIXELS);
regionFilter.setCaption(I18nProperties.getPrefixCaption(FacilityDto.I18N_PREFIX, FacilityDto.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(FacilityDto.DISTRICT);
districtFilter.setWidth(140, Unit.PIXELS);
districtFilter.setCaption(I18nProperties.getPrefixCaption(FacilityDto.I18N_PREFIX, FacilityDto.DISTRICT));
districtFilter.addValueChangeListener(e -> {
DistrictReferenceDto district = (DistrictReferenceDto) e.getProperty().getValue();
criteria.district(district);
navigateTo(criteria);
FieldHelper.updateItems(communityFilter, district != null ? FacadeProvider.getCommunityFacade().getAllActiveByDistrict(district.getUuid()) : null);
});
filterLayout.addComponent(districtFilter);
communityFilter = ComboBoxHelper.createComboBoxV7();
communityFilter.setId(FacilityDto.COMMUNITY);
communityFilter.setWidth(140, Unit.PIXELS);
communityFilter.setCaption(I18nProperties.getPrefixCaption(FacilityDto.I18N_PREFIX, FacilityDto.COMMUNITY));
communityFilter.addValueChangeListener(e -> {
criteria.community((CommunityReferenceDto) e.getProperty().getValue());
navigateTo(criteria);
});
filterLayout.addComponent(communityFilter);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(FacilitiesView.class).remove(FacilityCriteria.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.facilityActiveFacilities));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.facilityArchivedFacilities));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.facilityAllFacilities));
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.FACILITY, new Runnable() {
public void run() {
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.FACILITY, new Runnable() {
public void run() {
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 de.symeda.sormas.ui.configuration.infrastructure.components.SearchField in project SORMAS-Project by hzi-braunschweig.
the class AreasView method createFilterBar.
private HorizontalLayout createFilterBar() {
HorizontalLayout filterLayout = new HorizontalLayout();
filterLayout.setMargin(false);
filterLayout.setSpacing(true);
filterLayout.setWidth(100, Unit.PERCENTAGE);
searchField = new SearchField();
searchField.addTextChangeListener(e -> {
criteria.textFilter(e.getText());
grid.reload();
});
filterLayout.addComponent(searchField);
btnResetFilters = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(AreasView.class).remove(AreaCriteria.class);
navigateTo(null);
}, CssStyles.FORCE_CAPTION);
btnResetFilters.setVisible(false);
filterLayout.addComponent(btnResetFilters);
HorizontalLayout actionButtonsLayout = new HorizontalLayout();
actionButtonsLayout.setSpacing(true);
{
// Show active/archived/all dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
filterRelevanceStatus = new ComboBox<>();
filterRelevanceStatus.setId("relevanceStatus");
filterRelevanceStatus.setWidth(220, Unit.PERCENTAGE);
filterRelevanceStatus.setEmptySelectionAllowed(false);
filterRelevanceStatus.setItems(EntityRelevanceStatus.values());
filterRelevanceStatus.setItemCaptionGenerator(status -> {
switch(status) {
case ACTIVE:
return I18nProperties.getCaption(Captions.areaActiveAreas);
case ARCHIVED:
return I18nProperties.getCaption(Captions.areaArchivedAreas);
default:
return I18nProperties.getCaption(Captions.areaAllAreas);
}
});
filterRelevanceStatus.addValueChangeListener(e -> {
criteria.relevanceStatus(e.getValue());
navigateTo(criteria);
});
actionButtonsLayout.addComponent(filterRelevanceStatus);
// Bulk operation dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
dropdownBulkOperations = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionArchiveInfrastructure), VaadinIcons.ARCHIVE, selectedItem -> {
ControllerProvider.getInfrastructureController().archiveOrDearchiveAllSelectedItems(true, grid.asMultiSelect().getSelectedItems(), InfrastructureType.AREA, () -> 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.AREA, () -> navigateTo(criteria));
}, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
dropdownBulkOperations.setVisible(viewConfiguration.isInEagerMode() && !EntityRelevanceStatus.ALL.equals(criteria.getRelevanceStatus()));
actionButtonsLayout.addComponent(dropdownBulkOperations);
}
}
}
filterLayout.addComponent(actionButtonsLayout);
filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
filterLayout.setExpandRatio(actionButtonsLayout, 1);
return filterLayout;
}
use of de.symeda.sormas.ui.configuration.infrastructure.components.SearchField in project SORMAS-Project by hzi-braunschweig.
the class RegionsView 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.nameEpidLike(e.getText());
grid.reload();
});
filterLayout.addComponent(searchField);
countryFilter = addCountryFilter(filterLayout, country -> {
criteria.country(country);
grid.reload();
}, null);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(RegionsView.class).remove(RegionCriteria.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.regionActiveRegions));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.regionArchivedRegions));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.regionAllRegions));
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.REGION, () -> 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.REGION, () -> navigateTo(criteria));
}, EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
bulkOperationsDropdown.setVisible(isBulkOperationsDropdownVisible());
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
}
}
filterLayout.addComponent(actionButtonsLayout);
filterLayout.setComponentAlignment(actionButtonsLayout, Alignment.BOTTOM_RIGHT);
filterLayout.setExpandRatio(actionButtonsLayout, 1);
return filterLayout;
}
Aggregations