On Fri, May 09, 2008 at 06:42:11PM -0700, Michael Mehrle wrote:
> Thanks for the input, John - but I the plot thickens here. It seems that
> there is actually a Wicket bug that needs to get fixed. After a lot of
> tinkering I figured out why I was getting this error. The VERY FIRST
> TIME my renderer is being called it actually calls getIdValue() with an
> Integer, not with the Object that I'm using. In my debugger I saw the
This isn't a bug. The integer is coming from your business model.
DropDownChoice calls getIdValue() with this value so it can pre-select
the correct option based on your current business object value.
I'll try explaining this again. Maybe this time it will click.
You give a DDC a model and a list of possible values. The type of object
returned by the model and the type of objects in the list *must* be the
same. You've already mentioned that your model returns an Integer, so
you *must* pass a list of Integers, not IntegerSelectChoice or anything
else.
If you want to display something different than the integer, you have to
implement some custom code in ChoiceRenderer.getDisplayValue(). Don't
get hung up on the idea that the value returned has to be a property of
the objects in your list. It can be anything, such as the
getString("period_" + object.toString()) in my example.
You are probably used to a Model2 framework like Struts, where you have
to create lists of key/value pair objects to render <select>s. No need
for such an artificial structure in Wicket.
Is the light coming on yet?
jk
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]