Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Thanks! -Tom Am 09.04.2010 10:55, schrieb Ernesto Reinaldo Barreiro: Hi Tom, Take a look at [1]...[4]. There I'm creating a thread each time the "long" running process is launched but maybe it would be more correct to use a thread pool or use scheduler like quartz for this task. Feel free to use/change the code there as it best suits your needs. Ernesto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Hi Tom, Take a look at [1]...[4]. There I'm creating a thread each time the "long" running process is launched but maybe it would be more correct to use a thread pool or use scheduler like quartz for this task. Feel free to use/change the code there as it best suits your needs. Ernesto References, 1- http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.web/src/com/antilia/web/export 2- http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.web/src/com/antilia/web/progress 3- http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.export/src/com/antilia/export/pdf 4- http://code.google.com/p/antilia/source/browse/#svn/trunk/com.antilia.export/src/com/antilia/export/excel On Fri, Apr 9, 2010 at 9:44 AM, Thomas Götz wrote: > Hi Ernesto, > > this sounds like a viable solution, I'd be glad if you could provide me > with some more details (e.g. code samples, if available). > > -Tom > > > Am 09.04.2010 09:39, schrieb Ernesto Reinaldo Barreiro: > > Hi Tom, >> >> What I do, for instance, when exporting files to PDF, Excel, etc, is start >> the process on a background thread, block the screen so that users can >> only >> wait or stop the process, and use an AJAX timer to get back to the server >> every few seconds to monitor the progress and display it as progress-bar. >> This seems to work fine for me but might not be the most efficient >> solution... I can give you more details if you want. >> >> Best, >> >> Ernesto >> >> On Fri, Apr 9, 2010 at 8:55 AM, Thomas Götz wrote: >> >> Thanks for all the hints so far, they are really helpful but ;) >>> >>> Well, I don't want to have busy indicators on different components, I'm >>> looking for a way to display status messages (like eg with jGrowl) during >>> the long-running process (triggered by AjaxButton). I guess the only way >>> to >>> achieve this is with a solution as stated by Nishant (involving some kind >>> of >>> JS polling) ... >>> >>> -Tom >>> >>> >>> Am 09.04.2010 08:48, schrieb Tomasz Dziurko: >>> >>> You should check visural-wicket project >>> (http://code.google.com/p/visural-wicket/) and live demo on http://visural-wicket-examples.appspot.com/app/ . In "submitters" there are some fancy looking "waiting" popup messages which could help. >>> - >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Ok, thanks for the hint, but the operations I make usually only take up to ~1min, so I guess this won't be an issue in my case. But you are right, one has to assure that the polling will stop upon completion of the background task. -Tom On 09.04.2010 at 10:28, Tim L Casey wrote: You have to watch session expiration. This type of polling, without end, will keep sessions alive indefinitely. I don’t have a cut and paste code, but look at AbstractAjaxTimerBehavior. tim -Original Message- From: Thomas Götz [mailto:t...@richmountain.de] Sent: Friday, April 09, 2010 12:44 AM To: users@wicket.apache.org Subject: Re: How to give feedback in long-running operation within AjaxButton.onSubmit()? Hi Ernesto, this sounds like a viable solution, I'd be glad if you could provide me with some more details (e.g. code samples, if available). -Tom Am 09.04.2010 09:39, schrieb Ernesto Reinaldo Barreiro: Hi Tom, What I do, for instance, when exporting files to PDF, Excel, etc, is start the process on a background thread, block the screen so that users can only wait or stop the process, and use an AJAX timer to get back to the server every few seconds to monitor the progress and display it as progress-bar. This seems to work fine for me but might not be the most efficient solution... I can give you more details if you want. Best, Ernesto On Fri, Apr 9, 2010 at 8:55 AM, Thomas Götz wrote: Thanks for all the hints so far, they are really helpful but ;) Well, I don't want to have busy indicators on different components, I'm looking for a way to display status messages (like eg with jGrowl) during the long-running process (triggered by AjaxButton). I guess the only way to achieve this is with a solution as stated by Nishant (involving some kind of JS polling) ... -Tom Am 09.04.2010 08:48, schrieb Tomasz Dziurko: You should check visural-wicket project (http://code.google.com/p/visural-wicket/) and live demo on http://visural-wicket-examples.appspot.com/app/ . In "submitters" there are some fancy looking "waiting" popup messages which could help. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: How to give feedback in long-running operation within AjaxButton.onSubmit()?
You have to watch session expiration. This type of polling, without end, will keep sessions alive indefinitely. I dont have a cut and paste code, but look at AbstractAjaxTimerBehavior. tim -Original Message- From: Thomas Götz [mailto:t...@richmountain.de] Sent: Friday, April 09, 2010 12:44 AM To: users@wicket.apache.org Subject: Re: How to give feedback in long-running operation within AjaxButton.onSubmit()? Hi Ernesto, this sounds like a viable solution, I'd be glad if you could provide me with some more details (e.g. code samples, if available). -Tom Am 09.04.2010 09:39, schrieb Ernesto Reinaldo Barreiro: > Hi Tom, > > What I do, for instance, when exporting files to PDF, Excel, etc, is start > the process on a background thread, block the screen so that users can only > wait or stop the process, and use an AJAX timer to get back to the server > every few seconds to monitor the progress and display it as progress-bar. > This seems to work fine for me but might not be the most efficient > solution... I can give you more details if you want. > > Best, > > Ernesto > > On Fri, Apr 9, 2010 at 8:55 AM, Thomas Götz wrote: > >> Thanks for all the hints so far, they are really helpful but ;) >> >> Well, I don't want to have busy indicators on different components, I'm >> looking for a way to display status messages (like eg with jGrowl) during >> the long-running process (triggered by AjaxButton). I guess the only way to >> achieve this is with a solution as stated by Nishant (involving some kind of >> JS polling) ... >> >>-Tom >> >> >> Am 09.04.2010 08:48, schrieb Tomasz Dziurko: >> >> You should check visural-wicket project >>> (http://code.google.com/p/visural-wicket/) and live demo on >>> http://visural-wicket-examples.appspot.com/app/ . In "submitters" >>> there are some fancy looking "waiting" popup messages which could >>> help. >>> >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Hi Ernesto, this sounds like a viable solution, I'd be glad if you could provide me with some more details (e.g. code samples, if available). -Tom Am 09.04.2010 09:39, schrieb Ernesto Reinaldo Barreiro: Hi Tom, What I do, for instance, when exporting files to PDF, Excel, etc, is start the process on a background thread, block the screen so that users can only wait or stop the process, and use an AJAX timer to get back to the server every few seconds to monitor the progress and display it as progress-bar. This seems to work fine for me but might not be the most efficient solution... I can give you more details if you want. Best, Ernesto On Fri, Apr 9, 2010 at 8:55 AM, Thomas Götz wrote: Thanks for all the hints so far, they are really helpful but ;) Well, I don't want to have busy indicators on different components, I'm looking for a way to display status messages (like eg with jGrowl) during the long-running process (triggered by AjaxButton). I guess the only way to achieve this is with a solution as stated by Nishant (involving some kind of JS polling) ... -Tom Am 09.04.2010 08:48, schrieb Tomasz Dziurko: You should check visural-wicket project (http://code.google.com/p/visural-wicket/) and live demo on http://visural-wicket-examples.appspot.com/app/ . In "submitters" there are some fancy looking "waiting" popup messages which could help. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Hi Tom, What I do, for instance, when exporting files to PDF, Excel, etc, is start the process on a background thread, block the screen so that users can only wait or stop the process, and use an AJAX timer to get back to the server every few seconds to monitor the progress and display it as progress-bar. This seems to work fine for me but might not be the most efficient solution... I can give you more details if you want. Best, Ernesto On Fri, Apr 9, 2010 at 8:55 AM, Thomas Götz wrote: > Thanks for all the hints so far, they are really helpful but ;) > > Well, I don't want to have busy indicators on different components, I'm > looking for a way to display status messages (like eg with jGrowl) during > the long-running process (triggered by AjaxButton). I guess the only way to > achieve this is with a solution as stated by Nishant (involving some kind of > JS polling) ... > > -Tom > > > Am 09.04.2010 08:48, schrieb Tomasz Dziurko: > > You should check visural-wicket project >> (http://code.google.com/p/visural-wicket/) and live demo on >> http://visural-wicket-examples.appspot.com/app/ . In "submitters" >> there are some fancy looking "waiting" popup messages which could >> help. >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Oh, I see... I got you wrong initially. Indeed, in this case.. the best solution is polling and upon subtask completion - output a jgrowl notification script. Alex Thomas Götz wrote: > > Ok, but this is *not* what I want to achieve, beggin' your pardon ;-) > The first messages should not display when starting the operation, but > when a certain sub-task is finished. Say, I iterate over a list in the > operation, and after each cycle I'd like to display a jGrowl message ... > > -Tom > > > Am 09.04.2010 09:05, schrieb Alex Objelean: >> That's all. Now ajaxIndicator DOM element to appear when ajax call will >> start and will disappear when it will complete. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://old.nabble.com/How-to-give-feedback-in-long-running-operation-within-AjaxButton.onSubmit%28%29--tp28182827p28188512.html Sent from the Wicket - User 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: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Ok, but this is *not* what I want to achieve, beggin' your pardon ;-) The first messages should not display when starting the operation, but when a certain sub-task is finished. Say, I iterate over a list in the operation, and after each cycle I'd like to display a jGrowl message ... -Tom Am 09.04.2010 09:05, schrieb Alex Objelean: That's all. Now ajaxIndicator DOM element to appear when ajax call will start and will disappear when it will complete. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
The IAjaxIndicatorAware interface fits perfectly with your need. All you have do, is: - create a DOM element which looks like jGrowl with 'loading' message and assign it an id (ex: id="ajaxIndicator") - your webPage should implement IAjaxIndicatorAware interface: public class MyWebPage extends WebPage implements IAjaxIndicatorAware { //... @Override public String getAjaxIndicatorMarkupId() { return "ajaxIndicator"; } //... } That's all. Now ajaxIndicator DOM element to appear when ajax call will start and will disappear when it will complete. Hope this was helpful. Alex Objelean Thomas Götz wrote: > > Thanks for all the hints so far, they are really helpful but ;) > > Well, I don't want to have busy indicators on different components, I'm > looking for a way to display status messages (like eg with jGrowl) > during the long-running process (triggered by AjaxButton). I guess the > only way to achieve this is with a solution as stated by Nishant > (involving some kind of JS polling) ... > > -Tom > > > Am 09.04.2010 08:48, schrieb Tomasz Dziurko: >> You should check visural-wicket project >> (http://code.google.com/p/visural-wicket/) and live demo on >> http://visural-wicket-examples.appspot.com/app/ . In "submitters" >> there are some fancy looking "waiting" popup messages which could >> help. >> > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://old.nabble.com/How-to-give-feedback-in-long-running-operation-within-AjaxButton.onSubmit%28%29--tp28182827p28188414.html Sent from the Wicket - User 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: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Thanks for all the hints so far, they are really helpful but ;) Well, I don't want to have busy indicators on different components, I'm looking for a way to display status messages (like eg with jGrowl) during the long-running process (triggered by AjaxButton). I guess the only way to achieve this is with a solution as stated by Nishant (involving some kind of JS polling) ... -Tom Am 09.04.2010 08:48, schrieb Tomasz Dziurko: You should check visural-wicket project (http://code.google.com/p/visural-wicket/) and live demo on http://visural-wicket-examples.appspot.com/app/ . In "submitters" there are some fancy looking "waiting" popup messages which could help. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
You should check visural-wicket project (http://code.google.com/p/visural-wicket/) and live demo on http://visural-wicket-examples.appspot.com/app/ . In "submitters" there are some fancy looking "waiting" popup messages which could help. -- Best Regards / Pozdrawiam, Tomasz Dziurko - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
The most simple way is to implement IAjaxIndicatorAware interface on the component wish to display the indicator. For instance, if your page implements this interface, you will have a generic indicator for all ajax requests inside your page. Also, you can be more specific by implementing this interface only on a panel or a form... depends on your use-case. Alex Thomas Götz wrote: > > Problem: > I have an AjaxButton that triggers a long-running operation when clicked. > I want to give feedback (in form of a javascript message) upon partial > completion of the operation, therefore I am using a jQuery notifications > plugin (http://www.programmingmind.com/contributions). > > So, what I do is the following: > > final Form form = new Form("form"); > add(form); > > form.add(new AjaxButton("button) { > @Override > protected void onSubmit(AjaxRequestTarget target, Form form) { > for(Object o : someList) { > // do somthing > target.appendJavascript(getJavascript()); > } > target.addComponent(form); > } > }); > > > ... but obviously, the Javascript messages are only display at the end of > the complete operation (after foreach loop has finished). So my question: > what should I do to get the messages displayed after each iteration? > >-Tom > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://old.nabble.com/How-to-give-feedback-in-long-running-operation-within-AjaxButton.onSubmit%28%29--tp28182827p28184788.html Sent from the Wicket - User 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: How to give feedback in long-running operation within AjaxButton.onSubmit()?
I think you may look into this package org.apache.wicket.extensions.ajax.markup.html.form.upload where upload progress-bar is implemented. You may do something like this. So, probably it sets a resource in session, Java part regularly updates the string resource. And JS keeps on polling this resource by using the URL to the resource provided to JS initializer and renders on UI. Anyone can correct me, if I am wrong. Just a suggestion. I am naive to Wicket. - Nishant On Fri, Apr 9, 2010 at 2:25 AM, Thomas Götz wrote: > I fear not. As far as I understand, getAjaxCallDecorator() decorates the > javascript with a custom script, which is executed immediately upon hitting > the button. What I want to achieve is displaying some status messaged during > the progress of my long-term operation ... > > -Tom > > > On 08.04.2010 at 20:58 Fernando Wermus wrote: > > > Does this resolve your problem? > > > > @Override > > > > protected IAjaxCallDecorator getAjaxCallDecorator() { > > > >return new AjaxCallDecorator() { > > > >private static final long serialVersionUID = 1L; > > > > @Override > > > > public CharSequence decorateScript(CharSequence script) { > > > > return YOUR JAVASCRIPT + script; > > > > } > > > >}; > > > > } > > > > On Thu, Apr 8, 2010 at 3:43 PM, Thomas Götz wrote: > > > >> Problem: > >> I have an AjaxButton that triggers a long-running operation when > clicked. I > >> want to give feedback (in form of a javascript message) upon partial > >> completion of the operation, therefore I am using a jQuery notifications > >> plugin (http://www.programmingmind.com/contributions). > >> > >> So, what I do is the following: > >> > >> final Form form = new Form("form"); > >> add(form); > >> > >> form.add(new AjaxButton("button) { > >> @Override > >> protected void onSubmit(AjaxRequestTarget target, Form form) { > >> for(Object o : someList) { > >> // do somthing > >> target.appendJavascript(getJavascript()); > >> } > >> target.addComponent(form); > >> } > >> }); > >> > >> > >> ... but obviously, the Javascript messages are only display at the end > of > >> the complete operation (after foreach loop has finished). So my > question: > >> what should I do to get the messages displayed after each iteration? > >> > >> -Tom > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > > > > > -- > > Fernando Wermus. > > > > www.linkedin.com/in/fernandowermus > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
I fear not. As far as I understand, getAjaxCallDecorator() decorates the javascript with a custom script, which is executed immediately upon hitting the button. What I want to achieve is displaying some status messaged during the progress of my long-term operation ... -Tom On 08.04.2010 at 20:58 Fernando Wermus wrote: > Does this resolve your problem? > > @Override > > protected IAjaxCallDecorator getAjaxCallDecorator() { > >return new AjaxCallDecorator() { > >private static final long serialVersionUID = 1L; > > @Override > > public CharSequence decorateScript(CharSequence script) { > > return YOUR JAVASCRIPT + script; > > } > >}; > > } > > On Thu, Apr 8, 2010 at 3:43 PM, Thomas Götz wrote: > >> Problem: >> I have an AjaxButton that triggers a long-running operation when clicked. I >> want to give feedback (in form of a javascript message) upon partial >> completion of the operation, therefore I am using a jQuery notifications >> plugin (http://www.programmingmind.com/contributions). >> >> So, what I do is the following: >> >> final Form form = new Form("form"); >> add(form); >> >> form.add(new AjaxButton("button) { >> @Override >> protected void onSubmit(AjaxRequestTarget target, Form form) { >> for(Object o : someList) { >> // do somthing >> target.appendJavascript(getJavascript()); >> } >> target.addComponent(form); >> } >> }); >> >> >> ... but obviously, the Javascript messages are only display at the end of >> the complete operation (after foreach loop has finished). So my question: >> what should I do to get the messages displayed after each iteration? >> >> -Tom >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > -- > Fernando Wermus. > > www.linkedin.com/in/fernandowermus - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to give feedback in long-running operation within AjaxButton.onSubmit()?
Does this resolve your problem? @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { private static final long serialVersionUID = 1L; @Override public CharSequence decorateScript(CharSequence script) { return YOUR JAVASCRIPT + script; } }; } On Thu, Apr 8, 2010 at 3:43 PM, Thomas Götz wrote: > Problem: > I have an AjaxButton that triggers a long-running operation when clicked. I > want to give feedback (in form of a javascript message) upon partial > completion of the operation, therefore I am using a jQuery notifications > plugin (http://www.programmingmind.com/contributions). > > So, what I do is the following: > > final Form form = new Form("form"); > add(form); > > form.add(new AjaxButton("button) { >@Override >protected void onSubmit(AjaxRequestTarget target, Form form) { >for(Object o : someList) { >// do somthing >target.appendJavascript(getJavascript()); >} >target.addComponent(form); >} > }); > > > ... but obviously, the Javascript messages are only display at the end of > the complete operation (after foreach loop has finished). So my question: > what should I do to get the messages displayed after each iteration? > > -Tom > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Fernando Wermus. www.linkedin.com/in/fernandowermus