Search in sources :

Example 1 with DocumentMultiFileUpload

use of de.symeda.sormas.ui.importer.DocumentMultiFileUpload in project SORMAS-Project by hzi-braunschweig.

the class DocumentListComponent method buildUploadButton.

private Button buildUploadButton(DocumentRelatedEntityType relatedEntityType, ReferenceDto entityRef) {
    VerticalLayout uploadLayout = new VerticalLayout();
    uploadLayout.setSpacing(true);
    uploadLayout.setMargin(true);
    uploadLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
    PopupButton mainButton = ButtonHelper.createIconPopupButton(Captions.documentUploadDocument, VaadinIcons.PLUS_CIRCLE, uploadLayout, ValoTheme.BUTTON_PRIMARY);
    boolean multipleUpload = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.DOCUMENTS_MULTI_UPLOAD);
    UploadStateWindow uploadStateWindow = new UploadStateWindow();
    MultiFileUpload multiFileUpload = new DocumentMultiFileUpload(() -> {
        mainButton.setButtonClickTogglesPopupVisibility(false);
        mainButton.setClosePopupOnOutsideClick(false);
    }, new DocumentUploadFinishedHandler(relatedEntityType, entityRef.getUuid(), documentList::reload), uploadStateWindow, multipleUpload);
    multiFileUpload.setUploadButtonCaptions(I18nProperties.getCaption(Captions.importImportData), I18nProperties.getCaption(Captions.importImportData));
    multiFileUpload.setAllUploadFinishedHandler(() -> {
        mainButton.setButtonClickTogglesPopupVisibility(true);
        mainButton.setClosePopupOnOutsideClick(true);
        mainButton.setPopupVisible(false);
    });
    uploadLayout.addComponentsAndExpand(multiFileUpload);
    return mainButton;
}
Also used : DocumentMultiFileUpload(de.symeda.sormas.ui.importer.DocumentMultiFileUpload) PopupButton(org.vaadin.hene.popupbutton.PopupButton) MultiFileUpload(com.wcs.wcslib.vaadin.widget.multifileupload.ui.MultiFileUpload) DocumentMultiFileUpload(de.symeda.sormas.ui.importer.DocumentMultiFileUpload) UploadStateWindow(com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateWindow) DocumentUploadFinishedHandler(de.symeda.sormas.ui.importer.DocumentUploadFinishedHandler) VerticalLayout(com.vaadin.ui.VerticalLayout)

Aggregations

VerticalLayout (com.vaadin.ui.VerticalLayout)1 MultiFileUpload (com.wcs.wcslib.vaadin.widget.multifileupload.ui.MultiFileUpload)1 UploadStateWindow (com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateWindow)1 DocumentMultiFileUpload (de.symeda.sormas.ui.importer.DocumentMultiFileUpload)1 DocumentUploadFinishedHandler (de.symeda.sormas.ui.importer.DocumentUploadFinishedHandler)1 PopupButton (org.vaadin.hene.popupbutton.PopupButton)1