Well, IChoiceRenderer gives you ability to use any field of your custom
choice object for rendering. In order to select a choice before rendering
I'd implement custom choices IModel with additional method like: Object
getSelected(<T> key) to set selection model object properly. Then I use
DropDownCoice constructor that takes both models and renderer.



Vitaly Tsaplin wrote:
> 
> An index is a kind of a link between a value and its displayable
> representation. Having an index in getDisplayValue method we would do
> something like:
> 
>   List<Integer> lang_choices = Arrays.asList (new Object [] { 1, 2, 4, 8
> });
>   Object [] lang_labels = new Object [] { "php", "perl", "java", "c++" };
> 
>   public Object getDisplayValue (Object object, int index) {
>      return lang_labels [index];
>   }
> 
>   public String getValueId (Object object, int index) {
>      return String.valueOf (object);
>   }
> 
>   It should be more efficient then to do a map lookup for every
> option especially in case of a long option list.
> 
>   Personally I think that things could be more simple and logical
> with less faceless model. I mean having a model which is based on an
> interface (not a simple single object container) like in swing or
> tapestry would help.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p16114450.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]

Reply via email to