use of de.symeda.sormas.api.therapy.TreatmentType 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;
}
use of de.symeda.sormas.api.therapy.TreatmentType in project SORMAS-Project by hzi-braunschweig.
the class TherapyView method createPrescriptionsHeader.
private VerticalLayout createPrescriptionsHeader() {
VerticalLayout prescriptionsHeader = new VerticalLayout();
prescriptionsHeader.setMargin(false);
prescriptionsHeader.setSpacing(false);
prescriptionsHeader.setWidth(100, Unit.PERCENTAGE);
HorizontalLayout headlineRow = new HorizontalLayout();
headlineRow.setMargin(false);
headlineRow.setSpacing(true);
headlineRow.setWidth(100, Unit.PERCENTAGE);
{
Label prescriptionsLabel = new Label(I18nProperties.getString(Strings.entityPrescriptions));
CssStyles.style(prescriptionsLabel, CssStyles.H3);
headlineRow.addComponent(prescriptionsLabel);
headlineRow.setExpandRatio(prescriptionsLabel, 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().deleteAllSelectedPrescriptions(prescriptionGrid.getSelectedRows(), new Runnable() {
public void run() {
reloadPrescriptionGrid();
}
});
}));
headlineRow.addComponent(bulkOperationsDropdown);
headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
}
Button newPrescriptionButton = ButtonHelper.createButton(Captions.prescriptionNewPrescription, e -> {
ControllerProvider.getTherapyController().openPrescriptionCreateForm(prescriptionCriteria.getTherapy(), this::reloadPrescriptionGrid);
}, ValoTheme.BUTTON_PRIMARY);
headlineRow.addComponent(newPrescriptionButton);
headlineRow.setComponentAlignment(newPrescriptionButton, Alignment.MIDDLE_RIGHT);
}
prescriptionsHeader.addComponent(headlineRow);
HorizontalLayout filterRow = new HorizontalLayout();
filterRow.setMargin(false);
filterRow.setSpacing(true);
{
prescriptionTypeFilter = ComboBoxHelper.createComboBoxV7();
prescriptionTypeFilter.setWidth(140, Unit.PIXELS);
prescriptionTypeFilter.setInputPrompt(I18nProperties.getPrefixCaption(PrescriptionDto.I18N_PREFIX, PrescriptionDto.PRESCRIPTION_TYPE));
prescriptionTypeFilter.addItems((Object[]) TreatmentType.values());
prescriptionTypeFilter.addValueChangeListener(e -> {
prescriptionCriteria.prescriptionType(((TreatmentType) e.getProperty().getValue()));
navigateTo(prescriptionCriteria);
});
filterRow.addComponent(prescriptionTypeFilter);
prescriptionTextFilter = new TextField();
prescriptionTextFilter.setWidth(300, Unit.PIXELS);
prescriptionTextFilter.setNullRepresentation("");
prescriptionTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptPrescriptionTextFilter));
prescriptionTextFilter.addTextChangeListener(e -> {
prescriptionCriteria.textFilter(e.getText());
reloadPrescriptionGrid();
});
filterRow.addComponent(prescriptionTextFilter);
}
prescriptionsHeader.addComponent(filterRow);
return prescriptionsHeader;
}
Aggregations