Re: FileDownload hides the activity indicator
Hi Ernesto, I have it like as following. @Override public void onSubmit(final AjaxRequestTarget target, Form form) { // The veil and the activity indicator are already on when the code gets here String backupFileNameOnServer = null; try { backupFileNameOnServer = startBackup(parentPage); } catch (Exception e) { BackupTabPanel.logger.error(e); parentPage.getSession().error(e.getMessage()); target.add(parentPage.getFeedback()); } // setup for file download File sourceFile = new File(backupFileNameOnServer); String downloadFileName = "backup_config_" + getServerName() + "_" + getTime() + ".tar"; backupFileDownLoadBehaviour.initiate(sourceFile, downloadFileName, target); // after this the AjaxFileDownloadBehaviour#onResponse is called // then AjaxFileDownloadBehaviour#downloadFile (overridden in the local instance) is called // The veil and the activity indicator are gone by the time code hits AjaxFileDownloadBehaviour#onResponse. } I did not need to use another thread. Please let me know if you see any issues with this. Or a better way of doing this. Much appreciate your help. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666259.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi, For some reason google mail always send your messages to my spam folder... Answers inline On Thu, Jun 12, 2014 at 7:27 PM, msalman wrote: > Ernesto, > > Well the change seems to work. I am using a button that shows an activity > indicator with a veil for the request. So now that activity indicator and > veil is shown while the file is generated. But they go away when the file > is downloaded and the user can start clicking the button again. When the > file download is completed the requests for previous clicks start again. > I do not follow you. My advise was: 1- Generate file in a different thread. 2- Add and AJAX timer that checks for file generation completion. 3- Once file generation is completed. Use same AJAX request to unblock the UI and triigger download. > > BTW, I just realized that my code is actually based on your code on > > https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow > > > Thanks for putting it up. Really helpful. > That was the idea of creating the page. By the way, many others contributed to make this example better. > > May be you can update it so that it will take care of the problem that I > have. That is showing the activity indicator during the complete file > generation and download. > There are many ways to do that in Wicket. Adding that to the page would just bloat the solution maybe just creating a different example illustration the approach mentioned above will be useful. > > Thanks again. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666241.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
Re: FileDownload hides the activity indicator
Ernesto, Well the change seems to work. I am using a button that shows an activity indicator with a veil for the request. So now that activity indicator and veil is shown while the file is generated. But they go away when the file is downloaded and the user can start clicking the button again. When the file download is completed the requests for previous clicks start again. BTW, I just realized that my code is actually based on your code on https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow Thanks for putting it up. Really helpful. May be you can update it so that it will take care of the problem that I have. That is showing the activity indicator during the complete file generation and download. Thanks again. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666241.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi, On Wed, Jun 11, 2014 at 8:21 PM, msalman wrote: > > Hi Ernesto, > > Generating the file first and then triggering the download sounds like a > good idea. I think at least while the file is being generated the activity > indicator will show. > Good so. You shouldn't do anything taking longer than a few seconds in a WEB thread: think that by doing that you might deplete the thread pool of your server as the thread will be busy generating the document and will not be used to service other requests. > > I will try this. > > Thanks. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666212.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
Re: FileDownload hides the activity indicator
Hi Ernesto, Generating the file first and then triggering the download sounds like a good idea. I think at least while the file is being generated the activity indicator will show. I will try this. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666212.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi, On Wed, Jun 11, 2014 at 6:30 PM, msalman wrote: > Hi Ernesto, > > Thank you for your quick response. But I think I did not explain the > problem that I am trying to solve. What is happening in my case is that > when I click the IndicatingAjaxButton to start the file download, the > activity indicator (that twirling round thing) appears. But it then > disappears very quickly just when the code starts generating and > downloading > the file. All this while, without the activity indicator, the user does > not > know if any thing is happening and so may click the button again and again. > This is exactly what the articles I sent explain: it seems there is no hook for detecting downloading been triggered/finished. I did not read them but I think they proposed a workaround. http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx Another possibility is: 1- Generate the file 2- Once it is ready trigger the download. I.e. poll the server to see if generation finished. Then use polling ajax request to trigger download. > The solutions that you have sent me the links to, are for problems relating > to the GUI not being responsive after the file has been downloaded. I do > not have that problem. I just don't want the user to click the button > again > while the file is being downloaded. > > Also, unfortunately other than Wicket and simple html, I do not know much > about other GUI tools including Javascript. So I would appreciate very > much > if you can provide me with a solution that I can easily use in wickets. > > I do not promise anything as I'm rather busy at the moment... but let me see if I can come up with an example. > Again, thanks so much for your response. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666209.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
Re: FileDownload hides the activity indicator
Hi Ernesto, Thank you for your quick response. But I think I did not explain the problem that I am trying to solve. What is happening in my case is that when I click the IndicatingAjaxButton to start the file download, the activity indicator (that twirling round thing) appears. But it then disappears very quickly just when the code starts generating and downloading the file. All this while, without the activity indicator, the user does not know if any thing is happening and so may click the button again and again. The solutions that you have sent me the links to, are for problems relating to the GUI not being responsive after the file has been downloaded. I do not have that problem. I just don't want the user to click the button again while the file is being downloaded. Also, unfortunately other than Wicket and simple html, I do not know much about other GUI tools including Javascript. So I would appreciate very much if you can provide me with a solution that I can easily use in wickets. Again, thanks so much for your response. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666209.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
1- http://stackoverflow.com/questions/683571/jquery-blockui-how-to-unblock-ui-after-file-download 2- http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx 3-http://hasselba.ch/blog/?p=1274 On Wed, Jun 11, 2014 at 1:44 AM, msalman wrote: > Hi, > > I have code that downloads file in Ajax mode. The download is fired by > IndicatingAjaxButton. The activity indicator is visible for a very short > time but when file download code starts the activity indicator vanishes. > It > is a big problem if the file takes a long time to download. Any ideas > about > how to fix it? I am attaching a quick start for the test code. > > > ajaxfileDownload.zip > < > http://apache-wicket.1842946.n4.nabble.com/file/n4666181/ajaxfileDownload.zip > > > > As always, I would appreciate any help in fixing this issue. > > Thanks, > > -msalman > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
FileDownload hides the activity indicator
Hi, I have code that downloads file in Ajax mode. The download is fired by IndicatingAjaxButton. The activity indicator is visible for a very short time but when file download code starts the activity indicator vanishes. It is a big problem if the file takes a long time to download. Any ideas about how to fix it? I am attaching a quick start for the test code. ajaxfileDownload.zip <http://apache-wicket.1842946.n4.nabble.com/file/n4666181/ajaxfileDownload.zip> As always, I would appreciate any help in fixing this issue. Thanks, -msalman -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org