Search in sources :

Example 1 with ExportPropertyMetaInfo

use of de.symeda.sormas.api.importexport.ExportPropertyMetaInfo in project SORMAS-Project by hzi-braunschweig.

the class ExportConfigurationsGrid method buildButtonLayout.

private HorizontalLayout buildButtonLayout(ExportConfigurationDto config, List<ExportPropertyMetaInfo> availableProperties, boolean canEditOrDelete) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    Button btnExport;
    btnExport = ButtonHelper.createIconButtonWithCaption(config.getUuid() + "-download", null, VaadinIcons.DOWNLOAD, e -> {
        if (config.getUuid() != null) {
            exportCallback.accept(config);
        }
    }, ValoTheme.BUTTON_PRIMARY);
    layout.addComponent(btnExport);
    Button btnEdit = ButtonHelper.createIconButtonWithCaption(config.getUuid() + "-edit", null, VaadinIcons.EDIT, e -> {
        if (config.getUuid() != null) {
            ControllerProvider.getCustomExportController().openEditExportConfigurationWindow(this, config, availableProperties, I18nProperties.getCaption(Captions.exportEditExportConfiguration));
        }
    });
    btnEdit.setEnabled(canEditOrDelete);
    layout.addComponent(btnEdit);
    Button btnDelete = ButtonHelper.createIconButtonWithCaption(config.getUuid() + "-delete", null, VaadinIcons.TRASH, e -> {
        if (config.getUuid() != null) {
            FacadeProvider.getExportFacade().deleteExportConfiguration(config.getUuid());
            new Notification(null, I18nProperties.getString(Strings.messageExportConfigurationDeleted), Type.WARNING_MESSAGE, false).show(Page.getCurrent());
            reload(false);
        }
    });
    btnDelete.setEnabled(canEditOrDelete);
    layout.addComponent(btnDelete);
    return layout;
}
Also used : ValoTheme(com.vaadin.ui.themes.ValoTheme) ExportConfigurationCriteria(de.symeda.sormas.api.importexport.ExportConfigurationCriteria) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) ExportType(de.symeda.sormas.api.importexport.ExportType) Captions(de.symeda.sormas.api.i18n.Captions) HeightMode(com.vaadin.shared.ui.grid.HeightMode) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) Consumer(java.util.function.Consumer) ExportConfigurationDto(de.symeda.sormas.api.importexport.ExportConfigurationDto) List(java.util.List) Button(com.vaadin.ui.Button) Type(com.vaadin.ui.Notification.Type) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Notification(com.vaadin.ui.Notification) Page(com.vaadin.server.Page) VaadinIcons(com.vaadin.icons.VaadinIcons) Strings(de.symeda.sormas.api.i18n.Strings) ExportPropertyMetaInfo(de.symeda.sormas.api.importexport.ExportPropertyMetaInfo) Grid(com.vaadin.ui.Grid) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) Button(com.vaadin.ui.Button) Notification(com.vaadin.ui.Notification) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 2 with ExportPropertyMetaInfo

use of de.symeda.sormas.api.importexport.ExportPropertyMetaInfo in project SORMAS-Project by hzi-braunschweig.

the class ExportConfigurationEditLayout method buildCheckBoxGroups.

private int buildCheckBoxGroups(List<ExportPropertyMetaInfo> exportExportProperties) {
    checkBoxGroups = new HashMap<>();
    checkBoxes = new HashMap<>();
    int checkBoxCount = 0;
    for (ExportPropertyMetaInfo meta : exportExportProperties) {
        ExportGroupType groupType = meta.getExportGroupType();
        String property = meta.getPropertyId();
        if (!checkBoxGroups.containsKey(groupType)) {
            checkBoxGroups.put(groupType, new ArrayList<>());
        }
        String caption = meta.getCaption();
        CheckBox cb = new CheckBox(caption);
        if (!CollectionUtils.isEmpty(exportConfiguration.getProperties())) {
            cb.setValue(exportConfiguration.getProperties().contains(property));
        }
        checkBoxGroups.get(groupType).add(cb);
        checkBoxes.put(cb, property);
        checkBoxCount++;
    }
    return checkBoxCount;
}
Also used : ExportPropertyMetaInfo(de.symeda.sormas.api.importexport.ExportPropertyMetaInfo) ExportGroupType(de.symeda.sormas.api.importexport.ExportGroupType) CheckBox(com.vaadin.ui.CheckBox)

Example 3 with ExportPropertyMetaInfo

use of de.symeda.sormas.api.importexport.ExportPropertyMetaInfo in project SORMAS-Project by hzi-braunschweig.

the class CasesView method buildDetailedExportConfiguration.

private ExportConfigurationDto buildDetailedExportConfiguration() {
    ExportConfigurationDto config = ExportConfigurationDto.build(UserProvider.getCurrent().getUserReference(), ExportType.CASE);
    config.setProperties(ImportExportUtils.getCaseExportProperties(CaseDownloadUtil::getPropertyCaption, caseFollowUpEnabled, hasClinicalCourseRight, hasTherapyRight, FacadeProvider.getConfigFacade().getCountryLocale()).stream().map(ExportPropertyMetaInfo::getPropertyId).collect(Collectors.toSet()));
    return config;
}
Also used : CaseDownloadUtil(de.symeda.sormas.ui.utils.CaseDownloadUtil) ExportPropertyMetaInfo(de.symeda.sormas.api.importexport.ExportPropertyMetaInfo) ExportConfigurationDto(de.symeda.sormas.api.importexport.ExportConfigurationDto)

Example 4 with ExportPropertyMetaInfo

use of de.symeda.sormas.api.importexport.ExportPropertyMetaInfo in project SORMAS-Project by hzi-braunschweig.

the class EventsView method buildDetailedExportConfiguration.

private ExportConfigurationDto buildDetailedExportConfiguration() {
    ExportConfigurationDto config = ExportConfigurationDto.build(UserProvider.getCurrent().getUserReference(), null);
    boolean eventGroupFeatureEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_GROUPS);
    config.setProperties(ImportExportUtils.getEventExportProperties(EventDownloadUtil::getPropertyCaption, eventGroupFeatureEnabled, FacadeProvider.getConfigFacade().getCountryLocale()).stream().map(ExportPropertyMetaInfo::getPropertyId).collect(Collectors.toSet()));
    return config;
}
Also used : ExportPropertyMetaInfo(de.symeda.sormas.api.importexport.ExportPropertyMetaInfo) ExportConfigurationDto(de.symeda.sormas.api.importexport.ExportConfigurationDto) EventDownloadUtil(de.symeda.sormas.ui.utils.EventDownloadUtil)

Aggregations

ExportPropertyMetaInfo (de.symeda.sormas.api.importexport.ExportPropertyMetaInfo)4 ExportConfigurationDto (de.symeda.sormas.api.importexport.ExportConfigurationDto)3 VaadinIcons (com.vaadin.icons.VaadinIcons)1 Page (com.vaadin.server.Page)1 HeightMode (com.vaadin.shared.ui.grid.HeightMode)1 Button (com.vaadin.ui.Button)1 CheckBox (com.vaadin.ui.CheckBox)1 Grid (com.vaadin.ui.Grid)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Notification (com.vaadin.ui.Notification)1 Type (com.vaadin.ui.Notification.Type)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 FacadeProvider (de.symeda.sormas.api.FacadeProvider)1 Captions (de.symeda.sormas.api.i18n.Captions)1 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)1 Strings (de.symeda.sormas.api.i18n.Strings)1 ExportConfigurationCriteria (de.symeda.sormas.api.importexport.ExportConfigurationCriteria)1 ExportGroupType (de.symeda.sormas.api.importexport.ExportGroupType)1 ExportType (de.symeda.sormas.api.importexport.ExportType)1 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)1