On Sun, May 11, 2008 at 12:54 AM, smallufo <[EMAIL PROTECTED]> wrote:
> 2008/5/11 Maurice Marrink <[EMAIL PROTECTED]>:
>
>
>  > PropertyModel is aware of the IModel you are passing and unwraps it.
>  > So depending on what is inside your model you have different options:
>  > -the model contains an object x which has a city property:
>  >  make sure x has a getter and setter for city this will be used by the
>  > propertymodel
>  > -the model contains a city object:
>  >  do not use a propertymodel at all or use "" as the expression.
>  >
>
>  This (second) is my situation.
>  This is my custom model object extends Model , which has getCity() ,
>  setCity(...) methods.
>  If I don't use PropertyModel , what should I do ?

Ok so your model contains a city object. You can delete the
get/setCity methods on the model wicket code will not use them.
The get/setObject methods are used instead. You could even use the
default Model if your custom model does not do anything else.
And then do: new CityDropDownChoice("city" , model,
Arrays.asList(Cities.values()));
There is no need for a propertymodel there, since you are interested
in replacing the entire object.


>
>  And ... how to use "" as the expression ?
>  I tries this :
>  MyModel mymodel = (MyModel)model;
>
> CityDropDownChoice = new CityDropDownChoice("city" , new
>  PropertyModel(myModel.getCity() , ""));
>
>  It still doesn't work , the selected value is not set to myModel.
>

Just forget that, it needlessly makes things complex in your situation.



Maurice

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to