Re: ProgressiveDisplay in a custom component?
On Thu, Jun 23, 2011 at 2:20 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: ProgressiveDisplays should handle the events and trigger them again. I guess you can find some examples in the mailing list or in JumpStart. Nice memory Thiago... ;-) Cheers -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5 Select Menu with Other Option
Hello, I'm trying to add an other option to my select menu and have the other option trigger a zone reload when selected. You can find a UI example here http://drupal.org/node/330740 . I'm currently using T5.2.5 with hibernate. My user interface uses two AjaxFormLoops, one nested inside the other and finally the select menu within the nested AjaxFormLoop. t:AjaxFormLoop t:id=lineItem source=purchaseRequest.lineItems value=lineItem encoder=encoderLineItem t:AjaxFormLoop t:id=lineItemFunding context=lineItem.tempId source=lineItem.lineItemFundings value=lineItemFunding encoder=encoderLineItemFunding t:Select t:id=newFunding value=lineItemFunding.funding model=fundingModel zone=fundingZone blankOption=always blankLabel=Funding Source/ /t:AjaxFormLoop /t:AjaxFormLoop I want to manually add the other option to the select menu and not save it to the database. I'm doing this with the following code within the onPrepare method. @Persist @Property private ListFunding _fundings; @Property @Persist private PurchaseRequest purchaseRequest; void onPrepareFromPR() { purchaseRequest = new PurchaseRequest(); _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); funding = new Funding(); funding.setName(other); funding.setId(-1); _fundings.add(funding); fundingModel = selectModelFactory.create(_fundings, label); } and lastly, I'm using the onValueChanged method to hand the AJAX request public Object onValueChanged(Funding funding) { if(funding != null funding.getName().equals(other)) { return fundingZone.getBody(); } return null; } I get the following error [ERROR]entities.Funding Unable to convert client value '-1' into an entity instance. I would like to add I'm building a purchaseRequest object with a one to many Funding Object as well as a one to many lineItem object. Both the Funding Object and the LineItem object have a one to many with a LineItemFunding Object. When I use the ValueEncoder with a UUID and the Funding object, the onValueChanged method returns the funding label, however the object doesn't get commited with the purchaseRequest.lineItem.lineItemFunding. See both examples below of the two ValueEncoders. Attempt 1 @SuppressWarnings(unchecked) public ValueEncoder getSelectEncoder() { return new ValueEncoderFunding() { public String toClient(Funding value) { Long key = value.getTempId(); return key.toString(); } public Funding toValue(String keyAsString) { Long key = new Long(keyAsString); for (Funding holder : purchaseRequest.getFundings()) { if (holder.getTempId() == key) { return holder; } } return null; } }; } Attempt 2 @Persist @Property private ListFunding _fundings; @SuppressWarnings(unchecked) public ValueEncoder getSelectEncoder() { return new ValueEncoderFunding() { public String toClient(Funding value) { Long key = value.getTempId(); return key.toString(); } public Funding toValue(String keyAsString) { Long key = new Long(keyAsString); for (Funding holder : _fundings) { if (holder.getTempId() == key) { return holder; } } return null; } }; } I almost feel the Select component should have an other parameter option with the ability to provide it with any custom text that can be picked up by the onValueChanged in order to easily return a zone and further enrich our interfaces. Any help with this issue would be greatly appreciated. Cheers, George -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-Menu-with-Other-Option-tp4520881p4520881.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Select Menu with Other Option
Hi! On Fri, 24 Jun 2011 09:44:42 -0300, gchristman gchrist...@cardaddy.com wrote: Hello, I'm trying to add an other option to my select menu and have the other option trigger a zone reload when selected. I get the following error [ERROR]entities.Funding Unable to convert client value '-1' into an entity instance. This is probably done by the ValueEncoder tapestry-hibernate automatically uses. I almost feel the Select component should have an other parameter option with the ability to provide it with any custom text that can be picked up by the onValueChanged in order to easily return a zone and further enrich our interfaces. Take a look at the blankOption and blankLabel parameters of the Select component. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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: T5: Theming Support
Please read this post: http://blog.tapestry5.de/index.php/2011/06/24/template-skinning/ On Sat, Jun 18, 2011 at 6:35 AM, Angelo C. angelochen...@gmail.com wrote: Hi, T5.3.0 has Skin and Theming Support, any reference to these two great features? Thanks, Angelo -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Theming-Support-tp4500606p4500606.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best regards, Igor Drobiazko http://tapestry5.de
Re: T5 Select Menu with Other Option
Hi Thiago, You are correct with it being done by the ValueEncoder tapestry-hibernate automatically which is why I'm receiving that error. Not entirely sure how to get around it. I'm using the blankOption=always, blankLabel=Funding Source parameters already. I guess I'm not clear with what your suggesting. When the other option is present and selected, I need to return a zone in order to create a new entry, but not be able to commit the other option to the db. Blanklabel still needs to be present with the other option. Any other thoughts? Cheers, George -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-Menu-with-Other-Option-tp4520881p4520995.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.2.5 - loop, zones and a save button
Hi, I asked this before but couldn't resolve the issue based on the information that Taha forwarded me. (http://tapestry.1045711.n5.nabble.com/loops-zones-and-encoders-td4425814.html#a4425945) I have a loop that creates textareas within a form. Each textarea is wrapped by a zone. Outside the loop is a submit button to save the form. No matter whether I set the submit defer attribute to false or true, my code only persists the information of the last texarea in the loop. That's how the form part of the tml looks like: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:zone t:id=textareaZone t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The odd thing is that the encoder (cEncoder) for the loop gets called n times before the setter of the currentCriteria field gets called n times. Removing the zone brings back the normal behaviour of calling first the encoder and second, the setter of the corresponding field. Any hints and pointers to fix this are much appreciated. Regards, Alex -- DI(FH) Alexander Rosemann open source based software solutions Naunspitzweg 3 | 6341 Ebbs | Austria mobile: +43-681-10337082 | email: alexander.rosem...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Select Menu with Other Option
On Fri, 24 Jun 2011 10:23:53 -0300, George Christman gchrist...@cardaddy.com wrote: Hi Thiago, Hi! You are correct with it being done by the ValueEncoder tapestry-hibernate automatically which is why I'm receiving that error. Not entirely sure how to get around it. I'd get the Funding ValueEncoder from ValueEncoder source, create a wrapper a wrapper around it that checks for -1 id's and returning a special Funding object. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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: T5.2.5 - loop, zones and a save button
Hi Whenever you use a zone in a loop, you should provide the javascript id yourself. You can use the index to create a unique one e.g. t:zone t:id='textareaZone' id='textareaZone_${index}' /t:zone If you are using a non-ajax form, what is the use of zone here ?? regards Taha On Fri, Jun 24, 2011 at 7:01 PM, Alexander Rosemann alexander.rosem...@gmail.com wrote: Hi, I asked this before but couldn't resolve the issue based on the information that Taha forwarded me. (http://tapestry.1045711.n5.nabble.com/loops-zones-and-encoders-td4425814.html#a4425945) I have a loop that creates textareas within a form. Each textarea is wrapped by a zone. Outside the loop is a submit button to save the form. No matter whether I set the submit defer attribute to false or true, my code only persists the information of the last texarea in the loop. That's how the form part of the tml looks like: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:zone t:id=textareaZone t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The odd thing is that the encoder (cEncoder) for the loop gets called n times before the setter of the currentCriteria field gets called n times. Removing the zone brings back the normal behaviour of calling first the encoder and second, the setter of the corresponding field. Any hints and pointers to fix this are much appreciated. Regards, Alex -- DI(FH) Alexander Rosemann open source based software solutions Naunspitzweg 3 | 6341 Ebbs | Austria mobile: +43-681-10337082 | email: alexander.rosem...@gmail.com - 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: [ANN] Tapestry-breadcrumbs version 1.4 is released
Now works. Nice component! Thanks! David 2011/6/23 Joakim Olsson joa...@unbound.se Hi, My bad. You need this in the page/layout-class as well: @Property private BreadCrumbInfo breadCrumb; I'll update the readme. Regards, Joakim On Thu, Jun 23, 2011 at 4:35 PM, David Canteros davidcanteros@gmail.com wrote: Hello! I would like to test your component, I followed the instructions from https://github.com/argoyle/tapestry-breadcrumbs but i get an exception: *Exception assembling root component of page Index: Could not convert 'breadCrumb' into a component parameter binding: Exception generating conduit for expression 'breadCrumb': Class org.example.pages.Index does not contain a property (or public field) named 'breadCrumb'.* Index.class is the page class where I want to place the trail. Is there anything else besides the @BreadCrums annotation that i have to add to the page class? I'm using tapestry 5.2.5. Thanks for you help! David 2011/6/19 Joakim Olsson joa...@unbound.se Gaah...Of course. It's on GitHub: https://github.com/argoyle/tapestry-breadcrumbs /Joakim On Sun, Jun 19, 2011 at 8:16 PM, Kalle Korhonen kalle.o.korho...@gmail.com wrote: Always link to your project page! Kalle On Sun, Jun 19, 2011 at 10:19 AM, Joakim Olsson joa...@unbound.se wrote: Hi, I just released version 1.4 of tapestry-breadcrumbs. The only change is regarding how the dispatcher is added to the master dispatcher. Previously I added it with before:PageRender but that made it pick up assets and component events as well as page renders so I have changed it to after:ComponentEvent,before:PageRender. Regards, Joakim - 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Select Menu with Other Option
Would you mind elaborating a bit on getting the Funding ValueEncoder from ValueEncoder source, or point me to an example? I'm not very familiar with the ValueEncoder and not finding much doc on your method. Thanks Thiago. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-Menu-with-Other-Option-tp4520881p4521089.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.2.5 - loop, zones and a save button
Hi Taha, I should have put more thought in my example. The zone gets its unique id and is updated by a set of actionlinks that I have omitted in my previous example. This is the full one: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:loop t:id=links value=link source=links t:actionlink t:id=linkId zone=prop:uniqueZoneIdsome text/t:actionlink /t:loop t:zone t:id=textareaZone id=prop:uniqueZoneId t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The actionlinks fill the textarea with default data which can then be altered by the user and finally saved. Regards, Alex On 24.06.2011 15:48, Taha Hafeez wrote: Hi Whenever you use a zone in a loop, you should provide the javascript id yourself. You can use the index to create a unique one e.g. t:zone t:id='textareaZone' id='textareaZone_${index}' /t:zone If you are using a non-ajax form, what is the use of zone here ?? regards Taha On Fri, Jun 24, 2011 at 7:01 PM, Alexander Rosemann alexander.rosem...@gmail.com wrote: Hi, I asked this before but couldn't resolve the issue based on the information that Taha forwarded me. (http://tapestry.1045711.n5.nabble.com/loops-zones-and-encoders-td4425814.html#a4425945) I have a loop that creates textareas within a form. Each textarea is wrapped by a zone. Outside the loop is a submit button to save the form. No matter whether I set the submit defer attribute to false or true, my code only persists the information of the last texarea in the loop. That's how the form part of the tml looks like: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:zone t:id=textareaZone t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The odd thing is that the encoder (cEncoder) for the loop gets called n times before the setter of the currentCriteria field gets called n times. Removing the zone brings back the normal behaviour of calling first the encoder and second, the setter of the corresponding field. Any hints and pointers to fix this are much appreciated. Regards, Alex -- DI(FH) Alexander Rosemann open source based software solutions Naunspitzweg 3 | 6341 Ebbs | Austria mobile: +43-681-10337082 | email: alexander.rosem...@gmail.com - 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: T5 Select Menu with Other Option
On Fri, 24 Jun 2011 10:57:43 -0300, George Christman gchrist...@cardaddy.com wrote: Would you mind elaborating a bit on getting the Funding ValueEncoder from ValueEncoder source, or point me to an example? I'm not very familiar with the ValueEncoder and not finding much doc on your method. Something like this (not tested): select t:type=Select ... t:encoder=fundingEncoder/ final private static Funding OTHER = new Funding(); final private static String OTHER_ID = -1; @Inject private ValueEncoderSource valueEncoderSource; public ValueEncoderFunding getFundingEncoder() { final ValueEndcoderFunding encoder = valueEncoderSource.getValueEncoder(Funding.class); return new FundingValueEncoder(encoder); } final private static FundingValueEncoder implements ValueEncoderFunding { final private ValueEncoderFunding delegate; public FundingValueEncoder(ValueEncoderFunding delegate) { this.delegate = delegate; } public String toClient(Funding value) { if (value == OTHER) { return OTHER_ID; } else { return delegate.toClient(value); } } public Funding toValue(String clientValue) { if (OTHER_ID.equals(clientValue) { return OTHER; } else { return delegate.toValue(clientValue); } } } -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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
Tapestry 5.25 with Tynamo 0.4.0 onActionFromLogout not redirecting to index page.
So i have many pages that implements onActionFromLogout @InjectPage private Index index; public Object onActionFromLogout() { SecurityUtils.getSubject().logout(); try { // the session is already invalidated, but need to cause an exception since tapestry doesn't know about it // and you'll get a container exception message instead without this. Unfortunately, there's no way of // configuring Shiro to not invalidate sessions right now. See DefaultSecurityManager.logout() // There's a similar issues in Tapestry - Howard has fixed, but no in T5.2.x releases yet request.getSession(false).invalidate(); // some more stuff } catch (Exception ex) { LOG.error(error in logging out, ex); } return index; } but when I click on the logout link generated by t:loginLink tag it does not take me to the index page. I want to invalidate the session, logout and get taken to index page instead of staying on the same page. What is happening. post logout page A -- page A page B -- page B page C -- page C What should happen. Instead I want page A -- Index. What is wrong? What is the best way to solve the problem. Thanks -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-25-with-Tynamo-0-4-0-onActionFromLogout-not-redirecting-to-index-page-tp4521350p4521350.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.2.5 - loop, zones and a save button
Can you share the code of the event handler for the action. I think all the textareas are getting bound to the last object of the loop's source Regards Taha On Jun 24, 2011, at 7:35 PM, Alexander Rosemann alexander.rosem...@gmail.com wrote: Hi Taha, I should have put more thought in my example. The zone gets its unique id and is updated by a set of actionlinks that I have omitted in my previous example. This is the full one: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:loop t:id=links value=link source=links t:actionlink t:id=linkId zone=prop:uniqueZoneIdsome text/t:actionlink /t:loop t:zone t:id=textareaZone id=prop:uniqueZoneId t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The actionlinks fill the textarea with default data which can then be altered by the user and finally saved. Regards, Alex On 24.06.2011 15:48, Taha Hafeez wrote: Hi Whenever you use a zone in a loop, you should provide the javascript id yourself. You can use the index to create a unique one e.g. t:zone t:id='textareaZone' id='textareaZone_${index}' /t:zone If you are using a non-ajax form, what is the use of zone here ?? regards Taha On Fri, Jun 24, 2011 at 7:01 PM, Alexander Rosemann alexander.rosem...@gmail.com wrote: Hi, I asked this before but couldn't resolve the issue based on the information that Taha forwarded me. (http://tapestry.1045711.n5.nabble.com/loops-zones-and-encoders-td4425814.html#a4425945) I have a loop that creates textareas within a form. Each textarea is wrapped by a zone. Outside the loop is a submit button to save the form. No matter whether I set the submit defer attribute to false or true, my code only persists the information of the last texarea in the loop. That's how the form part of the tml looks like: t:form t:loop t:id=criteria value=currentCriteria source=criteria encoder=cEncoder t:zone t:id=textareaZone t:textarea value=textareaValue / /t:zone /t:loop t:submit value=Save t:id=save/ /t:form The odd thing is that the encoder (cEncoder) for the loop gets called n times before the setter of the currentCriteria field gets called n times. Removing the zone brings back the normal behaviour of calling first the encoder and second, the setter of the corresponding field. Any hints and pointers to fix this are much appreciated. Regards, Alex -- DI(FH) Alexander Rosemann open source based software solutions Naunspitzweg 3 | 6341 Ebbs | Austria mobile: +43-681-10337082 | email: alexander.rosem...@gmail.com - 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: LinkSubmit outside Form
Gentelmen, anyone? I ended writing clone of LinkSubmit, which detects form on the client and submits it. To distinguish what action to trigger i'm encoding input type=hidded name=action value=my-action / when triggering submit, and in the event handler i have to do switch: @CommitAfter public Object onSuccess() { if(action==Delete) doDelete(); else if (action==Create) doCreate(); return updateZones(); } ..which sucks :) Any idea how to get more clean approach with correct event triggered? On Wed, Jun 22, 2011 at 4:40 PM, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: T5.1.0.8 Quick question, fast way to have LinkSubmit outside Form with standard components? Thanks.
Re: T5 Select Menu with Other Option
Other than a few typos, code compiled and worked, however doesn't seem to be solving the issue. I'll show you exactly what I'm doing, maybe I'm missing something small. The value never seems to equal OTHER in your method. I really appreciate everything thus far. Thanks ! tml t:AjaxFormLoop t:id=lineItem source=purchaseRequest.lineItems value=lineItem encoder=encoderLineItem t:TextField value=lineItem.name/ t:AjaxFormLoop t:id=lineItemFunding context=lineItem.tempId source=lineItem.lineItemFundings value=lineItemFunding encoder=encoderLineItemFunding t:Select t:id=newFunding value=lineItemFunding.funding model=fundingModel zone=fundingZone encoder=selectEncoder blankOption=always blankLabel=Funding Source/ /t:AjaxFormLoop /t:AjaxFormLoop class @PageActivationContext private PurchaseRequest _purchaseRequest; @Property @Persist private PurchaseRequest purchaseRequest; @Property private LineItemFunding lineItemFunding; @Property private Funding funding; @Property @Persist private SelectModel fundingModel; @Inject private SelectModelFactory selectModelFactory; @Inject private ValueEncoderSource valueEncoderSource; final private static String NEW_FUNDING_NAME = + Add New Funding; final private static Funding OTHER = new Funding(); final private static String OTHER_ID = -1; void setupRender() { if(_purchaseRequest == null) { purchaseRequest = new PurchaseRequest(); } else { purchaseRequest = _purchaseRequest; } } void onPrepareFromPR() { ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); funding = new Funding(); funding.setName(NEW_FUNDING_NAME); funding.setId(OTHER_ID); _fundings.add(funding); fundingModel = selectModelFactory.create(_fundings, label); } public Object onValueChanged(Funding funding) { if(funding != null funding.getName().equals(NEW_FUNDING_NAME)) { return fundingZone.getBody(); } return null; } @CommitAfter void onSuccessFromPR() { session.saveOrUpdate(purchaseRequest); } //Select Menu OnChange public Object onValueChanged(Funding funding) { if(funding != null funding.getName().equals(NEW_FUNDING_NAME)) { return fundingZone.getBody(); } return null; } //Encoders @SuppressWarnings(unchecked) public ValueEncoder getEncoderLineItem() { return new ValueEncoderLineItem() { public String toClient(LineItem value) { Long key = value.getTempId(); return key.toString(); } public LineItem toValue(String keyAsString) { Long key = new Long(keyAsString); for (LineItem holder : purchaseRequest.getLineItems()) { if (holder.getTempId() == key) { return holder; } } return null; } }; } @SuppressWarnings(unchecked) public ValueEncoder getEncoderLineItemFunding() { return new ValueEncoderLineItemFunding() { public String toClient(LineItemFunding value) { Long key = value.getTempId(); return key.toString(); } public LineItemFunding toValue(String keyAsString) { Long key = new Long(keyAsString); for (LineItemFunding holder : lineItem.getLineItemFundings()) { if (holder.getTempId() == key) { return holder; } } return null; } }; } public ValueEncoderFunding getSelectEncoder() { final ValueEncoderFunding encoder = valueEncoderSource.getValueEncoder(Funding.class); return new FundingValueEncoder(encoder); } final private static class FundingValueEncoder implements ValueEncoderFunding { final private ValueEncoderFunding delegate; public FundingValueEncoder(ValueEncoderFunding delegate) { this.delegate = delegate; } public String toClient(Funding value) { if (value == OTHER) { System.out.println(OTHER_ID); return OTHER_ID; } else { return delegate.toClient(value); } } public Funding toValue(String clientValue) { if (OTHER_ID.equals(clientValue)) { return OTHER; } else { return delegate.toValue(clientValue); } } } //Add Row - TempID UUID LineItem onAddRowFromLineItem() { LineItem newLineItem = new LineItem(); purchaseRequest.getLineItems().add(newLineItem);
Re: T5 Select Menu with Other Option
On Fri, 24 Jun 2011 12:35:51 -0300, George Christman gchrist...@cardaddy.com wrote: void onPrepareFromPR() { ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); funding = new Funding(); funding.setName(NEW_FUNDING_NAME); funding.setId(OTHER_ID); _fundings.add(funding); fundingModel = selectModelFactory.create(_fundings, label); } Here's the problem: you should use OTHER instead of instantiating Funding, as the encoder is doing a == check. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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: T5 Select Menu with Other Option
Seems like we are super close now. Hopefully I'm doing this correctly ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); _fundings.add(OTHER); ValueEncoder is returning -1 as expected and the onValueChanged(Funding funding) seems to be returning an object. Only two issues left to resolve is a null funding name / id within onValueChanged and no funding label exist within the select menu. If you could point me in the direction to resolving those two bugs, this issue should be completed. Once again, thanks so much! -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-Menu-with-Other-Option-tp4520881p4521568.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Select Menu with Other Option
On Fri, 24 Jun 2011 13:34:59 -0300, George Christman gchrist...@cardaddy.com wrote: Seems like we are super close now. Hopefully I'm doing this correctly ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); _fundings.add(OTHER); I guess so. :) ValueEncoder is returning -1 as expected and the onValueChanged(Funding funding) seems to be returning an object. Only two issues left to resolve is a null funding name / id within onValueChanged and no funding label exist within the select menu. If you could point me in the direction to resolving those two bugs, this issue should be completed. Once again, thanks so much! I guess both can be solved by setting the id and the property used as label in the OTHER object. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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: T5 Reference page attributes from a component
On Jun 23, 2011, at 6:27 PM, Thiago H. de Paula Figueiredo wrote: On Thu, 23 Jun 2011 18:18:39 -0300, Tony Nelson tnel...@starpoint.com wrote: In our T4 app we made a lot of use of this type of construct: parameter name=selectedColumn default-value=ognl:page.selectedColumn / This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values. Is there a similar construct in T5 No. or am I going to have to pass these values explicitly down the components? Yes. You can also use the Environmental service. Thank you very much for your help. I was able to get my form to display properly using the Environmental Service and adding the following to my base class: void beginRender() { environment.push(SearchParameters.class, getSearchParameters()); } void afterRender() { environment.pop(SearchParameters.class); } However, when I submit the form (from an input type=image) I get the following OperationException: Failure writing parameter 'value' of component emailuser/List:pagedtable.columnsorterdata.hidden: No object of type com.starpoint.querybuilder.SearchParameters is available from the Environment. Available types are org.apache.tapestry5.TrackableComponentEventCallback, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.BeanValidationContext, org.apache.tapestry5.services.ComponentEventResultProcessor, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat. The fields form search parameters are in my component as: t:hidden value=searchParameters.column encoder=valueEncoderForColumn id=selectedColumn / t:hidden value=searchParameters.sortDirection id=sortDirection / Am I missing something simple again? Thanks again for the help. Tony Nelson - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Reference page attributes from a component
On Fri, 24 Jun 2011 14:17:43 -0300, Tony Nelson tnel...@starpoint.com wrote: Thank you very much for your help. I was able to get my form to display properly using the Environmental Service and adding the following to my base class: void beginRender() { environment.push(SearchParameters.class, getSearchParameters()); } void afterRender() { environment.pop(SearchParameters.class); } They're only invoked in render requests, not action (including form submission) ones. You can use @PageAttached and @PageDetached, as they're invoked in all requests. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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: T5 Reference page attributes from a component
Hi There are two phases after you submit a form. First comes the action phase and then the render phase. You are pushing an object in the render phase so at the time of action the object is not there. Regards Taha On Jun 24, 2011, at 10:47 PM, Tony Nelson tnel...@starpoint.com wrote: On Jun 23, 2011, at 6:27 PM, Thiago H. de Paula Figueiredo wrote: On Thu, 23 Jun 2011 18:18:39 -0300, Tony Nelson tnel...@starpoint.com wrote: In our T4 app we made a lot of use of this type of construct: parameter name=selectedColumn default-value=ognl:page.selectedColumn / This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values. Is there a similar construct in T5 No. or am I going to have to pass these values explicitly down the components? Yes. You can also use the Environmental service. Thank you very much for your help. I was able to get my form to display properly using the Environmental Service and adding the following to my base class: void beginRender() { environment.push(SearchParameters.class, getSearchParameters()); } void afterRender() { environment.pop(SearchParameters.class); } However, when I submit the form (from an input type=image) I get the following OperationException: Failure writing parameter 'value' of component emailuser/List:pagedtable.columnsorterdata.hidden: No object of type com.starpoint.querybuilder.SearchParameters is available from the Environment. Available types are org.apache.tapestry5.TrackableComponentEventCallback, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.BeanValidationContext, org.apache.tapestry5.services.ComponentEventResultProcessor, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat. The fields form search parameters are in my component as: t:hidden value=searchParameters.column encoder=valueEncoderForColumn id=selectedColumn / t:hidden value=searchParameters.sortDirection id=sortDirection / Am I missing something simple again? Thanks again for the help. Tony Nelson - 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: T5: Theming Support
Nice. Like the graphs. On Fri, Jun 24, 2011 at 6:16 AM, Igor Drobiazko igor.drobia...@gmail.com wrote: Please read this post: http://blog.tapestry5.de/index.php/2011/06/24/template-skinning/ On Sat, Jun 18, 2011 at 6:35 AM, Angelo C. angelochen...@gmail.com wrote: Hi, T5.3.0 has Skin and Theming Support, any reference to these two great features? Thanks, Angelo -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Theming-Support-tp4500606p4500606.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best regards, Igor Drobiazko http://tapestry5.de -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Select Menu with Other Option
Thiago, it looks like that did the trick. I'm running into a couple issues, sorry to keep bothering you :-/ I'm setting the funding id / name ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); NEW_FUNDING.setName(NEW_FUNDING_NAME); NEW_FUNDING.setId(OTHER_ID); _fundings.add(OTHER); value encoder works perfectly, and the onChanged method works perfectly for a short period before funding id / name goes null. The funding object still exist though. Any Ideas? public Object onValueChanged(Funding funding) { System.out.println(Change + funding.getId()); if(funding != null funding.getName().equals(NEW_FUNDING_NAME)) { return fundingZone.getBody(); } return null; } Also, I need to validate that the other object isn't being selected and committed to the db. I wrote this code within the onValidate method for (LineItem _lineItem : purchaseRequest.getLineItems()) { for(LineItemFunding _lineItemFunding : _lineItem.getLineItemFundings()) { if(lineItemFunding.getFunding().getId() == -1) { _lineItem.getLineItemFundings().remove(_lineItemFunding); } } } and I get the following error java.util.ConcurrentModificationException Hide uninteresting stack frames Stack trace * java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) * java.util.AbstractList$Itr.next(AbstractList.java:343) * org.hibernate.collection.AbstractPersistentCollection$IteratorProxy.next(AbstractPersistentCollection.java:580) * com.mycompany.rolemanager.pages.Purchase_Request.onValidateFromPR(Purchase_Request.java:137) * com.mycompany.rolemanager.pages.Purchase_Request$MethodAccess_onValidateFromPR_130c294c1c0.invoke(Purchase_Request$MethodAccess_onValidateFromPR_130c294c1c0.java) * org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:52) * org.apache.tapestry5.internal.transform.OnEventWorker$4.invokeEventHandlers(OnEventWorker.java:157) * org.apache.tapestry5.internal.transform.OnEventWorker$4.advise(OnEventWorker.java:136) * org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86) * com.mycompany.rolemanager.pages.Purchase_Request.dispatchComponentEvent(Purchase_Request.java) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:942) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1132) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3000(ComponentPageElementImpl.java:72) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1077) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl$7.invoke(ComponentPageElementImpl.java:1075) * org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) * org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) * org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063) * org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:141) * org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1073) * org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:287) * org.apache.tapestry5.corelib.components.Form.fireValidateEvent(Form.java:606) * org.apache.tapestry5.corelib.components.Form.fireValidateFormEvent(Form.java:594) * org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:548) * org.apache.tapestry5.corelib.components.Form$onAction$invocation_130c294d0e0.invokeAdvisedMethod(Form$onAction$invocation_130c294d0e0.java) * org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:77) * org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37) * org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54) * org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:86) * org.apache.tapestry5.corelib.components.Form.onAction(Form.java) *
Re: T5 Select Menu with Other Option
On Fri, 24 Jun 2011 15:48:08 -0300, George Christman gchrist...@cardaddy.com wrote: ListFunding _fundings = session.createCriteria(Funding.class).add(Restrictions.eq(purchaseRequest.id, purchaseRequest.getId())).list(); NEW_FUNDING.setName(NEW_FUNDING_NAME); NEW_FUNDING.setId(OTHER_ID); _fundings.add(OTHER); You're setting the fields of NEW_FUNDING and using OTHER. ;) OTHER.setName(NEW_FUNDING_NAME); OTHER.setId(OTHER_ID); _fundings.add(OTHER); Also, I need to validate that the other object isn't being selected and committed to the db. I wrote this code within the onValidate method for (LineItem _lineItem : purchaseRequest.getLineItems()) { for(LineItemFunding _lineItemFunding : _lineItem.getLineItemFundings()) { if(lineItemFunding.getFunding().getId() == -1) { _lineItem.getLineItemFundings().remove(_lineItemFunding); } } } and I get the following error java.util.ConcurrentModificationException Copy the list to another list instance and work on the copy. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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
[ANNOUNCE] Tapestry 5.3.0
Apache Tapestry version 5.3.0 is now available. This is the first alpha release of Tapestry 5.3. It is designed to be a drop-in replacement for Tapestry 5.2, adding new components and features, with lower memory utilization, and event faster startup. However, as many deprecated classes have been removed, you should certainly check the release notes [http://tapestry.apache.org/release-notes-53.html]. We are quite interested in any upgrade problems you may encounter ... previewing new releases and reporting back is a terrific way to contribute back to Tapestry! Tapestry is available for download [http://tapestry.apache.org/download.html] in source format, and available via the central Maven repository: dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-core/artifactId version5.3.0/version /dependency -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Conversion from 5.1 to 5.2
I just finished converting our company's back-office application from Tapestry 5.1.0.5 to 5.2.5. I had been putting it off because I knew it would take some time and there was always something to add to the application. The application has functions for sales, customer support and billing and is comprised of more than separate 250 pages (.tml files.) The conversion took about two days for code changes and testing, plus less than another day for debugging based on user reports. Here are my notes on the conversion, which may help others contemplating a similar upgrade. First, the new web site is a definite improvement. Secondly, it was not as simple as updating my pom with the new version. I first updated my pom for the new versions of Tapestry, Chenille Kit and Tapestry Security. There were some typical dependency conflicts that took a while to figure out (Maven is rather stupid.) The first item I noticed was the changes to Hibernate's API, which were all easy to fix. (All were constant name changes, which I think improved the API.) My @InjectSelectionModel annotation wouldn't compile, of course, due to the changes to class the transformation API. I do like the new API much better, since it's easier to debug. However, it did take a few hours to get it working since I wasn't familiar with the New Way. At this point, I tried to start up my web app, but it didn't appear to work. Tapestry wasn't starting up and there was no logging information to tell me why. After a while, I noticed that one library I included used an older version of slf4j and Maven decided the old one was the only one it would include. This made tapestry not startup and not display any error messages to stdout, either. That was sort of frustrating. After forcing Maven to use 1.6.1 and removing the incompatible TapX I was using, it started up. I did google for quite some time looking for a compatible version of tapx-datefield, but failed. Later, someone posted the URL to the mailing list but I had replaced it by then. I'm using the Chenille Kit one, which I like better anyway. However, it can't easily be used in ModalBox dialogs, since it wants to initialize positioning after page load, and it can't do that inside a div style=display:none. I ended up adding an afterLoad parameter to ModalBox.show and manually convert the t:textfields via new Control.DatePicker. The most tedious part was converting the deprecated @Include... annotations with the new @Import one. Also changed the RenderSupport to JavaScriptSupport. I had some overly clever code for session state objects where I was casting it from the interface to the implementation and calling protected methods from a service. That worked in 5.1, but it causes an exception in 5.2. I just made all methods public on the SSO. Next up was figuring out why some pages with Chenille Kit's OnEvent mixin when added to select components weren't working right. I use this in several places to update child select components as well as updating zones. In the multiple select case, I settled on using the onCompleteCallback feature of the mixin to re-populate the select lists in JavaScript via JSON returned from the event handler. It's very, very fast and seamless that way. Many of the select components were setting an object property on a parent object, e.g. setting the corporation object on an account object. Oddly, something changed such that in the @OnEvent handler for changes to the select component, the value of the property on the parent object was always null. The first thing I did in the method was to do a query to find all relevant items for the next select component. That caused Hibernate to flush changes, resulting in an exception when it tried to write a null value to a non- null property. I fixed that by explicitly querying based on the key value passed to the event handler. Not sure what changed here, but it is working. Some AJAX routines didn't work due to a change where JSONObject's toString pretty printed, causing the output to be on multiple lines. I tracked all of those down and either changed it to toString(true) or ended up passing the object directly to functions instead of a string of a JSON object (e.g. in JavaScriptSupport.addScript()). I ran into several instances where it couldn't find zome t:zones, but adding a normal id attribute (in addition to the t:id attribute) fixed that. I only needed to do this for some t:zones, however. Continuing with t:zones, I also got the puzzling, rendered content did not include any elements that allow for the positioning of the hidden form field's elements exception. Searching google turned up nothing terribly helpful. I ended up moving the t:zone to outside of my t:form, and that fixed the problem. I also had some instances where I wanted to assign an id to a component (in my case a submit button.)
Re: Conversion from 5.1 to 5.2
On Fri, Jun 24, 2011 at 3:33 PM, Norman Franke nor...@myasd.com wrote: After I had everything working pretty well, I put it onto the production server where it ran for a few hours and then died with a PermGen exception. Previously, my app would run for months with the 64 MB of PermGen allocated to servers by default. Now, after upgrading to 5.2.5 it wouldn't run for more than a few hours at 128 MB. I ended up setting it to 512 MB, but that just seems outrageous. Is this normal to require 8x PermGen? I haven't made any other change to my app, just those required to upgrade. Good post, thanks for insights. As for the permgen usage, perhaps it's not normal, but expected and even documented. At 250 pages, your web application is likely bigger than a typical Tapestry app and permgen consumption correlates with the size of the web app. However, in return for higher permgen usage you'll have lower heap consumption, so you'll get better scalability. What's the max you are allocating to the JVM (the -Xmx) and have you tried finding a lower setting that would still work? Permgen usage is for the whole JVM and no more will be required even if you see increase in traffic, unlike in T5.1 case with page pool. Since you have an internal app with fairly predictable traffic pattern and scalability requirements it may not matter for you, but for the common case it's a win with only minor disadvantages (memory is cheap). Kalle - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org