wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Stoch <daniel.st...@gmail.com>
Subject Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?
Date Tue, 17 Jun 2014 14:24:44 GMT
On Tue, Jun 17, 2014 at 4:14 PM, Sven Meier <sven@meiers.net> wrote:
> Hi,
>
> when you alter the enabled state in #onConfigure() - this is recommended
> instead of overriding #isEnabled() - the link will still be enabled when the
> next click comes in.

Hmmm, I think I don't understand :). The next click does not come
because exception is raised. If I catch exception and do nothing the
link is still enabled to user, because page is not rerendered,

> You can handle the changed system state in your application logic.

How?
The only solution I know is to auto-refresh a page (eg. using push),
but user can always click faster ;).

>
> Best regards
> Sven
>
>
> On 06/17/2014 03:55 PM, Daniel Stoch wrote:
>>
>> Hi,
>>
>> I have a link (or ajax link) which executes some system command. This
>> system gives me an information if this command is enabled or not, so I
>> can mark my link as enabled or disabled (by calling
>> setEnabled(command.isEnabled()) or overriding link.isEnabled()
>> method).
>>
>> 1. Page is being rendered, command is enabled so link is rendered as
>> enabled.
>> 2. In the meantime system state is changed so command became disabled.
>> 3. User clicks link on a page rendered in step 1 where link is
>> rendered as enabled but it is disabled now.
>>
>> In Wicket 1.4 nothing happens in such situation and only warning was
>> logged:
>> "component not enabled or visible; ignoring call. Component:
>> [MarkupContainer [Component id = link]]"
>>
>> In Wicket 6 in such situation the exception is raised:
>> "ListenerInvocationNotAllowedException: Behavior rejected interface
>> invocation."
>>
>> How should I handle this correctly to show some information to user,
>> that this is link is no longer active (but user should stay on the
>> same page)?
>> Should I catch ListenerInvocationNotAllowedException inside
>> IRequestCycleListener.onException()?
>>
>> --
>> Daniel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message