Re: select problem render queue
I tried to see what was in my selectmodel after the factory loading with this code : // initialize selectmodels selectType = selectModelFactory.create(typeClientList, nomType); ListOptionModel optionModelList = selectType.getOptions(); System.out.println(begin); for (OptionModel optionModel : optionModelList) { System.out.println(optionModel.getLabel()); System.out.println(optionModel.getValue()); } System.out.println(end); And in the console I see that I have exactly what I want and I don't see any Null in my selectmodel. @Bob : How do you resolved your problem ? Anyone alse to help me on this ? I'm stuck on thsi problem :( 2014-07-14 20:21 GMT+02:00 Bob Harner bobhar...@gmail.com: I haven't read through this thread very carefully, but last week I got a nearly identical stack trace. It was from Palette, not Select, but those components have a lot of identical code. In my case the problem was that the SelectModel had all of the expected values *except* the selected value. Tapestry didn't do a good job with the error messages in that case. On Fri, Jul 11, 2014 at 5:36 AM, squallmat . squall...@gmail.com wrote: When I do this : selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); each lists (typeClientList and applicatifList) are not empty. And for the second parameter, I put the variable name of a String of an object contained in the list, is this what have to be done ? 2014-07-10 16:57 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
If I read Bob right, I think Bob said his problem was not due to nulls, it was due to the selected value not being one of the values in the OptionModel. It might also be worth trying secure=literal:false on the Select. On 15 Jul 2014, at 5:59 pm, squallmat . squall...@gmail.com wrote: I tried to see what was in my selectmodel after the factory loading with this code : // initialize selectmodels selectType = selectModelFactory.create(typeClientList, nomType); ListOptionModel optionModelList = selectType.getOptions(); System.out.println(begin); for (OptionModel optionModel : optionModelList) { System.out.println(optionModel.getLabel()); System.out.println(optionModel.getValue()); } System.out.println(end); And in the console I see that I have exactly what I want and I don't see any Null in my selectmodel. @Bob : How do you resolved your problem ? Anyone alse to help me on this ? I'm stuck on thsi problem :( 2014-07-14 20:21 GMT+02:00 Bob Harner bobhar...@gmail.com: I haven't read through this thread very carefully, but last week I got a nearly identical stack trace. It was from Palette, not Select, but those components have a lot of identical code. In my case the problem was that the SelectModel had all of the expected values *except* the selected value. Tapestry didn't do a good job with the error messages in that case. On Fri, Jul 11, 2014 at 5:36 AM, squallmat . squall...@gmail.com wrote: When I do this : selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); each lists (typeClientList and applicatifList) are not empty. And for the second parameter, I put the variable name of a String of an object contained in the list, is this what have to be done ? 2014-07-10 16:57 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
the null pointer exception comes from : at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) which is, in the code of tapestry this : @SuppressWarnings(unchecked) public void option(OptionModel optionModel) { Object optionValue = optionModel.getValue(); * String clientValue = encoder.toClient(optionValue); --- line 51* writer.element(option, value, clientValue); if (isOptionSelected(optionModel, clientValue)) writer.attributes(selected, selected); writeDisabled(optionModel.isDisabled()); writeAttributes(optionModel.getAttributes()); writer.write(optionModel.getLabel()); writer.end(); } So in this line it should execute the toClient method of my ValueEncoder so I added some system.out.println in it just to see if it really does it : public class TypeClientDtoEncoder implements ValueEncoderTypeClientDto, ValueEncoderFactoryTypeClientDto { @Inject private IServiceTypeClient serviceTypeClient; /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object) */ @Override public String toClient(TypeClientDto value) { // return the given object's ID *System.out.println(abcdef);* * System.out.println(encoder typeclient toclient);* return String.valueOf(value.getId()); } /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toValue(java.lang.String) */ @Override public TypeClientDto toValue(String clientValue) { // find the typeclientdto object of the given ID in the database System.out.println(abcdef); System.out.println(encoder typeclient tovalue); return serviceTypeClient.findTypeClientDto(Long.parseLong(clientValue)); } // let this ValueEncoder also serve as a ValueEncoderFactory /* * (non-Javadoc) * * @see * org.apache.tapestry5.services.ValueEncoderFactory#create(java.lang.Class) */ @Override public ValueEncoderTypeClientDto create(ClassTypeClientDto type) { return this; } } But nothing appears in the console, so the problem is here, why it doesn't pass in the method toClient of my ValueEncoder ? 2014-07-15 11:28 GMT+02:00 Geoff Callender geoff.callender.jumpst...@gmail.com: If I read Bob right, I think Bob said his problem was not due to nulls, it was due to the selected value not being one of the values in the OptionModel. It might also be worth trying secure=literal:false on the Select. On 15 Jul 2014, at 5:59 pm, squallmat . squall...@gmail.com wrote: I tried to see what was in my selectmodel after the factory loading with this code : // initialize selectmodels selectType = selectModelFactory.create(typeClientList, nomType); ListOptionModel optionModelList = selectType.getOptions(); System.out.println(begin); for (OptionModel optionModel : optionModelList) { System.out.println(optionModel.getLabel()); System.out.println(optionModel.getValue()); } System.out.println(end); And in the console I see that I have exactly what I want and I don't see any Null in my selectmodel. @Bob : How do you resolved your problem ? Anyone alse to help me on this ? I'm stuck on thsi problem :( 2014-07-14 20:21 GMT+02:00 Bob Harner bobhar...@gmail.com: I haven't read through this thread very carefully, but last week I got a nearly identical stack trace. It was from Palette, not Select, but those components have a lot of identical code. In my case the problem was that the SelectModel had all of the expected values *except* the selected value. Tapestry didn't do a good job with the error messages in that case. On Fri, Jul 11, 2014 at 5:36 AM, squallmat . squall...@gmail.com wrote: When I do this : selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); each lists (typeClientList and applicatifList) are not empty. And for the second parameter, I put the variable name of a String of an object contained in the list, is this what have to be done ? 2014-07-10 16:57 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
On Tue, 15 Jul 2014 06:28:46 -0300, Geoff Callender geoff.callender.jumpst...@gmail.com wrote: If I read Bob right, I think Bob said his problem was not due to nulls, it was due to the selected value not being one of the values in the OptionModel. This can be caused by the lack of a good implementation of equals() and hashCode(), which almost every non-service class should have anyway, specially the ones which can appear inside collections (and SelectModel is a sort of collection of OptionModels). -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
On Tue, 15 Jul 2014 07:03:32 -0300, squallmat . squall...@gmail.com wrote: the null pointer exception comes from : at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) which is, in the code of tapestry this : @SuppressWarnings(unchecked) public void option(OptionModel optionModel) { Object optionValue = optionModel.getValue(); * String clientValue = encoder.toClient(optionValue); --- line 51* Have you checked whether you're passing a null value to the Select's encoder parameter? -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
On Tue, 15 Jul 2014 10:48:02 -0300, squallmat . squall...@gmail.com wrote: Ok I resolved the problem, I went from declaring the encoder with : @Property private TypeClientDtoEncoder typeClientDtoEncoder; to : public TypeClientDtoEncoder getTypeClientDtoEncoder() { return new TypeClientDtoEncoder(); } and now it works :pstrange Why is it strange? @Property just creates getter and setter. It doesn't set field values. You were probably only setting the field in setupRender(), which isn't called when a form submission is done. For that, you could have used onPrepare() (triggered by Form) instead, as it's called before the form is rendered and before the form submission is processed. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
But I was getting the problem at page loading. I haven't been able yet to do a form submission, so setupRender should have been enough for that, right ? I probably miss something on this. But it's now working :) And thanks for your time for helping me (I'm discovering this framework). 2014-07-15 17:32 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Tue, 15 Jul 2014 10:48:02 -0300, squallmat . squall...@gmail.com wrote: Ok I resolved the problem, I went from declaring the encoder with : @Property private TypeClientDtoEncoder typeClientDtoEncoder; to : public TypeClientDtoEncoder getTypeClientDtoEncoder() { return new TypeClientDtoEncoder(); } and now it works :pstrange Why is it strange? @Property just creates getter and setter. It doesn't set field values. You were probably only setting the field in setupRender(), which isn't called when a form submission is done. For that, you could have used onPrepare() (triggered by Form) instead, as it's called before the form is rendered and before the form submission is processed. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
Have you seen this example and the ones around it? http://jumpstart.doublenegative.com.au/jumpstart7/examples/select/easyobject HTH, Geoff On 16 Jul 2014, at 1:56 am, squallmat . squall...@gmail.com wrote: But I was getting the problem at page loading. I haven't been able yet to do a form submission, so setupRender should have been enough for that, right ? I probably miss something on this. But it's now working :) And thanks for your time for helping me (I'm discovering this framework). 2014-07-15 17:32 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Tue, 15 Jul 2014 10:48:02 -0300, squallmat . squall...@gmail.com wrote: Ok I resolved the problem, I went from declaring the encoder with : @Property private TypeClientDtoEncoder typeClientDtoEncoder; to : public TypeClientDtoEncoder getTypeClientDtoEncoder() { return new TypeClientDtoEncoder(); } and now it works :pstrange Why is it strange? @Property just creates getter and setter. It doesn't set field values. You were probably only setting the field in setupRender(), which isn't called when a form submission is done. For that, you could have used onPrepare() (triggered by Form) instead, as it's called before the form is rendered and before the form submission is processed. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
I haven't read through this thread very carefully, but last week I got a nearly identical stack trace. It was from Palette, not Select, but those components have a lot of identical code. In my case the problem was that the SelectModel had all of the expected values *except* the selected value. Tapestry didn't do a good job with the error messages in that case. On Fri, Jul 11, 2014 at 5:36 AM, squallmat . squall...@gmail.com wrote: When I do this : selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); each lists (typeClientList and applicatifList) are not empty. And for the second parameter, I put the variable name of a String of an object contained in the list, is this what have to be done ? 2014-07-10 16:57 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
When I do this : selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); each lists (typeClientList and applicatifList) are not empty. And for the second parameter, I put the variable name of a String of an object contained in the list, is this what have to be done ? 2014-07-10 16:57 GMT+02:00 Thiago H de Paula Figueiredo thiag...@gmail.com : On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer. option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
select problem render queue
I'm trying to do implement a select component on a page. I have this : *CreerClient.java:* *.* // value encoders @Property private ApplicatifDtoEncoder applicatifDtoEncoder; @Property private TypeClientDtoEncoder typeClientDtoEncoder; // select models for client types and applications @Property private SelectModel selectType; @Property private SelectModel selectApplications; @Inject SelectModelFactory selectModelFactory; // data transfer pojos for data retrieving client types and applications @Property private ListTypeClientDto typeClientList; @Property private ListApplicatifDto applicatifList; // selected objects for each select and their ids for select value @Property private ApplicatifDto selectedApplication; @Property private TypeClientDto selectedClientType; . // prepare rendering of the page void setupRender() { // retrieve client types and applications id applicatifList = serviceApplicatif.findAllApplicatifDto(); typeClientList = serviceTypeClient.findAllTypeClientDto(); // initialize selectmodels selectType = selectModelFactory.create(typeClientList, nomType); selectApplications = selectModelFactory.create(applicatifList, nom); } *CreerClient.tml :* t:Label t:for=typeClientList / : t:Select value=selectedClientType t:id=typeClientList model=selectType encoder=typeClientDtoEncoder / . t:Select value=selectedApplication t:id=selectApplications model=selectApplications encoder=applicatifDtoEncoder t:zone=applicationsZone / ... *ApplicatifDtoEncoder:* public class ApplicatifDtoEncoder implements ValueEncoderApplicatifDto, ValueEncoderFactoryApplicatifDto { @Inject private IServiceApplicatif serviceApplicatif; /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object) */ @Override public String toClient(ApplicatifDto value) { // return the given object's ID return String.valueOf(value.getId()); } /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toValue(java.lang.String) */ @Override public ApplicatifDto toValue(String clientValue) { // find the ApplicatifDto object of the given ID in the database return serviceApplicatif.findApplicatifDto(Long.parseLong(clientValue)); } // let this ValueEncoder also serve as a ValueEncoderFactory /* * (non-Javadoc) * * @see * org.apache.tapestry5.services.ValueEncoderFactory#create(java.lang.Class) */ @Override public ValueEncoderApplicatifDto create(ClassApplicatifDto type) { return this; } *TypeClientDtoEncoder :* public class TypeClientDtoEncoder implements ValueEncoderTypeClientDto, ValueEncoderFactoryTypeClientDto { @Inject private IServiceTypeClient serviceTypeClient; /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object) */ @Override public String toClient(TypeClientDto value) { // return the given object's ID return String.valueOf(value.getId()); } /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toValue(java.lang.String) */ @Override public TypeClientDto toValue(String clientValue) { // find the typeclientdto object of the given ID in the database return serviceTypeClient.findTypeClientDto(Long.parseLong(clientValue)); } // let this ValueEncoder also serve as a ValueEncoderFactory /* * (non-Javadoc) * * @see * org.apache.tapestry5.services.ValueEncoderFactory#create(java.lang.Class) */ @Override public ValueEncoderTypeClientDto create(ClassTypeClientDto type) { return this; } } But when I try to run this page I get : Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException In the console : [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:atos/smt/livraison/pages/CreerClient.tml, line 38] at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:81) at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) at $PageRenderQueue_10e6509c00f1.render(Unknown Source) at $PageRenderQueue_10e6509c00ea.render(Unknown Source) at org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) at org.got5.tapestry5.jquery.services.js.JSModule$1.renderMarkup(JSModule.java:40) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$31.renderMarkup(TapestryModule.java:1994) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$30.renderMarkup(TapestryModule.java:1978) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at
Re: select problem render queue
On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . squall...@gmail.com wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org