Hi,

I rewrote the Choice implementation (All the variations of the <select> tag)

We had a IChoiceList and a default implementation where you had to create IChoice wrappers around youre objects.
These 2 interfaces and default implementations are all gone now.
So this is a pretty big api change hopefully for the better, we did get a lot of request how a Choice really should work.

Now it is all much simpler.. 3 kind of calls now:


new DropDownChoice("users",new Model(selectedUser),listOfUsers)
Makes a DropDownChoice of users and the display value will be toString() and the id the index of the object in the ListOfUsers

new DropDownChoice("users",new Model(selectedUser),new ChoiceRenderer("name"),listOfUsers) Makes a DropDownChoice of users and the display value will be looked up by ognl ("name") and the id the index of the object in the ListOfUsers

new DropDownChoice("users",new Model(selectedUser),new ChoiceRenderer("name","id"),listOfUsers) Makes a DropDownChoice of users and the display value will be looked up by ognl ("name")
  and the id will be looked up by the  ognl expression "id"


I have to look at the selected object a bit, because this has to be slightly altered now also
for example:

   protected boolean isSelected(final Object object, int index)
   {
       final String value = getValue();
return value != null && value.equals(getChoiceRenderer().getIdValue(object, index));
   }


that getValue() does a getModelAsString() and if it is a User object this shouldn't happen! because what do you get then?
and then we compare it against the id value of the given object..

I think it just should be something like this:

   protected boolean isSelected(final Object object, int index)
   {
       final Object value = getModelObject()
       return value != null && value.equals(object);
   }

only then it doesn't check for invalid input...

johan



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to