On 2/7/08, Matthijs Wensveen <[EMAIL PROTECTED]> wrote:
> The if(!isEnabled()) will happen though, because the link is not really
> disabled on the client side, but it does prevent
> doSomeHeavyWeightProcessing to be called the second time which is what I
> need.
The problem is that the href of the link points to the old version of
the page, and that has the link still enabled.
Martijn
> What are the pros / cons of (ab)using setEnabled for this instead of
> just a member variable)?
>
> Thanks,
> Matthijs
>
> Timo Rantalaiho wrote:
> > On Wed, 06 Feb 2008, Matthijs Wensveen wrote:
> >
> >> I have a Link (not Ajax) on a component that does some heavyweight
> >> processing in onClick. During this processing I want to block other
> >> clicks from the same user. Is there a generic way to block multiple
> >> requests on the same link? I would prefer a solution without Ajax /
> >> JavaScript, but if that's impossible then that's okay.
> >>
> >
> > Components are stateful, so maybe you could just keep the
> > state in your Link?
> >
> > @Override onClick() {
> > if (!isEnabled()) {
> > return; // this shouldnt happen though?
> > }
> > try {
> > setEnabled(false);
> > doSomeHeavyWeightProcessing();
> > } finally {
> > setEnabled(true);
> > }
> > }
> >
> > This creates a little race condition but if you can produce
> > it you could try using a real lock mechanism.
> >
> > Best wishes,
> > Timo
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]