Hi,
I am trying to get a palette working with simple pojos to be displayed
in the "available" list. I am working with Tapestry 5.0.11.
I defined my palette in the tml:
<t:palette encoder="cropsEncoder" model="cropsModel"
selected="selectedCrops"/>
I implemented the encoder and model:
public Object getCropsEncoder() {
return new GenericValueEncoder<Crop>(manager.getAllCrops(),
"name", propertyAccess);
}
public Object getCropsModel() {
return new GenericSelectModel<Crop>(manager.getAllCrops(),
Crop.class,
"name", "id", propertyAccess);
}
I added the property for the selected values:
@Property
private List<Crop> selectedCrops;
This is working fine. As soon as I now try to actually keep the selected
values in the "selected" list by adding @Persist to the property:
@Property
@Persist
private List<Crop> selectedCrops;
I get the following NullPointerException:
Caused by: java.lang.NullPointerException
at
org.apache.tapestry.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:49)
at
org.apache.tapestry.corelib.components.Palette$SelectedRenderer.render(Palette.java:145)
The "available" list is displayed correctly, and the error occurs only
when I select some items and move them over to the "selected" list.
Any ideas what I am missing?
thanks in advance,
Elisabeth