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;
}
Aggregations