use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class SubcontinentsView 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);
continentFilter = ComboBoxHelper.createComboBoxV7();
continentFilter.setId(SubcontinentDto.CONTINENT);
continentFilter.setWidth(140, Unit.PIXELS);
continentFilter.setCaption(I18nProperties.getPrefixCaption(SubcontinentDto.I18N_PREFIX, SubcontinentDto.CONTINENT));
continentFilter.addItems(FacadeProvider.getContinentFacade().getAllActiveAsReference());
continentFilter.addValueChangeListener(e -> {
criteria.continent((ContinentReferenceDto) e.getProperty().getValue());
navigateTo(criteria);
});
filterLayout.addComponent(continentFilter);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(SubcontinentsView.class).remove(SubcontinentCriteria.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.subcontinentActiveSubcontinents));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.subcontinentArchivedSubcontinents));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.subcontinentAllSubcontinents));
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.SUBCONTINENT, () -> 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.SUBCONTINENT, () -> 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 com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class TaskGridComponent method createAssigneeFilterBar.
public HorizontalLayout createAssigneeFilterBar() {
HorizontalLayout assigneeFilterLayout = new HorizontalLayout();
assigneeFilterLayout.setMargin(false);
assigneeFilterLayout.setSpacing(true);
assigneeFilterLayout.setWidth(100, Unit.PERCENTAGE);
assigneeFilterLayout.addStyleName(CssStyles.VSPACE_3);
statusButtons = new HashMap<>();
HorizontalLayout buttonFilterLayout = new HorizontalLayout();
buttonFilterLayout.setSpacing(true);
{
Button allTasks = ButtonHelper.createButton(Captions.all, e -> processAssigneeFilterChange(null), ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
allTasks.setCaptionAsHtml(true);
buttonFilterLayout.addComponent(allTasks);
statusButtons.put(allTasks, I18nProperties.getCaption(Captions.all));
createAndAddStatusButton(Captions.taskOfficerTasks, OFFICER_TASKS, buttonFilterLayout);
Button myTasks = createAndAddStatusButton(Captions.taskMyTasks, MY_TASKS, buttonFilterLayout);
// Default filter for lab users (that don't have any other role) is "My tasks"
if (nonNull(UserProvider.getCurrent()) && UserProvider.getCurrent().hasLaboratoryOrExternalLaboratoryJurisdictionLevel()) {
activeStatusButton = myTasks;
} else {
activeStatusButton = allTasks;
}
}
assigneeFilterLayout.addComponent(buttonFilterLayout);
HorizontalLayout actionButtonsLayout = new HorizontalLayout();
actionButtonsLayout.setSpacing(true);
{
// Show active/archived/all dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_VIEW)) {
relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
relevanceStatusFilter.setId("relevanceStatusFilter");
relevanceStatusFilter.setWidth(140, Unit.PERCENTAGE);
relevanceStatusFilter.setNullSelectionAllowed(false);
relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.taskActiveTasks));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.taskArchivedTasks));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.taskAllTasks));
relevanceStatusFilter.addValueChangeListener(e -> {
criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
tasksView.navigateTo(criteria);
});
actionButtonsLayout.addComponent(relevanceStatusFilter);
}
// Bulk operation dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
assigneeFilterLayout.setWidth(100, Unit.PERCENTAGE);
boolean hasBulkOperationsRight = UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS);
final List<MenuBarHelper.MenuBarItem> menuBarItems = new ArrayList<>();
menuBarItems.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, mi -> ControllerProvider.getTaskController().showBulkTaskDataEditComponent(this.grid.asMultiSelect().getSelectedItems(), () -> tasksView.navigateTo(criteria)), hasBulkOperationsRight));
menuBarItems.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> ControllerProvider.getTaskController().deleteAllSelectedItems(this.grid.asMultiSelect().getSelectedItems(), () -> tasksView.navigateTo(criteria)), hasBulkOperationsRight));
menuBarItems.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionArchiveCoreEntity), VaadinIcons.ARCHIVE, mi -> ControllerProvider.getTaskController().archiveAllSelectedItems(this.grid.asMultiSelect().getSelectedItems(), () -> tasksView.navigateTo(criteria)), hasBulkOperationsRight && EntityRelevanceStatus.ACTIVE.equals(criteria.getRelevanceStatus())));
menuBarItems.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.actionDearchiveCoreEntity), VaadinIcons.ARCHIVE, mi -> ControllerProvider.getTaskController().dearchiveAllSelectedItems(this.grid.asMultiSelect().getSelectedItems(), () -> tasksView.navigateTo(criteria)), hasBulkOperationsRight && EntityRelevanceStatus.ARCHIVED.equals(criteria.getRelevanceStatus())));
bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, menuBarItems);
bulkOperationsDropdown.setVisible(tasksView.getViewConfiguration().isInEagerMode());
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
}
assigneeFilterLayout.addComponent(actionButtonsLayout);
assigneeFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
assigneeFilterLayout.setExpandRatio(actionButtonsLayout, 1);
return assigneeFilterLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class TravelEntriesView method createStatusFilterBar.
public HorizontalLayout createStatusFilterBar() {
HorizontalLayout statusFilterLayout = new HorizontalLayout();
statusFilterLayout.setSpacing(true);
statusFilterLayout.setMargin(false);
statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
statusFilterLayout.addStyleName(CssStyles.VSPACE_3);
HorizontalLayout actionButtonsLayout = new HorizontalLayout();
actionButtonsLayout.setSpacing(true);
// Show active/archived/all dropdown
if (Objects.nonNull(UserProvider.getCurrent()) && UserProvider.getCurrent().hasUserRight(UserRight.TRAVEL_ENTRY_VIEW)) {
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AUTOMATIC_ARCHIVING, CoreEntityType.TRAVEL_ENTRY)) {
int daysAfterTravelEntryGetsArchived = FacadeProvider.getFeatureConfigurationFacade().getProperty(FeatureType.AUTOMATIC_ARCHIVING, CoreEntityType.TRAVEL_ENTRY, FeatureTypeProperty.THRESHOLD_IN_DAYS, Integer.class);
if (daysAfterTravelEntryGetsArchived > 0) {
relevanceStatusInfoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + String.format(I18nProperties.getString(Strings.infoArchivedTravelEntries), daysAfterTravelEntryGetsArchived), ContentMode.HTML);
relevanceStatusInfoLabel.setVisible(false);
relevanceStatusInfoLabel.addStyleName(CssStyles.LABEL_VERTICAL_ALIGN_SUPER);
actionButtonsLayout.addComponent(relevanceStatusInfoLabel);
actionButtonsLayout.setComponentAlignment(relevanceStatusInfoLabel, Alignment.MIDDLE_RIGHT);
}
}
relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
relevanceStatusFilter.setId("relevanceStatus");
relevanceStatusFilter.setWidth(140, Unit.PIXELS);
relevanceStatusFilter.setNullSelectionAllowed(false);
relevanceStatusFilter.setTextInputAllowed(false);
relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.travelEntryActiveTravelEntries));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.travelEntryArchivedTravelEntries));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.travelEntryAllTravelEntries));
relevanceStatusFilter.setCaption("");
relevanceStatusFilter.addValueChangeListener(e -> {
if (relevanceStatusInfoLabel != null) {
relevanceStatusInfoLabel.setVisible(EntityRelevanceStatus.ARCHIVED.equals(e.getProperty().getValue()));
}
criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
navigateTo(criteria);
});
actionButtonsLayout.addComponent(relevanceStatusFilter);
}
statusFilterLayout.addComponent(actionButtonsLayout);
statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
statusFilterLayout.setExpandRatio(actionButtonsLayout, 1);
// Bulk operation dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.TRAVEL_ENTRY_DELETE) && UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
List<MenuBarHelper.MenuBarItem> bulkActions = new ArrayList<>();
bulkActions.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, mi -> grid.bulkActionHandler(items -> ControllerProvider.getTravelEntryController().deleteAllSelectedItems(items, () -> navigateTo(criteria)), true)));
bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, bulkActions);
bulkOperationsDropdown.setVisible(viewConfiguration.isInEagerMode());
bulkOperationsDropdown.setCaption("");
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
return statusFilterLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class DatabaseExportView method createDatabaseTablesLayout.
private HorizontalLayout createDatabaseTablesLayout() {
HorizontalLayout databaseTablesLayout = new HorizontalLayout();
databaseTablesLayout.setMargin(false);
databaseTablesLayout.setSpacing(true);
VerticalLayout sormasDataLayout = new VerticalLayout();
sormasDataLayout.setMargin(false);
sormasDataLayout.setSpacing(false);
Label sormasDataHeadline = new Label(I18nProperties.getCaption(Captions.exportSormasData));
CssStyles.style(sormasDataHeadline, CssStyles.H4);
sormasDataLayout.addComponent(sormasDataHeadline);
VerticalLayout infrastructureDataLayout = new VerticalLayout();
infrastructureDataLayout.setMargin(false);
infrastructureDataLayout.setSpacing(false);
Label infrastructureDataHeadline = new Label(I18nProperties.getCaption(Captions.exportInfrastructureData));
CssStyles.style(infrastructureDataHeadline, CssStyles.H4);
infrastructureDataLayout.addComponent(infrastructureDataHeadline);
VerticalLayout configurationDataLayout = new VerticalLayout();
configurationDataLayout.setMargin(false);
configurationDataLayout.setSpacing(false);
Label configurationDataHeadline = new Label(I18nProperties.getCaption(Captions.exportConfigurationData));
CssStyles.style(configurationDataHeadline, CssStyles.H4);
configurationDataLayout.addComponent(configurationDataHeadline);
VerticalLayout externalDataLayout = new VerticalLayout();
externalDataLayout.setMargin(false);
externalDataLayout.setSpacing(false);
Label externalDataHeadline = new Label(I18nProperties.getCaption(Captions.exportExternalData));
CssStyles.style(externalDataHeadline, CssStyles.H4);
externalDataLayout.addComponent(externalDataHeadline);
List<FeatureConfigurationDto> featureConfigurations = FacadeProvider.getFeatureConfigurationFacade().getActiveServerFeatureConfigurations();
ConfigFacade configFacade = FacadeProvider.getConfigFacade();
for (DatabaseTable databaseTable : DatabaseTable.values()) {
if (!databaseTable.isEnabled(featureConfigurations, configFacade)) {
continue;
}
CheckBox checkBox = new CheckBox(databaseTable.toString());
int indent = getIndent(databaseTable);
if (indent == 1) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_1);
} else if (indent == 2) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_2);
} else if (indent == 3) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_3);
}
switch(databaseTable.getDatabaseTableType()) {
case SORMAS:
sormasDataLayout.addComponent(checkBox);
break;
case INFRASTRUCTURE:
infrastructureDataLayout.addComponent(checkBox);
break;
case CONFIGURATION:
configurationDataLayout.addComponent(checkBox);
break;
case EXTERNAL:
externalDataLayout.addComponent(checkBox);
break;
default:
throw new IllegalArgumentException(databaseTable.getDatabaseTableType().toString());
}
databaseTableToggles.put(checkBox, databaseTable);
}
databaseTablesLayout.addComponent(sormasDataLayout);
databaseTablesLayout.addComponent(infrastructureDataLayout);
databaseTablesLayout.addComponent(configurationDataLayout);
databaseTablesLayout.addComponent(externalDataLayout);
return databaseTablesLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class TherapyView method createTreatmentsHeader.
private VerticalLayout createTreatmentsHeader() {
VerticalLayout treatmentsHeader = new VerticalLayout();
treatmentsHeader.setMargin(false);
treatmentsHeader.setSpacing(false);
treatmentsHeader.setWidth(100, Unit.PERCENTAGE);
HorizontalLayout headlineRow = new HorizontalLayout();
headlineRow.setMargin(false);
headlineRow.setSpacing(true);
headlineRow.setWidth(100, Unit.PERCENTAGE);
{
Label treatmentsLabel = new Label(I18nProperties.getString(Strings.headingTreatments));
CssStyles.style(treatmentsLabel, CssStyles.H3);
headlineRow.addComponent(treatmentsLabel);
headlineRow.setExpandRatio(treatmentsLabel, 1);
// Bulk operations
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
ControllerProvider.getTherapyController().deleteAllSelectedTreatments(treatmentGrid.getSelectedRows(), new Runnable() {
public void run() {
reloadTreatmentGrid();
}
});
}));
headlineRow.addComponent(bulkOperationsDropdown);
headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
}
Button newTreatmentButton = ButtonHelper.createButton(Captions.treatmentNewTreatment, e -> {
ControllerProvider.getTherapyController().openTreatmentCreateForm(treatmentCriteria.getTherapy(), this::reloadTreatmentGrid);
});
headlineRow.addComponent(newTreatmentButton);
headlineRow.setComponentAlignment(newTreatmentButton, Alignment.MIDDLE_RIGHT);
}
treatmentsHeader.addComponent(headlineRow);
HorizontalLayout filterRow = new HorizontalLayout();
filterRow.setMargin(false);
filterRow.setSpacing(true);
{
treatmentTypeFilter = ComboBoxHelper.createComboBoxV7();
treatmentTypeFilter.setWidth(140, Unit.PIXELS);
treatmentTypeFilter.setInputPrompt(I18nProperties.getPrefixCaption(TreatmentDto.I18N_PREFIX, TreatmentDto.TREATMENT_TYPE));
treatmentTypeFilter.addItems((Object[]) TreatmentType.values());
treatmentTypeFilter.addValueChangeListener(e -> {
treatmentCriteria.treatmentType(((TreatmentType) e.getProperty().getValue()));
navigateTo(treatmentCriteria);
});
filterRow.addComponent(treatmentTypeFilter);
treatmentTextFilter = new TextField();
treatmentTextFilter.setWidth(300, Unit.PIXELS);
treatmentTextFilter.setNullRepresentation("");
treatmentTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptTreatmentTextFilter));
treatmentTextFilter.addTextChangeListener(e -> {
treatmentCriteria.textFilter(e.getText());
reloadTreatmentGrid();
});
filterRow.addComponent(treatmentTextFilter);
}
treatmentsHeader.addComponent(filterRow);
return treatmentsHeader;
}
Aggregations