Odd Upload behavior causes my views to switch

Okay, it’s no doubt a bug of mine, but I’m wondering what I might be doing to have my Upload component sometimes causes my views to switch. That is, I seem to get a Vaadin request to change my view (fragment). It mostly happens when I interrupt the upload either because of an unexpected MIME type or the file is too big, but I’ve seen it even when the upload succeeds.

Here’s some trace info I have:

[size=1]
[font=Courier New]
16:21:47,969 onRequestStart() requestUrl: /demo/vaadin/UIDL?windowName=main; hostIp: 50.46.124.56; useragent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16; isUserLoggedIn: true
16:21:47,973 onRequestEnd()

16:21:48,029 onRequestStart() requestUrl: /demo/vaadin/APP/UPLOAD/PID183/action/07dc4523-504f-4ab3-9d58-0e4f96b9ac30; hostIp: 50.46.124.56; useragent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16; isUserLoggedIn: true
16:21:48,301 onRequestEnd()

16:21:48,389 onRequestStart() requestUrl: /demo/vaadin/UIDL?windowName=main; hostIp: 50.46.124.56; useragent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16; isUserLoggedIn: true
16:21:48,393 LibraryProgrammingNavigationTree itemClicked - label: Property sets; viewFragment: LibPropertySetAndVersionsMainView
2011-04-19 16:21:48,393 onRequestEnd()
[/font]
[/size]

The last UIDL request is the one that appears to simulate an item clicked event on my navigation tree, but I did not do any such click. The navigation works normally under other circumstances.

It seems to occur most frequently when I interrupt the upload via “upload.interruptUpload()”.

Any thoughts on how I might catch what is going wrong?
EDIT: Using Vaadin 6.5.6. I’m also using ProgressIndicator. I noted that on some occasions I’m not stopping that after an upload, too, so perhaps they are related. I’ll check to see what it means to create, start and stop the progress indicator since it has its own polling and maybe is causing the interference???!?

EDIT: I’m having a hard time reproducting this reliably, but I have noted that sometimes the polling ProgressIndicator doesn’t seem to turn itself off even though I attempt to. I have methods that turn it on and off based on the upload starting/ending, and I can see that they are being called, but sometimes the polling continues at the faster 500MSEC rate even though my code tries to reset it. So part of the problem may be that ProgressIndicator is not working correctly, or I’m not using it correctly (can it be re-used over and over if I’m uploading new files one after another?).

Here’s what I have (the processingLayout is just a HorizontalLayout that contains the ProgressIndicator and a cancel Button):

	void enableProgressIndicator() {
		progressIndicator.setEnabled(true);
		progressIndicator.setPollingInterval(500); // hit server more frequently (default is 1000 = 1sec)
		processingLayout.setVisible(true);
	}

	void disableProgressIndicator() {
		progressIndicator.setEnabled(false);
		progressIndicator.setPollingInterval(2000); // reset to default
		processingLayout.setVisible(false);
	}

I did some debugging on this using FF so I could trace the communications for the “bad uploads” in which the navigation click was being detected.

On a good request, after the “data sent” POST with the response ([font=Courier New]

download handled [/font]) was received, there's one more POST to [font=Courier New] /vaadin/UIDL?windowName=main [/font] with this data:


71c6de6f-fb82-487a-b89c-53853bd43b8f

But on the “bad upload” that same POST contains:


71c6de6f-fb82-487a-b89c-53853bd43b8f6PID22clickedKeys1,289,207,false,false,false,false,8,-1,-1PID22clickEvents

So, I can see that a CLICK is in there, even though I don’t click on the navigation Tree at all.

But, I think what happens is that when the FILE BROWSE OPEN window appears, if I DOUBLE-CLICK to select+open the file, it will do the upload, but sometimes it appears that the extra click (pretty sure I’m not triple clicking) is being detected by Vaadin, and it just so happens that under the file browse window is my navigation area, and so it gets mapped to my having click that location.

Does that sound possible/likely?

I cannot reproduce the bug if I select the image with a click and then click the OPEN button instead of double-clicking the image to do both. And if I move the File Browse Open dialog away, I also can’t reproduce it with double-clicks, presumably because the click is not over anything clickable.


Of course, none of this resolves the ProgressIndicator that goes on polling even though the upload is done. I’ll check more into that now…

When the file chooser dialog is over my Tree, and I use double-clicks, I can produce the “extra click” bug. I even got an “Out of Sync” error. I noted that the extra click only seems to affect my Tree and my Table, but when I position over a button or checkbox, the button/checkbox never seems to get the extra click.

So, is there a way to prevent that double-click to choose+open a file to upload from reaching Vaadin? I can’t easily control users to tell them to either single click and click the Open button of the file chooser, or to move the file chooser dialog away from underlying areas to click.

EDITED: The ProgressIndicator issue of polling despite no upload going on still is there, especially when uploading a really big file that gets aborted.

Hi there
I hope you found any work around on double click on Tree , makes view out of sync. since I am facing same issue.

Thanks in advance.

An update by Artur on my ticket #7122 said:

Don’t see it as resolved, though, so don’t know if/when it’ll be fixed since #4120 goes back to Vaadin 6.2. Keepikng my fingers crossed!

Thanks for you update, I really appreciate it.

I’m having a problem with this as well. It took me a few days to realize why the view switched all of the sudden when I selected files for upload. I thought it had something to do with how fast I selected files and that the server couldn’t keep up, little did I know… =)

Are there any plans to solve this bug?

I’m thinking of adding a modal window to block the background when the file browser opens but I’m having trouble seeing how to initiate it when the user opens the dialogue, and also to automatically close it if the user would click “cancel”… =\

I’m having a similar problem with Table component on Win7 (Vaadin version 6.8.5, I also checked version 6.8.12). Everything is ok for Linux. I checked ticket #4120 and it looks like fixed. Maybe for my version changes were not merged. Could somebody check this?

The same issue on Vaadin 7.7.5