[ 
https://issues.apache.org/jira/browse/WICKET-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-1345.
-----------------------------------

       Resolution: Won't Fix
    Fix Version/s: 1.3.3

i am closing this one for now since we do not have a reproducible usecase. i am 
willing to bet that isvisible() on that link returns false just before we are 
about to execute onclick() and so we dont. seems to me like a problem with the 
implementation. we do not invoke onclick() on a link whose isvisible() returns 
false, simple as that.

> Link#onClick does not fire in specific case.
> --------------------------------------------
>
>                 Key: WICKET-1345
>                 URL: https://issues.apache.org/jira/browse/WICKET-1345
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.1
>         Environment: tested on freebsd jvm-1.6 and linux jvm-1.6
>            Reporter: Victor Igumnov
>            Assignee: Johan Compagner
>            Priority: Critical
>             Fix For: 1.3.3
>
>
> Here is the test case that triggers it.  
> LeaveGroupLink works *perfectly* if on a page as-is; it is  visible and 
> onClick() fires. However, if I add LeaveGroupLink to a repeater (listview), 
> the link is visible but onClick() does not fire. I scanned around the wicket 
> source and noticed a comment about component callback won't execute if 
> isVisible is false. So the component *renders* but onClick is never fired 
> when Link is in a repeater component.
> public class LeaveGroupLink extends Link {
>       private static final long serialVersionUID = 1L;
>       public LeaveGroupLink(final String id, final IModel model) {
>               super(id, model);
>       }
>       @Override
>       public void onClick() {
> // did some basic println message to see if it fired. No message displayed
>               WebAppSession sess = (WebAppSession) Session.get();
>               Group g = (Group) getModelObject();
>               sess.getGroupService().leaveGroup(g, sess.getUser());
>       }
>       @Override
>       public boolean isVisible() {
>               WebAppSession sess = (WebAppSession) Session.get();
>               Group g = (Group) getModelObject();
> // I made sure this turns true or false... not a service level issue.
>               return sess.getUser().getGroupMembership().contains(g);
>       }
> }
> Here is the work around that works in a repeater .
> public class LeaveGroupLink extends Link {
>       private static final long serialVersionUID = 1L;
>       public LeaveGroupLink(final String id, final IModel model) {
>               super(id, model);
>       }
>       @Override
>       public void onClick() {
> // did some basic println message to see if it fired. No message displayed
>               WebAppSession sess = (WebAppSession) Session.get();
>               Group g = (Group) getModelObject();
>               sess.getGroupService().leaveGroup(g, sess.getUser());
>       }
>       @Override
>       protected void onBeforeRender() {
>               super.onBeforeRender();
>               WebAppSession sess = (WebAppSession) Session.get();
>               Group g = (Group) getModelObject();
>               setVisible(sess.getUser().getGroupMembership().contains(g));
>       }
> }
> If I use it like this, it works correctly in the repeater. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to