Take the 2-minute tour ×

I'm developing a web application using the Vaadin framework.

I'm using the Vaadin Upload component. For convenience we've decided to disable the upload button when a file is already being uploaded to the server.

And the thing is that the button looks disabled, but when clicked it still opens the file browser dialogue, letting the user specify additional files which won't be handled correctly.

During debug I've stopped inside of the Upload progressListener and seen that the Upload object has its Enabled parameter set to false, even so if I try clicking the disabled button in the GUI the dialogue will open..

I've tried searching if this is a recognized bug but haven't been able to find anything.

Some relevant code:

   //The first listener triggered when starting an upload, here the 
   // Upload component is set to disabled
    upload.addListener(new Upload.StartedListener() {
                public void uploadStarted(StartedEvent event) {
                    // this method gets called immediately after upload is started


    // Listener being triggered a number of times during the upload. 
    // Here is where I debugged, saw that the Upload component was 
    // disabled but found that I still could open the dialogue. 
            upload.addListener(new Upload.ProgressListener() {
                public void updateProgress(long readBytes, long contentLength) {


    // The last listener triggered, here the Upload component is 
    // set to enabled. The button now looks clickable but it behaves 
    // the same way as it does when the Upload component is disabled.
    upload.addListener(new Upload.FinishedListener() {
                public void uploadFinished(FinishedEvent event) {
                        upload.setEnabled(true);                }
share|improve this question

2 Answers 2

I never managed to solve the issue with the component but I solved the problem by having the Upload component in a dedicated container. When I initiated an upload I removed the component from the container and instead inserted a dummy replace button that looked the same and was disabled. Once the upload was complete I removed the dummy button and added the upload button again.

The problem is avoided using this method but I would agree if someone thought it was a quite rough solution to the problem...

share|improve this answer

This clearly sounds a bug in the Upload component and you should consider reporting it at http://dev.vaadin.com/.

In the meantime, the workaround suggested by AndroidHustle probably is the easiest one. Additionally, I'd suggest to pack this solution to a CustomComponent and go on writing the rest of the application and switch the implementation back to Upload when a fix is available.

share|improve this answer

Your Answer


