You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Victor Igumnov (JIRA)" <ji...@apache.org> on 2008/02/14 18:53:08 UTC
[jira] Created: (WICKET-1345) Link#onClick does not fire in
specific case.
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
Priority: Critical
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.
[jira] Assigned: (WICKET-1345) Link#onClick does not fire in
specific case.
Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johan Compagner reassigned WICKET-1345:
---------------------------------------
Assignee: Johan Compagner
But is isVisble() called?
And why does isVisible then in an repeater returns false?
Can you make a quickstart for this so that i can quickly see what is exactly happening?
> 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
>
> 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.
[jira] Resolved: (WICKET-1345) Link#onClick does not fire in
specific case.
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (WICKET-1345) Link#onClick does not fire in
specific case.
Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Frank Bille Jensen updated WICKET-1345:
---------------------------------------
Fix Version/s: (was: 1.3.3)
> 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
>
> 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.