Hi,
Please see the attachment.
I modified the sample code com.vaadin.demo.sampler.features.upload.UploadWithProgressMonitoringExample.java and want to display upload state in a modal window. It looks like the window of the state information couldn’t pop up immediately after call getMainWindow().addWindow():
upload.addListener(new Upload.StartedListener() {
public void uploadStarted(StartedEvent event) {
// Gets file properties
String filename = event.getFilename();
if (filename == null || !filename.toLowerCase().endsWith("txt")) {
// interrupt upload process and display error message
upload.interruptUpload();
WinUploadProgress winMessage = new WinUploadProgress(upload);
winMessage.setFileName(filename);
winMessage.setVisible(false);
winMessage.setState("Error");
winMessage.setMessage("Please upload a text file (*.txt).");
getMainWindow().addWindow(winMessage);
} else {
winMessage = new WinUploadProgress(upload);
winMessage.setFileName(filename);
getMainWindow().addWindow(winMessage);
}
}
});
The state window can only be displayed after the upload process is completed. So, no updated information can be seen during file uploading like the original vaadin demo.
I may wonder whether these updated information can be displayed in a modal window and how.
11349.java (5.58 KB)
11350.java (3.39 KB)