OK, I see.
You are right!

On Mon, Nov 16, 2015 at 9:48 PM, Sven Meier <[email protected]> wrote:

> Hi Martin,
>
> to my knowledge the usual pattern is to override #onConfigure() and set up
> the visibility and enabling of the component for the next rendering *and*
> the following 'ACTION phase':
>
>
> http://wicketinaction.com/2011/11/implement-wicket-component-visibility-changes-properly/
>
> Usually I don't see any need to override #canCallListenerInterface(),
> except in very special cases. I would not advice to override it
> lightheartedly.
>
> From Wayne's description I deduced that he used the 'old' pattern to
> override #isVisible(), which leads to ListenerInvocationNotAllowedException
> if the condition for visibility and/or enabling changes between rendering
> and the next incoming request.
>
> Regards
> Sven
>
>
>
> On 16.11.2015 21:38, Martin Grigorov wrote:
>
>> Hi Sven,
>>
>> What I'm saying is that Wicket uses Component#canCallListenerInterface()
>> to
>> decide whether the listener interface method could be executed or not.
>> See
>>
>> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/RequestListenerInterface.java#L207
>>
>> So overriding #onConfigure() won't help him because #onConfigure() is
>> called later, after successful #onClick().
>>
>> He needs to override #canCallListenerInterface() if he needs to call
>> onClick even on invisible/disabled component.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Nov 16, 2015 at 9:31 PM, Sven Meier <[email protected]> wrote:
>>
>> Hi Martin,
>>>
>>> I didn't understand your comment.
>>>
>>> Do you think Wayne might have overriden #canCallListenerInterface()?
>>>
>>> Regards
>>> Sven
>>>
>>>
>>>
>>> On 16.11.2015 19:32, Martin Grigorov wrote:
>>>
>>> Hi,
>>>>
>>>> Actually org.apache.wicket.Component#canCallListenerInterface() is
>>>> responsible for the ACTION phase.
>>>> #onConfigure() is called in the RENDER phase, i.e. after onClick().
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Mon, Nov 16, 2015 at 7:27 PM, Sven Meier <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>> this should work.
>>>>>
>>>>> Do you have #isVisible() or #isEnabled() overridden in one of the
>>>>> component's parents?
>>>>>
>>>>> Have fun
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>> On 16.11.2015 18:08, Wayne W wrote:
>>>>>
>>>>> Hi Sven,
>>>>>
>>>>>>
>>>>>> I tried overriding :
>>>>>>
>>>>>> @Override
>>>>>>
>>>>>> protected void onConfigure()
>>>>>>
>>>>>> {
>>>>>>
>>>>>> setVisible(documentModel.getObject().isLocked());
>>>>>>
>>>>>> super.onConfigure();
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> and removing the isVisible() override but I still get the same
>>>>>> exception.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
>>>>>> Component rejected interface invocationComponent: [Link [Component id
>>>>>> =
>>>>>> unlock2]] Listener: [RequestListenerInterface name=ILinkListener,
>>>>>> method=public abstract void
>>>>>> org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
>>>>>>
>>>>>> at org.apache.wicket.RequestListenerInterface.invoke(
>>>>>> RequestListenerInterface.java:212)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(
>>>>>> ListenerInterfaceRequestHandler.java:243)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>
>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(
>>>>>> ListenerInterfaceRequestHandler.java:236)
>>>>>>
>>>>>> at
>>>>>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(
>>>>>> RequestCycle.java:862)
>>>>>>
>>>>>> at org.apache.wicket.request.RequestHandlerStack.execute(
>>>>>> RequestHandlerStack.java:64)
>>>>>>
>>>>>> ....
>>>>>>
>>>>>>
>>>>>>
>>>>>> any ideas?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 16, 2015 at 4:54 PM, Sven Meier <[email protected]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>>> Would it be because wicket is checking boolean isVisible() when
>>>>>>>
>>>>>>> making this decision? (as we override the links isVisible()
>>>>>>>>
>>>>>>>>
>>>>>>>> indeed.
>>>>>>>
>>>>>>> You should override #onConfigure() and call #setVisible() instead of
>>>>>>> overriding #isVisible().
>>>>>>>
>>>>>>> Regards
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 16.11.2015 16:59, Wayne W wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>>> I have a org.apache.wicket.markup.html.link.Link within a page this
>>>>>>>> is
>>>>>>>> visible only if a certain criteria is met.
>>>>>>>>
>>>>>>>> If user A visits this page the changes the criteria the link is
>>>>>>>> visible.
>>>>>>>> The user can then click on the link for some other functionality.
>>>>>>>>
>>>>>>>> However I'm finding is User B (in a different session) visits the
>>>>>>>> same
>>>>>>>> page
>>>>>>>> and changes the criteria so that the link is no longer visible but
>>>>>>>> the
>>>>>>>> user
>>>>>>>> A still has this page open and user A then clicks on the link
>>>>>>>> a ListenerInvocationNotAllowedException is thrown which I just don't
>>>>>>>> understand.
>>>>>>>>
>>>>>>>> I would get it if user B somehow got the hit the url that represents
>>>>>>>> that
>>>>>>>> link, but why does this link component in another session throw the
>>>>>>>> exception? Would it be because wicket is checking boolean
>>>>>>>> isVisible()
>>>>>>>> when
>>>>>>>> making this decision? (as we override the links isVisible() to show
>>>>>>>> depending on the criteria.
>>>>>>>>
>>>>>>>> thanks
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to