Hi,

It won't be faster again.
Your best bet is to use plain JavaScript so that the table is disabled
before the Ajax call is even made to the server.
See AjaxRequestAttributes's onBeforeSend() method
(IndicatingAjaxButton#updateAjaxAttributes()).

Martin Grigorov
Wicket Training and Consulting


On Mon, Jan 13, 2014 at 1:16 PM, <christoph.ma...@t-systems.com> wrote:

> If I only add the behaviour to the button it is not fast enough. If the
> user clicks the button an sql-statement starts running which collects a lot
> of data. The delay between clicking the button and disabling the table is
> too big. That's why I want to do this in a parallel thead.
>
>
> Mit freundlichen Grüßen
> Christoph Manig
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Gesendet: Montag, 13. Januar 2014 12:10
> An: users@wicket.apache.org
> Betreff: Re: set RequestCycle in parallel Thread
>
> Why do you need o start a new thread? Is I might ask the question?
>
>
> On Mon, Jan 13, 2014 at 11:58 AM, <christoph.ma...@t-systems.com> wrote:
>
> > Hello,
> >
> > I want to add a new AjaxEventBehaviour to my IndicatingAjaxButton. I
> > do this the following way:
> >
> > public class TableDisabler implements Runnable{
> >
> >     private IndicatingAjaxButton button;
> >
> >     public TableDisabler (IndicatingAjaxButton button){
> >         this.button=button;
> >
> >     }
> >
> >     @Override
> >     public void run() {
> >         button.add(new AjaxEventBehavior("onClick") {
> >             @Override
> >             protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
> >                 CustomDataTable table =
> > (CustomDataTable)button.getPage().get("searchTable");
> >                 table.setEnabled(false);
> >                 ajaxRequestTarget.add(table);
> >
> >             }
> >         });
> >     }
> > }
> >
> > When the button is clicked I start this thread, but I get this exception:
> > Exception in thread "Thread-69" org.apache.wicket.WicketRuntimeException:
> > No RequestCycle is currently set!
> >         at org.apache.wicket.Component.getRequest(Component.java:1795)
> >         at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
> >         at org.apache.wicket.Page.dirty(Page.java:255)
> >         at org.apache.wicket.Page.componentStateChanging(Page.java:930)
> >         at
> org.apache.wicket.Component.addStateChange(Component.java:3519)
> >         at org.apache.wicket.Behaviors.add(Behaviors.java:55)
> >         at org.apache.wicket.Component.add(Component.java:4503)
> >         at
> >
> smw.console.frontend.components.support.TableDisabler.run(TableDisabler.java:18)
> >         at java.lang.Thread.run(Thread.java:722)
> > Exception in thread "Thread-70" org.apache.wicket.WicketRuntimeException:
> > No RequestCycle is currently set!
> >         at org.apache.wicket.Component.getRequest(Component.java:1795)
> >         at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
> >         at org.apache.wicket.Page.dirty(Page.java:255)
> >         at org.apache.wicket.Page.componentStateChanging(Page.java:930)
> >         at
> org.apache.wicket.Component.addStateChange(Component.java:3519)
> >         at org.apache.wicket.Behaviors.add(Behaviors.java:55)
> >         at org.apache.wicket.Component.add(Component.java:4503)
> >         at
> >
> smw.console.frontend.components.support.TableDisabler.run(TableDisabler.java:18)
> >         at java.lang.Thread.run(Thread.java:722)
> >
> > How can I set an RequestCycle in this Thread, so that the table will
> > be disabled if the button is clicked?
> >
> > Mit freundlichen Grüßen
> > Christoph Manig
> >
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to