NullPointerEx on adding @Persist to property for parameter selected for palette

2009-11-12 Thread Elisabeth Adler

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 GenericValueEncoderCrop(manager.getAllCrops(),
   name, propertyAccess);
}

public Object getCropsModel()  {
   return new GenericSelectModelCrop(manager.getAllCrops(), 
Crop.class,

   name, id, propertyAccess);
}

I added the property for the selected values:
@Property
private ListCrop 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 ListCrop 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


Re: NullPointerEx on adding @Persist to property for parameter selected for palette

2009-11-12 Thread Thiago H. de Paula Figueiredo
Em Thu, 12 Nov 2009 21:26:46 -0200, Elisabeth Adler  
elisabeth.ad...@gmail.com escreveu:



Hi,


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.


That's a very old version . . .


I get the following NullPointerException:
Caused by: java.lang.NullPointerException
at  
org.apache.tapestry.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:49)


I've seen this error before when there's some value in the selected list  
that isn't available in the model. Also make sure the Crop class has a  
good equals() method.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.

http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: NullPointerEx on adding @Persist to property for parameter selected for palette

2009-11-12 Thread Elisabeth Adler

Hi,
The equals() method in Crop was missing alltogether. Implementing it was 
doing the trick.

Thanks a mil!
Elisabeth

Thiago H. de Paula Figueiredo wrote:
Em Thu, 12 Nov 2009 21:26:46 -0200, Elisabeth Adler 
elisabeth.ad...@gmail.com escreveu:



Hi,


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.


That's a very old version . . .


I get the following NullPointerException:
Caused by: java.lang.NullPointerException
at 
org.apache.tapestry.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:49) 



I've seen this error before when there's some value in the selected 
list that isn't available in the model. Also make sure the Crop class 
has a good equals() method.




-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org