use of com.vaadin.flow.component.upload.Upload in project karnak by OsiriX-Foundation.
the class ProfileView method initUploadProfile.
private void initUploadProfile() {
memoryBuffer = new MemoryBuffer();
// https://github.com/vaadin/vaadin-upload-flow/blob/6fa9cc429e1d0894704fb962e0df375a9d0439c8/vaadin-upload-flow-integration-tests/src/main/java/com/vaadin/flow/component/upload/tests/it/UploadView.java#L122
uploadProfile = new Upload(memoryBuffer);
uploadProfile.setDropLabel(new Span("Drag and drop your profile here"));
}
use of com.vaadin.flow.component.upload.Upload in project karnak by OsiriX-Foundation.
the class ExternalIDView method setUploadCSVElement.
public void setUploadCSVElement() {
uploadCsvLabelDiv = new Div();
uploadCsvLabelDiv.setText("Upload the CSV file containing the external ID associated with patient(s): ");
uploadCsvLabelDiv.getStyle().set("font-size", "large").set("font-weight", "bolder");
MemoryBuffer memoryBuffer = new MemoryBuffer();
uploadCsvButton = new Upload(memoryBuffer);
uploadCsvButton.setDropLabel(new Span("Drag and drop your CSV file here"));
uploadCsvButton.addSucceededListener(event -> {
inputStream = memoryBuffer.getInputStream();
Dialog chooseSeparatorDialog = new Dialog();
TextField separatorCSVField = new TextField("Choose the separator for reading the CSV file");
separatorCSVField.setWidthFull();
separatorCSVField.setMaxLength(1);
separatorCSVField.setValue(",");
Button openCSVButton = new Button("Open CSV");
openCSVButton.addClickListener(buttonClickEvent -> {
chooseSeparatorDialog.close();
char separator = ',';
if (!separatorCSVField.getValue().equals("")) {
separator = separatorCSVField.getValue().charAt(0);
}
CSVDialog csvDialog = new CSVDialog(inputStream, separator, projectDropDown.getValue());
csvDialog.setWidth("80%");
csvDialog.open();
csvDialog.getReadCSVButton().addClickListener(buttonClickEvent1 -> {
externalIDGrid.addPatientList(csvDialog.getPatientsList());
checkDuplicatePatient();
csvDialog.resetPatientsList();
});
});
chooseSeparatorDialog.add(separatorCSVField, openCSVButton);
chooseSeparatorDialog.open();
separatorCSVField.focus();
});
}
use of com.vaadin.flow.component.upload.Upload in project projecte-dam-v2-equip2 by IESEBRE.
the class UploadView method initUploaderImage.
private void initUploaderImage() {
MemoryBuffer buffer = new MemoryBuffer();
upload = new Upload(buffer);
upload.setAcceptedFileTypes("image/jpeg", "image/jpg", "image/png", "image/gif");
upload.addSucceededListener(event -> {
try {
// The image can be jpg png or gif, but we store it always as png file in this example
BufferedImage inputImage = ImageIO.read(buffer.getInputStream());
ByteArrayOutputStream pngContent = new ByteArrayOutputStream();
ImageIO.write(inputImage, "png", pngContent);
saveProfilePicture(pngContent.toByteArray());
showImage();
} catch (IOException e) {
e.printStackTrace();
}
});
add(getContent(), imageContainer, upload);
}
use of com.vaadin.flow.component.upload.Upload in project flow-components by vaadin.
the class FileBufferView method createMultiFileUpload.
private static Div createMultiFileUpload() {
final MultiFileBuffer buffer = new MultiFileBuffer();
final Upload multiFileUpload = new Upload(buffer);
multiFileUpload.setId("multi-upload");
return setupUploadSection(multiFileUpload, e -> buffer.getInputStream(e.getFileName()));
}
use of com.vaadin.flow.component.upload.Upload in project flow-components by vaadin.
the class UploadI18nView method createFullUploadI18N.
private void createFullUploadI18N() {
MemoryBuffer buffer = new MemoryBuffer();
Upload upload = new Upload(buffer);
upload.setId("upload-full-i18n");
upload.setI18n(UploadTestsI18N.RUSSIAN_FULL);
add(new H1("Full I18N"), upload, new Hr());
}
Aggregations