Re: ActionLink context help
Hi, Others will surely correct me if I'm wrong... - Ideally you should be able to create a mixin for the onclick event on the actionlink that picks up the value of the textfield and sets the context before the tapestry actionlink event triggers. However since the actionlink is tied to a zone this is not so trivial. Something to do with indeterministic ordering of events in javascript i believe I can see a couple of other alternatives; 1. Event and a little javascript using prototype and its inbuildt support for ajax requests. Haven't tested the below so a big disclaimer here :-) A) Sample Javascript - checkusername.js; CheckUserNameLink.prototype = { initialize: function(elementId, requestUrl) { this.elementId = elementId; this.requestUrl = requestUrl; Event.observe($(this.elementId), 'click', this._click.bindAsEventListener(this)); }, _click: function(theEvent) { var url = this.requestUrl + / + encodeURIComponent($ ('userName')); // adding the username as a context param to event new Ajax.Request(this.requestUrl, { method: 'get', onSuccess: function(transport) { var isTaken = transport.responseJSON.isTaken; if (isTaken === 'true') { // javascript to tell user the username is take... update a div/ span or whatever } } }); } }; B) In your TML remove the zone/replace with an empty div/span or whatever a href=# id=d=verifyDuplicatedUserName${message:verify-username-duplicated-link }/a C) In your page class // above class definition @IncludeJavaScriptLibrary({context:js/checkusername.js}) // inside class body private static final String CHECK_USER_NAME_EVENT = checkusername; @Inject private RenderSupport renderSupport; @Inject private ComponentResources componentResources; @AfterRender void afterRender() { Link link = componentResources.createEventLink(CHECK_USER_NAME_EVENT); renderSupport.addScript(new CheckUserNameLink('%s', '%s');, verifyDuplicatedUserName, link.toAbsoluteURI); } @OnEvent(value = CHECK_USER_NAME_EVENT) public Object onVerifyUserName(String userName) { //... do whatever you need to verify if username is taken // return result as json JSONObject response = new JSONObject(); response.put(isTaken, isTaken); return response; } 2. Autocomple: You might use the autocomplete mixin for textfield ? ...have to be creative to make it user friendly though ... cheers rundis I'm still getting started with Tapestry by doing some stuff, but... many questions. This one is in regards to AJAX. It's a How to kinda question. I Have a form like this in my page.tml: form t:type=form t:id=registrationForm clientValidation=false t:label for=userName / input t:type=TextField t:id=userName value=user.name t:validate=required, maxlength=15, minLength=3 size=15 / t:zone t:id=userNameDuplicatedNotice${userExistMessage}/t:zone a t:type=actionlink t:id=verifyDuplicatedUserName context=literal:testing href=# t:zone=userNameDuplicatedNotice${message:verify-username-duplicated-link }/a input type=submit value=${message:label.submit.create.user} / /form What I'm trying to figure out is: What is the best way to give the current value of textfield userName to the context of the link verifyDuplicatedLogin? Let me try to express with a user story: As a user I want to introduce a user name and click in a link to automatically(AJAX) receive a message informing me if the userName is already taken or not Thank you, jp - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [ANNOUNCEMENT] New Tapestry 5 book
Definitely +1 rundis On 11. nov.. 2009, at 22.21, Igor Drobiazko wrote: Good news. My publisher made the first step towards the translation. They contacted several publishers outside Germany to find one that is interested in translation. If some of them is interested then we will have the english version of the book. If you want to help me to make the translation possible make some noise here. The more comments here the more likely we will have a translation. I'll keep you informed about the progress. On Wed, Sep 16, 2009 at 7:28 PM, Igor Drobiazko igor.drobia...@gmail.com wrote: Hello folks, I am pleased to announce a new Tapestry 5 book. The book is written in German and is available as eBook on publisher's website: http://www.addison-wesley.de/main/main.asp?page=home/bookdetailsProductID=174975 The hardcover version of the book will be available starting from Sep 28 2009. I'll make another announcement when the hardcover version is released. Among other things the book covers : * Getting Started with Tapestry 5 * Concepts of the framework * Localization/internationalization * Creating Forms * Generation of user interfaces for JavaBeans * Writing own components and mixins * Ajax * Writing tests for Tapestry applications * Hibernate and Spring integration * Dependency Injection and Tapestry IoC * AOP and bytecode manipuation Special thanks go to Howard and Ulrich Stärk. Howard gave me some hints on how to write a better book and wrote a foreword. Ulrich was responsible for the technical review of the book and helped me to improve the quality. Enjoy -- Best regards, Igor Drobiazko -- Best regards, Igor Drobiazko - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: tapestry 5.1.0.5 and AJAX project/example?
On 27. okt.. 2009, at 19.58, Argo Vilberg wrote: hi, Is there any project sources on internet where i can learn advance ajax and Tapestry coding? So you are way beyond http://tapestry.apache.org/tapestry5.1/guide/ajax.html ? You have looked at the bundled components and mixins (and their source) ? Maybe you have even had a peak at www.chenillekit.org / http://chenillekit.codehaus.org ? And you have tried http://wiki.apache.org/tapestry/Tapestry5HowTos for inspiration ? Let me rephrase. What do you mean by advanced and which sources have you tried already ? Once you get the hang of how tapestry supports ajax, i'm sure you can go as advanced as you like. Also is i interested jQuery and Tapestry advance examples. Once you get over the conflict of $, it should in theory be straight forward... check out the wiki on howto enable jquery. Let me know if you find any good examples of cool jquery plugin integrations for tapestry ! And is there possible switch off tapestry javascript and write fully my own javascript? Search this forum for disable javascript (somebody asked the same not to long ago) Is there any particular reason you wish to fight the framework ? Argo rundis - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How do I add an activation context when navigating to a new page?
Try injecting PageRenderLinkSource and use createPageRenderLinkWithContext Object onSuccess() { return pageRenderLinkSouce(PayoutOrderDetails.class, orderId); } magnus On 8. okt.. 2009, at 09.51, Gunnar Eketrapp wrote: Hi ! I have problem with adding a context to a page that I am navigating too from on of my event handler metods. How should this be done ? Thanks in advance! Gunnar Eketrapp, Stockholm Sweden This does not work! Should it? == public Object onSuccess() { // process return admin/PayoutOrderDetails/ + orderid; } - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
streamresponse actionlink and zone problem
Hi, I have a page with a left hand listing of reports and a righthand zone showing details for the reports when clicking reportlinks in the listing. In the zone I have an actionlink for downloading a pdf version of the report. When clicking the links in the listing the zone updates correctly. But as soon as I click and download a pdf, the report-links on the lefthand side seizes to work. To get them working again I have to refresh the page. Using firebug I can see that the actionlink posts and receives the correct response, but the zone is never updated. Tried debugging the Tapestry Javascript but can't figure out where exactly it fails. (It does enter ZoneManager.updateFromURL, but never invokes ZoneManager.processReply) I've used the following wiki page as inspiration for returing the pdf: http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile anyone got any ideas ? regards Magnus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: streamresponse actionlink and zone problem
Cheers, Thx for swift reply. - Not using zone param in the actionlink for downloading the pdf though. I can't post the complete code (as its a whole lot going on :-) The page has the following layout; - Left column; Listing reports. Each report represented by an actionlink with zone param=reportDetails (t:actionlink t:id=selectReport context=report.id zone=reportDetails$ {report.name}/t:actionlink) - Right column: Showing details about a report. The details are wrapped in a zone reportDetails. Inside the zone is an actionlink to download a pdf (t:actionlink t:id=downloadPdf${message:report-downloadPdf }/t:actionlink) the page class has the following code for the actionlinks mentioned above; // download pdf StreamResponse onActionFromDownloadPdf() { /* this code basically constructs a pdf and returns a StreamResponse, as described in http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile */ return new PDFTransformer().generatePDF(report); } // actionlink for returning reportDetails Zone Object onActionFromSelectReport(int id) { Report report = reportRepository.findById(id); return reportDetails.getBody(); } not much magic in this. Obviously since the page has lots of other stuff, this could be the cause, I might have to make a simpler page to isolate the problem, but was hoping that maybe someone else has stumbled upon a similar scenario... kind regards Magnus On 8. sep.. 2009, at 10.51, Joost Schouten (ml) wrote: Hi Magnus, I can't quite oversee your situation correctly, but it sounds like you have might have set the zone parameter on your actionlink for downloading your pdf. If your link returns a stream, tapestry cannot add the required JSON needed for appropriate zone handling and consequently obstructing the next zone updates. If this is the case, remove the zone parameter from your downloading link and it should work fine. Otherwise, post your code. Cheers, Joost Magnus Rundberget wrote: Hi, I have a page with a left hand listing of reports and a righthand zone showing details for the reports when clicking reportlinks in the listing. In the zone I have an actionlink for downloading a pdf version of the report. When clicking the links in the listing the zone updates correctly. But as soon as I click and download a pdf, the report-links on the lefthand side seizes to work. To get them working again I have to refresh the page. Using firebug I can see that the actionlink posts and receives the correct response, but the zone is never updated. Tried debugging the Tapestry Javascript but can't figure out where exactly it fails. (It does enter ZoneManager.updateFromURL, but never invokes ZoneManager.processReply) I've used the following wiki page as inspiration for returing the pdf: http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile anyone got any ideas ? regards Magnus - 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: streamresponse actionlink and zone problem
Cheers, tried a little more to figure it out. Made a dead simple page, but the same problem. So I just rewrote the actionlink to a pagelink to a new page using target=_blank. That works, but flickers a little. The new download page returns the streamresponse in onActivate. thx Magnus On 8. sep.. 2009, at 11.37, Joost Schouten (ml) wrote: I think your pdf download will be upsetting your page state in some way. I generally choose to make a separate page to handle downloads. Otherwise isolation seems the way forward I would say and focus on the debuging javascript and the errors you might get there. Magnus Rundberget wrote: Cheers, Thx for swift reply. - Not using zone param in the actionlink for downloading the pdf though. I can't post the complete code (as its a whole lot going on :-) The page has the following layout; - Left column; Listing reports. Each report represented by an actionlink with zone param=reportDetails (t:actionlink t:id=selectReport context=report.id zone=reportDetails$ {report.name}/t:actionlink) - Right column: Showing details about a report. The details are wrapped in a zone reportDetails. Inside the zone is an actionlink to download a pdf (t:actionlink t:id=downloadPdf${message:report-downloadPdf }/t:actionlink) the page class has the following code for the actionlinks mentioned above; // download pdf StreamResponse onActionFromDownloadPdf() { /* this code basically constructs a pdf and returns a StreamResponse, as described in http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile */ return new PDFTransformer().generatePDF(report); } // actionlink for returning reportDetails Zone Object onActionFromSelectReport(int id) { Report report = reportRepository.findById(id); return reportDetails.getBody(); } not much magic in this. Obviously since the page has lots of other stuff, this could be the cause, I might have to make a simpler page to isolate the problem, but was hoping that maybe someone else has stumbled upon a similar scenario... kind regards Magnus On 8. sep.. 2009, at 10.51, Joost Schouten (ml) wrote: Hi Magnus, I can't quite oversee your situation correctly, but it sounds like you have might have set the zone parameter on your actionlink for downloading your pdf. If your link returns a stream, tapestry cannot add the required JSON needed for appropriate zone handling and consequently obstructing the next zone updates. If this is the case, remove the zone parameter from your downloading link and it should work fine. Otherwise, post your code. Cheers, Joost Magnus Rundberget wrote: Hi, I have a page with a left hand listing of reports and a righthand zone showing details for the reports when clicking reportlinks in the listing. In the zone I have an actionlink for downloading a pdf version of the report. When clicking the links in the listing the zone updates correctly. But as soon as I click and download a pdf, the report- links on the lefthand side seizes to work. To get them working again I have to refresh the page. Using firebug I can see that the actionlink posts and receives the correct response, but the zone is never updated. Tried debugging the Tapestry Javascript but can't figure out where exactly it fails. (It does enter ZoneManager.updateFromURL, but never invokes ZoneManager.processReply) I've used the following wiki page as inspiration for returing the pdf: http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile anyone got any ideas ? regards Magnus - 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
autocomplete mixin within zone problem
Hi, I´m experiencing javascript errors when using the autocomplete mixin in a zone. (found the following closed issue that I added a comment to : https://issues.apache.org/jira/browse/TAP5-260 ) Seems there is a problem (at least for me) when using autocomplete inside a zone, doing something (other than submitting form with autocomplete field) that refreshes the zone and the autocomplete field has focus. A javascript error (element is null) is generated. Anyone else experiencing the same problem ? Any suggestions for a workaround ? cheers magnus
Re: mac os x gzip compression 5.1
Cheers, I found the culprit. It appears that T5.1 has changed the way java scripts are included in head. I had included a javascript conditionally in my Layout.tml; head t:conditionalcomment t:condition=lt IE 7 script type=text/javascript src=/myapp/js/iehover- fix.js/script /t:conditionalcomment /head This rendered a tag !--[if lt IE 7] script type=text/javascript src=/myapp/js/iehover-fix.js/script ![endif]-- However all my included javascript references including tapestrys own was added inside this conditional... so it worked for IE6... but firefox obviously had rather poor js support for zones etc. I.e :-) a minor gotcha that I should have noticed earlier. Magnus On 7. mai. 2009, at 16.23, Howard Lewis Ship wrote: Yes: clean up your deployment to get rid fo the 5.0.18 JARs. On Thu, May 7, 2009 at 4:27 AM, Magnus Rundberget run...@mac.com wrote: Hi, I have a 5.0.18 App i tried upgrading to 5.1.0.5. Using zones extensively. When I try to invoke anything using a zone I get the following error; A component event handler method returned the value Block[Body of report/ViewReportNodes:output, at classpath:no/mil/ferdaball/web/pages/report/ViewReportNodes.tml, line 21]. Return type org.apache.tapestry5.internal.structure.BlockImpl can not be handled. Configured return types are java.lang.Class, java.lang.String, java.net.URL, org.apache.tapestry5.Link, org.apache.tapestry5.StreamResponse, org.apache.tapestry5.runtime.Component. I´ve tried; - FF 3.0.10 - Safari: 3.2.1 running with IE6 on WinXP seems to work fine. any pointers ? cheers Magnus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry Director of Open Source Technology at Formos - 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
mac os x gzip compression 5.1
Hi, I have a 5.0.18 App i tried upgrading to 5.1.0.5. Using zones extensively. When I try to invoke anything using a zone I get the following error; A component event handler method returned the value Block[Body of report/ViewReportNodes:output, at classpath:no/mil/ferdaball/web/pages/ report/ViewReportNodes.tml, line 21]. Return type org.apache.tapestry5.internal.structure.BlockImpl can not be handled. Configured return types are java.lang.Class, java.lang.String, java.net.URL, org.apache.tapestry5.Link, org.apache.tapestry5.StreamResponse, org.apache.tapestry5.runtime.Component. I´ve tried; - FF 3.0.10 - Safari: 3.2.1 running with IE6 on WinXP seems to work fine. any pointers ? cheers Magnus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org