Search in sources :

Example 1 with PopupButton

use of org.vaadin.hene.popupbutton.PopupButton in project SORMAS-Project by hzi-braunschweig.

the class CasesView method addCommonCasesOverviewToolbar.

private void addCommonCasesOverviewToolbar() {
    final PopupMenu moreButton = new PopupMenu(I18nProperties.getCaption(Captions.moreActions));
    Button openGuideButton = ButtonHelper.createIconButton(Captions.caseOpenCasesGuide, VaadinIcons.QUESTION, e -> buildAndOpenCasesInstructions(), ValoTheme.BUTTON_PRIMARY);
    openGuideButton.setWidth(100, Unit.PERCENTAGE);
    moreButton.addMenuEntry(openGuideButton);
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) {
        VerticalLayout importLayout = new VerticalLayout();
        {
            importLayout.setSpacing(true);
            importLayout.setMargin(true);
            importLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
            importLayout.setWidth(250, Unit.PIXELS);
            PopupButton importButton = ButtonHelper.createIconPopupButton(Captions.actionImport, VaadinIcons.UPLOAD, importLayout);
            addHeaderComponent(importButton);
        }
        addImportButton(importLayout, Captions.importLineListing, Strings.headingLineListingImport, LineListingImportLayout::new);
        addImportButton(importLayout, Captions.importDetailed, Strings.headingImportCases, CaseImportLayout::new);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EXPORT)) {
        VerticalLayout exportLayout = new VerticalLayout();
        {
            exportLayout.setSpacing(true);
            exportLayout.setMargin(true);
            exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
            exportLayout.setWidth(250, Unit.PIXELS);
        }
        PopupButton exportPopupButton = ButtonHelper.createIconPopupButton(Captions.export, VaadinIcons.DOWNLOAD, exportLayout);
        addHeaderComponent(exportPopupButton);
        {
            StreamResource streamResource = GridExportStreamResource.createStreamResourceWithSelectedItems(grid, () -> this.viewConfiguration.isInEagerMode() ? this.grid.asMultiSelect().getSelectedItems() : Collections.emptySet(), ExportEntityName.CASES);
            addExportButton(streamResource, exportPopupButton, exportLayout, VaadinIcons.TABLE, Captions.exportBasic, Strings.infoBasicExport);
        }
        {
            StreamResource exportStreamResource = CaseDownloadUtil.createCaseExportResource(grid.getCriteria(), this::getSelectedRows, CaseExportType.CASE_SURVEILLANCE, detailedExportConfiguration);
            addExportButton(exportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportDetailed, Strings.infoDetailedExport);
        }
        if (hasClinicalCourseRight || hasTherapyRight) {
            StreamResource caseManagementExportStreamResource = DownloadUtil.createCaseManagementExportResource(grid.getCriteria(), this::getSelectedRows, ExportEntityName.CONTACTS);
            addExportButton(caseManagementExportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportCaseManagement, Strings.infoCaseManagementExport);
        }
        {
            StreamResource sampleExportStreamResource = DownloadUtil.createCsvExportStreamResource(SampleExportDto.class, null, (Integer start, Integer max) -> FacadeProvider.getSampleFacade().getExportList(grid.getCriteria(), this.getSelectedRows(), start, max), (propertyId, type) -> {
                String caption = I18nProperties.findPrefixCaption(propertyId, SampleExportDto.I18N_PREFIX, SampleDto.I18N_PREFIX, CaseDataDto.I18N_PREFIX, PersonDto.I18N_PREFIX, AdditionalTestDto.I18N_PREFIX);
                if (Date.class.isAssignableFrom(type)) {
                    caption += " (" + DateFormatHelper.getDateFormatPattern() + ")";
                }
                return caption;
            }, ExportEntityName.SAMPLES, null);
            addExportButton(sampleExportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportSamples, Strings.infoSampleExport);
        }
        if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_SWITZERLAND) && UserProvider.getCurrent().hasUserRight(UserRight.BAG_EXPORT)) {
            StreamResource bagExportResource = DownloadUtil.createCsvExportStreamResource(BAGExportCaseDto.class, null, (Integer start, Integer max) -> FacadeProvider.getBAGExportFacade().getCaseExportList(this.getSelectedRows(), start, max), (propertyId, type) -> propertyId, ExportEntityName.BAG_CASES, null);
            addExportButton(bagExportResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.BAGExport, Strings.infoBAGExport);
        }
        {
            Button btnCustomCaseExport = ButtonHelper.createIconButton(Captions.exportCaseCustom, VaadinIcons.FILE_TEXT, e -> {
                Window customExportWindow = VaadinUiUtil.createPopupWindow();
                ExportConfigurationsLayout customExportsLayout = new ExportConfigurationsLayout(ExportType.CASE, ImportExportUtils.getCaseExportProperties(CaseDownloadUtil::getPropertyCaption, caseFollowUpEnabled, hasClinicalCourseRight, hasTherapyRight, FacadeProvider.getConfigFacade().getCountryLocale()), customExportWindow::close);
                customExportsLayout.setExportCallback((exportConfig) -> Page.getCurrent().open(CaseDownloadUtil.createCaseExportResource(grid.getCriteria(), this::getSelectedRows, null, exportConfig), null, true));
                customExportWindow.setWidth(1024, Unit.PIXELS);
                customExportWindow.setCaption(I18nProperties.getCaption(Captions.exportCaseCustom));
                customExportWindow.setContent(customExportsLayout);
                UI.getCurrent().addWindow(customExportWindow);
                exportPopupButton.setPopupVisible(false);
            }, ValoTheme.BUTTON_PRIMARY);
            btnCustomCaseExport.setDescription(I18nProperties.getString(Strings.infoCustomExport));
            btnCustomCaseExport.setWidth(100, Unit.PERCENTAGE);
            exportLayout.addComponent(btnCustomCaseExport);
        }
        {
            // Warning if no filters have been selected
            Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters), ContentMode.HTML);
            warningLabel.setWidth(100, Unit.PERCENTAGE);
            exportLayout.addComponent(warningLabel);
            warningLabel.setVisible(false);
            exportPopupButton.addClickListener(e -> warningLabel.setVisible(!criteria.hasAnyFilterActive()));
        }
    }
    if (isBulkEditAllowed()) {
        btnEnterBulkEditMode = ButtonHelper.createIconButton(Captions.actionEnterBulkEditMode, VaadinIcons.CHECK_SQUARE_O, e -> {
            if (grid.getItemCount() > BULK_EDIT_MODE_WARNING_THRESHOLD) {
                VaadinUiUtil.showConfirmationPopup(I18nProperties.getCaption(Captions.actionEnterBulkEditMode), new Label(String.format(I18nProperties.getString(Strings.confirmationEnterBulkEditMode), BULK_EDIT_MODE_WARNING_THRESHOLD)), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), 640, (result) -> {
                    if (result == true) {
                        enterBulkEditMode();
                    }
                });
            } else {
                enterBulkEditMode();
            }
        }, ValoTheme.BUTTON_PRIMARY);
        btnEnterBulkEditMode.setVisible(!viewConfiguration.isInEagerMode());
        btnEnterBulkEditMode.setWidth(100, Unit.PERCENTAGE);
        moreButton.addMenuEntry(btnEnterBulkEditMode);
        btnLeaveBulkEditMode = ButtonHelper.createIconButton(Captions.actionLeaveBulkEditMode, VaadinIcons.CLOSE, e -> {
            bulkOperationsDropdown.setVisible(false);
            ViewModelProviders.of(CasesView.class).get(CasesViewConfiguration.class).setInEagerMode(false);
            btnLeaveBulkEditMode.setVisible(false);
            btnEnterBulkEditMode.setVisible(true);
            this.filterForm.enableSearchAndReportingUser();
            navigateTo(criteria);
        }, ValoTheme.BUTTON_PRIMARY);
        btnLeaveBulkEditMode.setVisible(viewConfiguration.isInEagerMode());
        addHeaderComponent(btnLeaveBulkEditMode);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MERGE)) {
        Button mergeDuplicatesButton = ButtonHelper.createIconButton(Captions.caseMergeDuplicates, VaadinIcons.COMPRESS_SQUARE, e -> ControllerProvider.getCaseController().navigateToMergeCasesView(), ValoTheme.BUTTON_PRIMARY);
        mergeDuplicatesButton.setWidth(100, Unit.PERCENTAGE);
        moreButton.addMenuEntry(mergeDuplicatesButton);
    }
    Button searchSpecificCaseButton = ButtonHelper.createIconButton(Captions.caseSearchSpecificCase, VaadinIcons.SEARCH, e -> buildAndOpenSearchSpecificCaseWindow(), ValoTheme.BUTTON_PRIMARY);
    searchSpecificCaseButton.setWidth(100, Unit.PERCENTAGE);
    moreButton.addMenuEntry(searchSpecificCaseButton);
    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_CREATE)) {
        final ExpandableButton lineListingButton = new ExpandableButton(Captions.lineListing).expand(e -> ControllerProvider.getCaseController().openLineListingWindow());
        addHeaderComponent(lineListingButton);
        final ExpandableButton createButton = new ExpandableButton(Captions.caseNewCase).expand(e -> ControllerProvider.getCaseController().create());
        addHeaderComponent(createButton);
    }
    if (moreButton.hasMenuEntries()) {
        addHeaderComponent(moreButton);
    }
}
Also used : FeatureType(de.symeda.sormas.api.feature.FeatureType) CaseImportLayout(de.symeda.sormas.ui.caze.importer.CaseImportLayout) TextField(com.vaadin.ui.TextField) Date(java.util.Date) DocumentWorkflow(de.symeda.sormas.api.docgeneneration.DocumentWorkflow) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) ReferenceDto(de.symeda.sormas.api.ReferenceDto) Window(com.vaadin.ui.Window) PersonDto(de.symeda.sormas.api.person.PersonDto) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Page(com.vaadin.server.Page) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) UserProvider(de.symeda.sormas.ui.UserProvider) ValoTheme(com.vaadin.ui.themes.ValoTheme) DownloadUtil(de.symeda.sormas.ui.utils.DownloadUtil) FilteredGrid(de.symeda.sormas.ui.utils.FilteredGrid) DateField(com.vaadin.ui.DateField) MenuBar(com.vaadin.ui.MenuBar) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) ComboBox(com.vaadin.v7.ui.ComboBox) ExportType(de.symeda.sormas.api.importexport.ExportType) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) InvestigationStatus(de.symeda.sormas.api.caze.InvestigationStatus) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) ExportConfigurationDto(de.symeda.sormas.api.importexport.ExportConfigurationDto) List(java.util.List) LocalDate(java.time.LocalDate) DateHelper8(de.symeda.sormas.ui.utils.DateHelper8) ExportConfigurationsLayout(de.symeda.sormas.ui.customexport.ExportConfigurationsLayout) FollowUpUtils.createFollowUpLegend(de.symeda.sormas.ui.utils.FollowUpUtils.createFollowUpLegend) StreamResource(com.vaadin.server.StreamResource) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) SearchSpecificLayout(de.symeda.sormas.ui.SearchSpecificLayout) FacadeProvider(de.symeda.sormas.api.FacadeProvider) DateFormatHelper(de.symeda.sormas.ui.utils.DateFormatHelper) VerticalLayout(com.vaadin.ui.VerticalLayout) DateHelper(de.symeda.sormas.api.utils.DateHelper) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) AdditionalTestDto(de.symeda.sormas.api.sample.AdditionalTestDto) PopupMenu(de.symeda.sormas.ui.utils.components.popupmenu.PopupMenu) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) CaseExportType(de.symeda.sormas.api.caze.CaseExportType) OptionGroup(com.vaadin.v7.ui.OptionGroup) Notification(com.vaadin.ui.Notification) SormasUI(de.symeda.sormas.ui.SormasUI) Label(com.vaadin.ui.Label) CountryHelper(de.symeda.sormas.api.CountryHelper) AbstractView(de.symeda.sormas.ui.utils.AbstractView) CaseDownloadUtil(de.symeda.sormas.ui.utils.CaseDownloadUtil) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) Validations(de.symeda.sormas.api.i18n.Validations) LineListingImportLayout(de.symeda.sormas.ui.caze.importer.LineListingImportLayout) BAGExportCaseDto(de.symeda.sormas.api.bagexport.BAGExportCaseDto) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) LayoutUtil(de.symeda.sormas.ui.utils.LayoutUtil) SampleExportDto(de.symeda.sormas.api.sample.SampleExportDto) ImportExportUtils(de.symeda.sormas.api.importexport.ImportExportUtils) SampleDto(de.symeda.sormas.api.sample.SampleDto) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Strings(de.symeda.sormas.api.i18n.Strings) ExportPropertyMetaInfo(de.symeda.sormas.api.importexport.ExportPropertyMetaInfo) DocGenerationHelper.isDocGenerationAllowed(de.symeda.sormas.ui.docgeneration.DocGenerationHelper.isDocGenerationAllowed) Collections(java.util.Collections) Component(com.vaadin.ui.Component) Window(com.vaadin.ui.Window) SampleExportDto(de.symeda.sormas.api.sample.SampleExportDto) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) ExportConfigurationsLayout(de.symeda.sormas.ui.customexport.ExportConfigurationsLayout) Label(com.vaadin.ui.Label) CaseImportLayout(de.symeda.sormas.ui.caze.importer.CaseImportLayout) Date(java.util.Date) LocalDate(java.time.LocalDate) CaseDownloadUtil(de.symeda.sormas.ui.utils.CaseDownloadUtil) PopupButton(org.vaadin.hene.popupbutton.PopupButton) StreamResource(com.vaadin.server.StreamResource) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) LineListingImportLayout(de.symeda.sormas.ui.caze.importer.LineListingImportLayout) VerticalLayout(com.vaadin.ui.VerticalLayout) PopupMenu(de.symeda.sormas.ui.utils.components.popupmenu.PopupMenu)

Example 2 with PopupButton

use of org.vaadin.hene.popupbutton.PopupButton in project SORMAS-Project by hzi-braunschweig.

the class CaseContactsView method createStatusFilterBar.

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth("100%");
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);
    statusButtons = new HashMap<>();
    Button statusAll = ButtonHelper.createButton(Captions.all, e -> {
        criteria.contactStatus(null);
        navigateTo(criteria);
    }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;
    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = ButtonHelper.createButton(status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setData(status);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }
    statusFilterLayout.setExpandRatio(statusFilterLayout.getComponent(statusFilterLayout.getComponentCount() - 1), 1);
    // Bulk operation dropdown
    if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
        statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
        MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, selectedItem -> {
            ControllerProvider.getContactController().showBulkContactDataEditComponent(grid.asMultiSelect().getSelectedItems(), getCaseRef().getUuid());
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE, selectedItem -> {
            ControllerProvider.getContactController().cancelFollowUpOfAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK, selectedItem -> {
            ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
            ControllerProvider.getContactController().deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
        }));
        statusFilterLayout.addComponent(bulkOperationsDropdown);
        statusFilterLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
        statusFilterLayout.setExpandRatio(bulkOperationsDropdown, 1);
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_IMPORT)) {
        Button importButton = ButtonHelper.createIconButton(Captions.actionImport, VaadinIcons.UPLOAD, e -> {
            Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseContactsImportLayout(FacadeProvider.getCaseFacade().getCaseDataByUuid(criteria.getCaze().getUuid())));
            popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCaseContacts));
            popupWindow.addCloseListener(c -> {
                grid.reload();
            });
        }, ValoTheme.BUTTON_PRIMARY);
        statusFilterLayout.addComponent(importButton);
        statusFilterLayout.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(importButton, 1);
        }
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {
        VerticalLayout exportLayout = new VerticalLayout();
        exportLayout.setSpacing(true);
        exportLayout.setMargin(true);
        exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
        exportLayout.setWidth(200, Unit.PIXELS);
        PopupButton exportButton = ButtonHelper.createIconPopupButton(Captions.export, VaadinIcons.DOWNLOAD, exportLayout);
        statusFilterLayout.addComponent(exportButton);
        statusFilterLayout.setComponentAlignment(exportButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(exportButton, 1);
        }
        StreamResource streamResource = GridExportStreamResource.createStreamResourceWithSelectedItems(grid, () -> viewConfiguration.isInEagerMode() ? this.grid.asMultiSelect().getSelectedItems() : null, ExportEntityName.CONTACTS);
        addExportButton(streamResource, exportButton, exportLayout, VaadinIcons.TABLE, Captions.exportBasic, Descriptions.descExportButton);
        StreamResource extendedExportStreamResource = ContactDownloadUtil.createContactExportResource(grid.getCriteria(), this::getSelectedRows, null);
        addExportButton(extendedExportStreamResource, exportButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportDetailed, Descriptions.descDetailedExportButton);
        Button btnCustomExport = ButtonHelper.createIconButton(Captions.exportCustom, VaadinIcons.FILE_TEXT, e -> {
            ControllerProvider.getCustomExportController().openContactExportWindow(grid.getCriteria(), this::getSelectedRows);
        }, ValoTheme.BUTTON_PRIMARY);
        btnCustomExport.setDescription(I18nProperties.getString(Strings.infoCustomExport));
        btnCustomExport.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(btnCustomExport);
        // Warning if no filters have been selected
        Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters));
        warningLabel.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(warningLabel);
        warningLabel.setVisible(false);
        exportButton.addClickListener(e -> warningLabel.setVisible(!criteria.hasAnyFilterActive()));
    }
    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CREATE)) {
        final CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(this.getCaseRef().getUuid());
        final ExpandableButton lineListingButton = new ExpandableButton(Captions.lineListing).expand(e -> ControllerProvider.getContactController().openLineListingWindow(caseDto));
        statusFilterLayout.addComponent(lineListingButton);
        final Button newButton = ButtonHelper.createIconButtonWithCaption(Captions.contactNewContact, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, Captions.contactNewContact), VaadinIcons.PLUS_CIRCLE, e -> ControllerProvider.getContactController().create(this.getCaseRef()), ValoTheme.BUTTON_PRIMARY);
        statusFilterLayout.addComponent(newButton);
        statusFilterLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
    }
    statusFilterLayout.addStyleName("top-bar");
    activeStatusButton = statusAll;
    return statusFilterLayout;
}
Also used : ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) Window(com.vaadin.ui.Window) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ContactDownloadUtil(de.symeda.sormas.ui.utils.ContactDownloadUtil) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) ShortcutAction(com.vaadin.event.ShortcutAction) UserRole(de.symeda.sormas.api.user.UserRole) UserProvider(de.symeda.sormas.ui.UserProvider) ValoTheme(com.vaadin.ui.themes.ValoTheme) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) Set(java.util.Set) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Collectors(java.util.stream.Collectors) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) ContactGrid(de.symeda.sormas.ui.contact.ContactGrid) ContactDto(de.symeda.sormas.api.contact.ContactDto) TextField(com.vaadin.v7.ui.TextField) Descriptions(de.symeda.sormas.api.i18n.Descriptions) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) StreamResource(com.vaadin.server.StreamResource) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) Label(com.vaadin.ui.Label) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) UserDto(de.symeda.sormas.api.user.UserDto) Captions(de.symeda.sormas.api.i18n.Captions) UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) LayoutUtil(de.symeda.sormas.ui.utils.LayoutUtil) HorizontalLayout(com.vaadin.ui.HorizontalLayout) CaseContactsImportLayout(de.symeda.sormas.ui.contact.importer.CaseContactsImportLayout) Strings(de.symeda.sormas.api.i18n.Strings) Collections(java.util.Collections) Window(com.vaadin.ui.Window) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) Label(com.vaadin.ui.Label) MenuBar(com.vaadin.ui.MenuBar) HorizontalLayout(com.vaadin.ui.HorizontalLayout) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) PopupButton(org.vaadin.hene.popupbutton.PopupButton) StreamResource(com.vaadin.server.StreamResource) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) CaseContactsImportLayout(de.symeda.sormas.ui.contact.importer.CaseContactsImportLayout) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 3 with PopupButton

use of org.vaadin.hene.popupbutton.PopupButton in project SORMAS-Project by hzi-braunschweig.

the class AbstractEpiCurveComponent method createFooter.

private HorizontalLayout createFooter() {
    HorizontalLayout epiCurveFooterLayout = new HorizontalLayout();
    epiCurveFooterLayout.setWidth(100, Unit.PERCENTAGE);
    epiCurveFooterLayout.setSpacing(true);
    CssStyles.style(epiCurveFooterLayout, CssStyles.VSPACE_4);
    // Grouping
    VerticalLayout groupingLayout = new VerticalLayout();
    {
        groupingLayout.setMargin(true);
        groupingLayout.setSizeUndefined();
        // Grouping option group
        OptionGroup groupingSelect = new OptionGroup();
        groupingSelect.setWidth(100, Unit.PERCENTAGE);
        groupingSelect.addItems((Object[]) EpiCurveGrouping.values());
        groupingSelect.setValue(epiCurveGrouping);
        groupingSelect.addValueChangeListener(e -> {
            epiCurveGrouping = (EpiCurveGrouping) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(groupingSelect);
        // "Always show at least 7 entries" checkbox
        CheckBox minimumEntriesCheckbox = new CheckBox(I18nProperties.getCaption(Captions.dashboardShowMinimumEntries));
        CssStyles.style(minimumEntriesCheckbox, CssStyles.VSPACE_NONE);
        minimumEntriesCheckbox.setValue(showMinimumEntries);
        minimumEntriesCheckbox.addValueChangeListener(e -> {
            showMinimumEntries = (boolean) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(minimumEntriesCheckbox);
    }
    PopupButton groupingDropdown = ButtonHelper.createPopupButton(Captions.dashboardGrouping, groupingLayout, CssStyles.BUTTON_SUBTLE);
    epiCurveFooterLayout.addComponent(groupingDropdown);
    epiCurveFooterLayout.setComponentAlignment(groupingDropdown, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(groupingDropdown, 1);
    // Epi curve mode
    AbstractComponent epiCurveModeSelector = createEpiCurveModeSelector();
    epiCurveFooterLayout.addComponent(epiCurveModeSelector);
    epiCurveFooterLayout.setComponentAlignment(epiCurveModeSelector, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(epiCurveModeSelector, 0);
    return epiCurveFooterLayout;
}
Also used : Date(java.util.Date) CheckBox(com.vaadin.v7.ui.CheckBox) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) DateHelper(de.symeda.sormas.api.utils.DateHelper) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Captions(de.symeda.sormas.api.i18n.Captions) HighChart(de.symeda.sormas.ui.highcharts.HighChart) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) OptionGroup(com.vaadin.v7.ui.OptionGroup) DashboardDataProvider(de.symeda.sormas.ui.dashboard.DashboardDataProvider) List(java.util.List) Button(com.vaadin.ui.Button) AbstractComponent(com.vaadin.ui.AbstractComponent) CssStyles(de.symeda.sormas.ui.utils.CssStyles) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Label(com.vaadin.ui.Label) VaadinIcons(com.vaadin.icons.VaadinIcons) Strings(de.symeda.sormas.api.i18n.Strings) EpiCurveGrouping(de.symeda.sormas.api.dashboard.EpiCurveGrouping) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) AbstractComponent(com.vaadin.ui.AbstractComponent) OptionGroup(com.vaadin.v7.ui.OptionGroup) PopupButton(org.vaadin.hene.popupbutton.PopupButton) CheckBox(com.vaadin.v7.ui.CheckBox) EpiCurveGrouping(de.symeda.sormas.api.dashboard.EpiCurveGrouping) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 4 with PopupButton

use of org.vaadin.hene.popupbutton.PopupButton in project SORMAS-Project by hzi-braunschweig.

the class ContactsEpiCurveComponent method createEpiCurveModeSelector.

@Override
protected PopupButton createEpiCurveModeSelector() {
    if (epiCurveContactsMode == null) {
        epiCurveContactsMode = ContactsEpiCurveMode.FOLLOW_UP_STATUS;
        epiCurveLabel.setValue(I18nProperties.getCaption(Captions.dashboardFollowUpStatusChart));
    }
    VerticalLayout groupingLayout = new VerticalLayout();
    groupingLayout.setMargin(true);
    groupingLayout.setSizeUndefined();
    PopupButton dataDropdown = ButtonHelper.createPopupButton(Captions.dashboardData, groupingLayout, CssStyles.BUTTON_SUBTLE);
    OptionGroup dataSelect = new OptionGroup();
    dataSelect.setWidth(100, Unit.PERCENTAGE);
    dataSelect.addItems((Object[]) ContactsEpiCurveMode.values());
    dataSelect.setValue(epiCurveContactsMode);
    dataSelect.select(epiCurveContactsMode);
    dataSelect.addValueChangeListener(e -> {
        epiCurveContactsMode = (ContactsEpiCurveMode) e.getProperty().getValue();
        switch(epiCurveContactsMode) {
            case FOLLOW_UP_STATUS:
                epiCurveLabel.setValue(I18nProperties.getCaption(Captions.dashboardFollowUpStatusChart));
                break;
            case CONTACT_CLASSIFICATION:
                epiCurveLabel.setValue(I18nProperties.getCaption(Captions.dashboardContactClassificationChart));
                break;
            case FOLLOW_UP_UNTIL:
                epiCurveLabel.setValue(I18nProperties.getCaption(Captions.dashboardFollowUpUntilChart));
                break;
        }
        clearAndFillEpiCurveChart();
    });
    groupingLayout.addComponent(dataSelect);
    return dataDropdown;
}
Also used : OptionGroup(com.vaadin.v7.ui.OptionGroup) PopupButton(org.vaadin.hene.popupbutton.PopupButton) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 5 with PopupButton

use of org.vaadin.hene.popupbutton.PopupButton in project SORMAS-Project by hzi-braunschweig.

the class ExternalJournalUtil method createSymptomJournalOptionsButton.

private static Button createSymptomJournalOptionsButton(PersonDto person) {
    VerticalLayout popupLayout = new VerticalLayout();
    popupLayout.setSpacing(true);
    popupLayout.setMargin(true);
    popupLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
    PopupButton ediaryButton = ButtonHelper.createPopupButton(I18nProperties.getCaption(Captions.symptomJournalOptionsButton), popupLayout, ValoTheme.BUTTON_PRIMARY);
    Button.ClickListener openListener = clickEvent -> {
        openSymptomJournalWindow(person);
        ediaryButton.setPopupVisible(false);
    };
    // TODO: implement cancel for PIA
    Button.ClickListener cancelListener = clickEvent -> {
        showForceDeletionPrompt(I18nProperties.getString(Strings.messageDeletionUnsupportedByExternalJournalWarning), person);
    };
    Button cancelButton = ButtonHelper.createButton(I18nProperties.getCaption(Captions.cancelExternalFollowUpButton), cancelListener, ValoTheme.BUTTON_PRIMARY);
    Button openButton = ButtonHelper.createButton(I18nProperties.getCaption(Captions.openInSymptomJournalButton), openListener, ValoTheme.BUTTON_PRIMARY);
    popupLayout.addComponent(cancelButton);
    popupLayout.addComponent(openButton);
    return ediaryButton;
}
Also used : ThemeResource(com.vaadin.server.ThemeResource) StreamResource(com.vaadin.server.StreamResource) SormasToSormasShareableDto(de.symeda.sormas.api.sormastosormas.SormasToSormasShareableDto) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) VerticalLayout(com.vaadin.ui.VerticalLayout) UI(com.vaadin.ui.UI) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Window(com.vaadin.ui.Window) BrowserFrame(com.vaadin.ui.BrowserFrame) StringUtils(org.apache.commons.lang3.StringUtils) PatientDiaryResult(de.symeda.sormas.api.externaljournal.patientdiary.PatientDiaryResult) PersonDto(de.symeda.sormas.api.person.PersonDto) LinkedHashMap(java.util.LinkedHashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) Image(com.vaadin.ui.Image) SormasUI(de.symeda.sormas.ui.SormasUI) Map(java.util.Map) Element(org.jsoup.nodes.Element) Label(com.vaadin.ui.Label) ValoTheme(com.vaadin.ui.themes.ValoTheme) Validations(de.symeda.sormas.api.i18n.Validations) IOException(java.io.IOException) Sizeable(com.vaadin.server.Sizeable) Captions(de.symeda.sormas.api.i18n.Captions) StandardCharsets(java.nio.charset.StandardCharsets) UncheckedIOException(java.io.UncheckedIOException) Consumer(java.util.function.Consumer) Button(com.vaadin.ui.Button) HorizontalLayout(com.vaadin.ui.HorizontalLayout) SymptomJournalStatus(de.symeda.sormas.api.person.SymptomJournalStatus) Document(org.jsoup.nodes.Document) ExternalJournalValidation(de.symeda.sormas.api.externaljournal.ExternalJournalValidation) Optional(java.util.Optional) Jsoup(org.jsoup.Jsoup) ExternalJournalFacade(de.symeda.sormas.api.externaljournal.ExternalJournalFacade) Strings(de.symeda.sormas.api.i18n.Strings) InputStream(java.io.InputStream) PopupButton(org.vaadin.hene.popupbutton.PopupButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout)

Aggregations

PopupButton (org.vaadin.hene.popupbutton.PopupButton)13 Button (com.vaadin.ui.Button)9 VerticalLayout (com.vaadin.ui.VerticalLayout)9 HorizontalLayout (com.vaadin.ui.HorizontalLayout)7 Label (com.vaadin.ui.Label)7 Captions (de.symeda.sormas.api.i18n.Captions)7 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)7 Strings (de.symeda.sormas.api.i18n.Strings)7 Window (com.vaadin.ui.Window)6 ValoTheme (com.vaadin.ui.themes.ValoTheme)6 FacadeProvider (de.symeda.sormas.api.FacadeProvider)6 VaadinIcons (com.vaadin.icons.VaadinIcons)5 StreamResource (com.vaadin.server.StreamResource)5 Alignment (com.vaadin.ui.Alignment)5 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)5 CssStyles (de.symeda.sormas.ui.utils.CssStyles)5 ContentMode (com.vaadin.shared.ui.ContentMode)4 UI (com.vaadin.ui.UI)4 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)4 UserProvider (de.symeda.sormas.ui.UserProvider)4