possible bug in ComponentFeedBackPanel
ComponentFeedBackPanel called to org.apache.wicket.util.lang.Objects.equals to decide if there is a error message to show. The implementation of this method is the following, if (a == b) { return true; } if ((a != null) (b != null) a.equals(b)) { return true; } return false; For instance, a is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=460] while b is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=463] then this is returing false. This behavior only happens if the ComponentFeedBackPanel *is refreshed by ajax. ** * I develop another class to test if I was misunderstanding the problem, but it worked: package com.misPartidos.web.eventos.paneles; import org.apache.wicket.Component; import org.apache.wicket.feedback.FeedbackMessage; import org.apache.wicket.feedback.IFeedbackMessageFilter; import org.apache.wicket.markup.html.panel.FeedbackPanel; public class MyComponentFeedbackPanel extends FeedbackPanel { private static final long serialVersionUID = 1080609018238015083L; public MyComponentFeedbackPanel(String id, final Component filter) { super(id); setFilter(new IFeedbackMessageFilter(){ private static final long serialVersionUID = 3610826326194213455L; @Override public boolean accept(FeedbackMessage message) { final Component a=filter; final Component b=message.getReporter(); if (a == b) { return true; } if ((a!= null) (b != null) *a.getId().equals(b.getId()))* { return true; } return false; } }); } } I am just testing ids between a and b. Does anyone has expirienced this wrong behavior with ComponentFeedBackPanel in an ajax refreshed? thanks in advance. -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: possible bug in ComponentFeedBackPanel
Probably you are not refreshing the component but rather recreating it. Hence the different eclipse debugger id's. If this is inside a listview, setReuseItems(true) This behavior is most certainly not a bug in the Objects.equals(). Martijn On Wed, Mar 10, 2010 at 5:03 PM, Fernando Wermus fernando.wer...@gmail.com wrote: ComponentFeedBackPanel called to org.apache.wicket.util.lang.Objects.equals to decide if there is a error message to show. The implementation of this method is the following, if (a == b) { return true; } if ((a != null) (b != null) a.equals(b)) { return true; } return false; For instance, a is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=460] while b is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=463] then this is returing false. This behavior only happens if the ComponentFeedBackPanel *is refreshed by ajax. ** * I develop another class to test if I was misunderstanding the problem, but it worked: package com.misPartidos.web.eventos.paneles; import org.apache.wicket.Component; import org.apache.wicket.feedback.FeedbackMessage; import org.apache.wicket.feedback.IFeedbackMessageFilter; import org.apache.wicket.markup.html.panel.FeedbackPanel; public class MyComponentFeedbackPanel extends FeedbackPanel { private static final long serialVersionUID = 1080609018238015083L; public MyComponentFeedbackPanel(String id, final Component filter) { super(id); setFilter(new IFeedbackMessageFilter(){ private static final long serialVersionUID = 3610826326194213455L; �...@override public boolean accept(FeedbackMessage message) { final Component a=filter; final Component b=message.getReporter(); if (a == b) { return true; } if ((a!= null) (b != null) *a.getId().equals(b.getId()))* { return true; } return false; } }); } } I am just testing ids between a and b. Does anyone has expirienced this wrong behavior with ComponentFeedBackPanel in an ajax refreshed? thanks in advance. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: possible bug in ComponentFeedBackPanel
Martijn, I am recreating the components as you mentioned. But there is a line which I dont understand in Objects.equals, if ((a != null) (b != null) a.equals(b)) I look for the implementation of equals in class Component and other classes and I havent found any. Then this is equivalent to do a==b. Just for curiosity, Are there any component which has an implementation of equals? and, why is not enought to compare id between components in ComponentFeedbackMessageFilter.accept instead of Objects.equals? Because I think I cant have more than a component with the same id in same container. thanks On Wed, Mar 10, 2010 at 2:09 PM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Probably you are not refreshing the component but rather recreating it. Hence the different eclipse debugger id's. If this is inside a listview, setReuseItems(true) This behavior is most certainly not a bug in the Objects.equals(). Martijn On Wed, Mar 10, 2010 at 5:03 PM, Fernando Wermus fernando.wer...@gmail.com wrote: ComponentFeedBackPanel called to org.apache.wicket.util.lang.Objects.equals to decide if there is a error message to show. The implementation of this method is the following, if (a == b) { return true; } if ((a != null) (b != null) a.equals(b)) { return true; } return false; For instance, a is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=460] while b is [MarkupContainer [Component id = date]] and in eclipse variables appears as [DateTextField id=463] then this is returing false. This behavior only happens if the ComponentFeedBackPanel *is refreshed by ajax. ** * I develop another class to test if I was misunderstanding the problem, but it worked: package com.misPartidos.web.eventos.paneles; import org.apache.wicket.Component; import org.apache.wicket.feedback.FeedbackMessage; import org.apache.wicket.feedback.IFeedbackMessageFilter; import org.apache.wicket.markup.html.panel.FeedbackPanel; public class MyComponentFeedbackPanel extends FeedbackPanel { private static final long serialVersionUID = 1080609018238015083L; public MyComponentFeedbackPanel(String id, final Component filter) { super(id); setFilter(new IFeedbackMessageFilter(){ private static final long serialVersionUID = 3610826326194213455L; @Override public boolean accept(FeedbackMessage message) { final Component a=filter; final Component b=message.getReporter(); if (a == b) { return true; } if ((a!= null) (b != null) *a.getId().equals(b.getId()))* { return true; } return false; } }); } } I am just testing ids between a and b. Does anyone has expirienced this wrong behavior with ComponentFeedBackPanel in an ajax refreshed? thanks in advance. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Fernando Wermus. www.linkedin.com/in/fernandowermus