I did not know of this.. I have always used the IChoiceRenderer's getIdValue to distinguish between dropdown elements.. I have never overridden the modelcomparator.
I wonder... which way is the right way :) ** Martin 2009/1/8 walnutmon <[email protected]>: > > I have dropdowns that are filled with domain objects, and sometimes the > objects are not equivalent literally, but should be treated as such. I > created a subclass of the DropDownChoice... > > class RelaxedComparisonDropDown extends DropDownChoice > { ...constructor... > @Override > protected IModelComparator getModelComparator(){ > return new IModelComparator() { > public boolean compare(Component arg0, Object arg1){ > DomainMember member = > (DomainMember)arg0.getModelObject(); > DomainMember member1 = (DomainMember)arg1; > return member.getIdent().equals(member1.getIdent()); > } }; } } > > I then use this object in place of the drop down choice on my page. This > doesn't work. However, what's more puzzling is that when I test that page > it works just fine. As a final test I placed a system.out in the compare > function. The s.out gets called when running the test but not when the > application is deployed on my local server. > > Very very odd. I'm pretty much baffled, I hope someone can guide me in the > right direction. > -- > View this message in context: > http://www.nabble.com/Wicket-Not-Using-Custom-Model-Comparitor%3A-Very-Puzzling-Behavior-tp21357902p21357902.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]
