Re: T5: Can Grid support custom label in UTF-8 encoding?
Hi, If you are using message catalog then Tapestry should be able to load proper value fir the grid column. So let's assume that in your data dource object you have property firstName, i.e. you have method in POJO getFirstName() Add such record to the UserList.properties: firstName-label=Customer First Name That's it Tapestry should be able replace grid column title automatically. /Yura. On Mon, Mar 24, 2008 at 10:57 PM, yuan gogo [EMAIL PROTECTED] wrote: I have UserList.java UserList.tml UserList.properties. In UserList I used a grid to show all registerd users and I'd like to custom the Grid header. So I defined some column titles in UserList.properties (of course, in Chinese and the file is UTF-8 encoding), but it can not be displayed correctly. English chars has no such problems. Anybody helps? TIA and Best regards!
Re: T5: Can Grid support custom label in UTF-8 encoding?
Also don't forget to encode property file in UTF-8. You can use native2ascii tool from JDK to convert native encoded file to Unicode encoded file. On Tue, Mar 25, 2008 at 12:15 AM, Yura Tkachenko [EMAIL PROTECTED] wrote: Hi, If you are using message catalog then Tapestry should be able to load proper value fir the grid column. So let's assume that in your data dource object you have property firstName, i.e. you have method in POJO getFirstName() Add such record to the UserList.properties: firstName-label=Customer First Name That's it Tapestry should be able replace grid column title automatically. /Yura. On Mon, Mar 24, 2008 at 10:57 PM, yuan gogo [EMAIL PROTECTED] wrote: I have UserList.java UserList.tml UserList.properties. In UserList I used a grid to show all registerd users and I'd like to custom the Grid header. So I defined some column titles in UserList.properties (of course, in Chinese and the file is UTF-8 encoding), but it can not be displayed correctly. English chars has no such problems. Anybody helps? TIA and Best regards!
Re: How is T5 tutorial?
Hi, Go grab Wicket of GWT. It's better documented and questions like what you asked won't refer you to source code but to a well documented examples. Above all the users of those lists are far, far more friendly. Rob On Mon, Mar 24, 2008 at 5:27 PM, osamuo [EMAIL PROTECTED] wrote: How long do we have to wait for the completion of T5 tutorial: Chapter 5: Forms in Tapestry? Thanks. -- View this message in context: http://www.nabble.com/How-is-T5-tutorial--tp16255566p16255566.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How is T5 tutorial?
TROLL go away On Tue, Mar 25, 2008 at 9:33 AM, Rob Smeets [EMAIL PROTECTED] wrote: Hi, Go grab Wicket of GWT. It's better documented and questions like what you asked won't refer you to source code but to a well documented examples. Above all the users of those lists are far, far more friendly. Rob On Mon, Mar 24, 2008 at 5:27 PM, osamuo [EMAIL PROTECTED] wrote: How long do we have to wait for the completion of T5 tutorial: Chapter 5: Forms in Tapestry? Thanks. -- View this message in context: http://www.nabble.com/How-is-T5-tutorial--tp16255566p16255566.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client side validation and IE
kranga wrote: T5 uses Prototype and Scriptaculous for client side validation/ajax stuff. Our experience with Prototype and Scriptaculous has not been that great, especially when it comes to upgrading versions. Is there any way to disable the use of those libraries and/or the use of a different library (JQuery?)? It seems like a very invasive decision for T5 to force the use of a javascript UI library and also perform client side validation using a specific UI paradigm. Perhaps can you vote for the mathcing issue: https://issues.apache.org/jira/browse/TAPESTRY-2179 (Javascript Adapter Architecture) ? -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Can Grid support custom label in UTF-8 encoding?
Thank you, but did u read my post carefully? I DID add a properties file encoding in UTF-8, and add a something-lable which matches the data source column name. It changed the column's title, but displayed some text which I don't expect. 2008/3/25, Yura Tkachenko [EMAIL PROTECTED]: Hi, If you are using message catalog then Tapestry should be able to load proper value fir the grid column. So let's assume that in your data dource object you have property firstName, i.e. you have method in POJO getFirstName() Add such record to the UserList.properties: firstName-label=Customer First Name That's it Tapestry should be able replace grid column title automatically. /Yura. On Mon, Mar 24, 2008 at 10:57 PM, yuan gogo [EMAIL PROTECTED] wrote: I have UserList.java UserList.tml UserList.properties. In UserList I used a grid to show all registerd users and I'd like to custom the Grid header. So I defined some column titles in UserList.properties (of course, in Chinese and the file is UTF-8 encoding), but it can not be displayed correctly. English chars has no such problems. Anybody helps? TIA and Best regards!
Is it possible to hide javascript source?
Hi all, I am including lots of javascript in my code through e.g. span jwcid=@Script script=/script/myscript.xml / Tapestry includes the whole source of the javascript files in the page source, which results in pages whose source may be consisting of hundreds of lines of java code. Is there a way to avoid this? For instance, instead of including them, a script src='...' type='text/javascript'/script wouldnt be sufficient? Grigoris
Re: T5: referring to default prototype.js
Hi Angelo, If you use PageRenderSupport to do anything script related, or if you use @IncludeJavaScriptLibrary, then it will be included in the resulting page automatically. If for some reason you need to explicitly include it, then you can annotate your page class with @IncludeJavaScriptLibrary(${tapestry.scriptaculous}/prototype.js) and it will be included. chris Angelo Chen wrote: Hi, How to refer to the default prototype.js come with t5? i use this, not really t5's way: script type=text/javascript src=${asset:context:js/prototype-1.6.0.2.js} / this works, but i have to duplicate the prototype.js. any idea? Thanks. A.C. -- http://thegodcode.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How is T5 tutorial?
There we go again, when someone raises a legitimate concern he is easily labeled a Troll. You had been more productive by telling me I'm wrong on what I said and give me some reasons why. Again, this proves how arrogant and unfriendly Tapestry mailing list members are. Fortunately, I'm not the only one thinking so. A prestigious site, theserverside.com, has an unbiased article arguing how bad a decision would be for anyone adopting or planing to adopt tapestry for any serious stuff at a serious organization. I won't say anything but refer you to the article at http://www.theserverside.com/news/thread.tss?thread_id=48743 Best wishes, Rob On Tue, Mar 25, 2008 at 9:40 AM, Davor Hrg [EMAIL PROTECTED] wrote: TROLL go away On Tue, Mar 25, 2008 at 9:33 AM, Rob Smeets [EMAIL PROTECTED] wrote: Hi, Go grab Wicket of GWT. It's better documented and questions like what you asked won't refer you to source code but to a well documented examples. Above all the users of those lists are far, far more friendly. Rob On Mon, Mar 24, 2008 at 5:27 PM, osamuo [EMAIL PROTECTED] wrote: How long do we have to wait for the completion of T5 tutorial: Chapter 5: Forms in Tapestry? Thanks. -- View this message in context: http://www.nabble.com/How-is-T5-tutorial--tp16255566p16255566.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @Cached and caching in general
Tobias Marx wrote: Wouldn't it be useful to make the @Cache annotation the default annotation for all methods? I can not imagine a case where it would make sense that during the rendering of a page returns different results... Just an example : you are in a loop (or grid or a beaneditor any other looping component) and you get the current value of an object, for the current iteration. -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Updating (multiple) t:parameter values in a t:beaneditform via AJAX
Hello there, I have a t:beaneditformwith multiple selectObject components (custom component; http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects ), each in a t:parameter. Now when the value of the first selectObject changes, I want the (two) other t:parameter to be updated. While specifying a function at the server or a javascript function to be called then is quite easy thanks to the T5Components onEvent-mixin, I cannot figure out how to update the t:parameters. Do I have to pack the entire form in a zone? How can I update a zone from the function that is called from the onEvent-mixin? Thanks, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @Cached and caching in general
Yes, you are right. But loops are usually inside of components and pages contain those componentsbut all methods in the page itself could be @Cache methods in my opinion if you do a component based approach and always package logical widgets into a component. Original-Nachricht Datum: Tue, 25 Mar 2008 13:33:19 +0100 Von: Francois Armand [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: @Cached and caching in general Tobias Marx wrote: Wouldn't it be useful to make the @Cache annotation the default annotation for all methods? I can not imagine a case where it would make sense that during the rendering of a page returns different results... Just an example : you are in a loop (or grid or a beaneditor any other looping component) and you get the current value of an object, for the current iteration. -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How is T5 tutorial?
Dude, if your backward compatibility is such an issue stop trolling and maybe learn to program Java, get productive, fork Tap 3, fork Tap 4, get famous and be happy to keep Tapestry going the way YOU want it. Your trolling only shows you have NO CLUE what open source is. Stop wasting everybody's time. SHUT UP ALREADY, and leave Tap 5 this mailing list alone !!! On Tue, Mar 25, 2008 at 6:46 AM, Rob Smeets [EMAIL PROTECTED] wrote: There we go again, when someone raises a legitimate concern he is easily labeled a Troll. You had been more productive by telling me I'm wrong on what I said and give me some reasons why. Again, this proves how arrogant and unfriendly Tapestry mailing list members are. Fortunately, I'm not the only one thinking so. A prestigious site, theserverside.com, has an unbiased article arguing how bad a decision would be for anyone adopting or planing to adopt tapestry for any serious stuff at a serious organization. I won't say anything but refer you to the article at http://www.theserverside.com/news/thread.tss?thread_id=48743 Best wishes, Rob On Tue, Mar 25, 2008 at 9:40 AM, Davor Hrg [EMAIL PROTECTED] wrote: TROLL go away On Tue, Mar 25, 2008 at 9:33 AM, Rob Smeets [EMAIL PROTECTED] wrote: Hi, Go grab Wicket of GWT. It's better documented and questions like what you asked won't refer you to source code but to a well documented examples. Above all the users of those lists are far, far more friendly. Rob On Mon, Mar 24, 2008 at 5:27 PM, osamuo [EMAIL PROTECTED] wrote: How long do we have to wait for the completion of T5 tutorial: Chapter 5: Forms in Tapestry? Thanks. -- View this message in context: http://www.nabble.com/How-is-T5-tutorial--tp16255566p16255566.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie,T5: Grid limitations (long).
First of all: Overall is Tapestry 5 in general and the the Grid component in particular an amazing piece of software. So this is *not* complaints, just an attempt to sort things out, to share my experiences and check that I understand things correctly. I have a use case where I'm about to present data in a table. The table is presenting different databases from time to time, so the db layout varies. At first glance, I thought the Grid would solve my problems, the Tapestry 4 did with some tweaks. However, I've run into follwong limitations: - The paging policy with a fixed number of numbered pages is hardcoded and can't be changed. Other policies e. g., overlap between pages or pages started at random points in the input vector is not possible. This has been discussed earlier, and is according to HLS a design decision. - It is not possible to change the overall rendering of a row e. g,, to to embed each TR.../TR in a DIV class=xxx TR.../TR/DIV. (e. g., if a row should wrapped in a microformat). - It is not possible to change the layout of the table header if you don't know the name of the column/attribute at compile time. Of course, you cannot reference an unknown column in the template. But it might be possible to define a catch all block (DefaultColumnCell?) which is the layout for all columns, with provisions to access the current column's name. Again, this can't be done as of 5.0.11. - It is not possible to enumerate the properties in the BeanModel data source (is is possible to list the editable properties, though). Minor issue, I guess. Personally, the conclusion is of course to write my own component, no problem. But maybe some of this or similar info should go into the Wiki, it would definitely have saved some time for me. There is really a lot of info what *can* be done with this rather complex and powerful component. Maybe it's time to add some info about what *can't* be done with it. Maybe some issue should be a RFE in the JIRA? Cheers --Alec - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How is T5 tutorial?
Rob smeets (and maybe few more aliases) is definitely a TROLL, those interested in details read the rest of the mail... Yes, there we go again, again you waste our time, spreading fud, and the article you mention is far from unbiased, and most likely even posted by you (using another alias). Source code is great for learning about any framework, I keep source of every library I use so I can look what is going on when some code breaks unexpectedly. So if someone suggests you to look at the source code it is no reason to bash that person. You are definitely a TROLL because yor only advice was to switch to another framework, if you were a real user you would give a better advice instead. Everyone here will answer the best they can, I use some subset of features, and help people that have trouble with that stuff. As you always recommend Wicket one would think that you are a wicket user marketing a competing framework, But you don't even use wicket because there is no record of you ever asking a question on their mailing lists. So if you are not a wicket user, and you haven't had any contact with wicket mailing list how can you compare wicket and tapestry ? If you are a wicket user, identify your self and send few links to wicket mailing list threads involving you. I bet wicket devs would have few words to say to you about your fud which does no good to wicket or tapestry. Davor Hrg On Tue, Mar 25, 2008 at 12:46 PM, Rob Smeets [EMAIL PROTECTED] wrote: There we go again, when someone raises a legitimate concern he is easily labeled a Troll. You had been more productive by telling me I'm wrong on what I said and give me some reasons why. Again, this proves how arrogant and unfriendly Tapestry mailing list members are. Fortunately, I'm not the only one thinking so. A prestigious site, theserverside.com, has an unbiased article arguing how bad a decision would be for anyone adopting or planing to adopt tapestry for any serious stuff at a serious organization. I won't say anything but refer you to the article at http://www.theserverside.com/news/thread.tss?thread_id=48743 Best wishes, Rob On Tue, Mar 25, 2008 at 9:40 AM, Davor Hrg [EMAIL PROTECTED] wrote: TROLL go away On Tue, Mar 25, 2008 at 9:33 AM, Rob Smeets [EMAIL PROTECTED] wrote: Hi, Go grab Wicket of GWT. It's better documented and questions like what you asked won't refer you to source code but to a well documented examples. Above all the users of those lists are far, far more friendly. Rob On Mon, Mar 24, 2008 at 5:27 PM, osamuo [EMAIL PROTECTED] wrote: How long do we have to wait for the completion of T5 tutorial: Chapter 5: Forms in Tapestry? Thanks. -- View this message in context: http://www.nabble.com/How-is-T5-tutorial--tp16255566p16255566.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @Cached and caching in general
[EMAIL PROTECTED] wrote: Yes, you are right. But loops are usually inside of components and pages contain those componentsbut all methods in the page itself could be @Cache methods in my opinion if you do a component based approach and always package logical widgets into a component. That means that if forbid the use of loop in page (for example, a loop through all the high-level widgets of the page) , or at least that the default behaviour for component's or for page's method is not the same... In my opinion, it looks like to be very error prone, with things that just don't work as expected. -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie,T5: Grid limitations (long).
Alec Leamas wrote: - The paging policy with a fixed number of numbered pages is hardcoded and can't be changed. Other policies e. g., overlap between pages Isn't that something you can handle inside your own GridDataSource? With the page number, the number of results per page, the number of overlapping items (ok, you need a separate parameter for that) it should be possible return the correct entries. pages started at random points in the input vector is not possible. Maybe this works: Inject the Grid component into your page using @Component private Grid grid; When setting up the result you set a random page - something like this: int numberOfPages = (int)(result.size()/grid.getRowsPerPage()); grid.setCurrentPage( (int)(Math.random() * numberOfPages) ); - It is not possible to change the overall rendering of a row e. g,, to to embed each TR.../TR in a DIV class=xxx TR.../TR/DIV. That is not valid XHTML 1.0 Strict I do not know enough about the Grid component to write something about the other questions. What I miss is the columns attribute from T4's Table component... Jesper -- Jesper Zedlitz Dept. for Computer Science, CAU of Kiel Room 1108Communication Systems Research Group Phone:+49-(0)431-880-7279 Christian-Albrechts-Platz 4 Fax: +49-(0)431-880-7615 24098 Kiel - Germany [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @Cached and caching in general
caching every method by default is definitely too error prone, and unexpected for most people. On Tue, Mar 25, 2008 at 3:23 PM, Francois Armand [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Yes, you are right. But loops are usually inside of components and pages contain those componentsbut all methods in the page itself could be @Cache methods in my opinion if you do a component based approach and always package logical widgets into a component. That means that if forbid the use of loop in page (for example, a loop through all the high-level widgets of the page) , or at least that the default behaviour for component's or for page's method is not the same... In my opinion, it looks like to be very error prone, with things that just don't work as expected. -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Zone Component update Grid
Yes, It's an absolutely great feature! :clap: Moritz Gmelin wrote: Hi, I just tried the new Zone component which is just about great! But when I tried to return a Block from my ActionListener that contains a Grid, I get the following Exception org.apache.tapestry.runtime.ComponentEventException: No object of type org.apache.tapestry.services.Heartbeat is available from the Environment. Available types are . (...no types are listed here) On the documentation about Zone I can read Inside a component, you should use Environmental, to highlight the fact that PageRenderSupport (like most environmental objects) is only available during rendering, not during action requests. So is this expected behaviour, that a Grid cannot be returned by an ActionListener that is supposed to update a Zone component? This would be an absolutely great feature to be able to update Grid's content in an AJAX fashion. Thanks for clues. Moritz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Zone-Component---update-Grid-tp14344745p16275995.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How is T5 tutorial?
Rob Smeets wrote: There we go again, when someone raises a legitimate concern he is easily labeled a Troll. So, once and for all, please prove us you are not the same childish anonymous coward A.K.A Emmanuel Sowah A.K.A. Francis Amanfo http://www.nabble.com/forum/ViewPost.jtp?post=8015345framed=y Why don't you get a real life outside of your fake identities? Angelo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Zone in Component bug
Hi, When i use zone in component , the json response is : Tapestry.initializeZones([{\div\:\output:118e6af4fe4\}], [[ \form:118e6af4fe4\,\output\]]);,content: .. there should be: Tapestry.initializeZones([{\div\:\output:118e6af4fe4\}], [[ \form:118e6af4fe4\,\output:118e6af4fe4\]]);,content: .. or Tapestry.initializeZones([{\div\:\output\}], [[ \form:118e6af4fe4\,\output\]]);,content: .. ? Thanks. -- View this message in context: http://www.nabble.com/T5%3A-Zone-in-Component-bug-tp16277264p16277264.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Maven2 or Ivy?
Sorry if this has been mentioned before, but I couldn't find any information about it in my searches (which is perhaps the answer already). I noticed on Howard's blog he condemned the use of Maven2, and I was wondering if there have been any changes to Tapestry5 that make it less maven-centric, or if there are tutorials on building Tapestry applications without maven. Is everyone still using maven2? Ivy? Thanks, Peter Beshai
Re: [t5] Validator question
Not possible? Sometimes a validator needs to look at input from another field to see if it is valid (ie password/confirmPassword). I know it's easy to do in onValidateForm, but I'd like to see how to do it in a nice modular Validator. I'm looking for something like: public void validate(Field field, String sourceFieldId, MessageFormatter formatter, Object value) throws ValidationException { Component page = ((AbstractField) field)._resources.getPage(); try { Method getter = page.getClass().getDeclaredMethod(getMethodName(sourceFieldId)); String sourceValue = (String) getter.invoke(page); if (value == null || !value.toString().equals(sourceValue)) throw new ValidationException(buildMessage(formatter, field)); } catch (Exception e) { log.error(No public getter field in page for: + sourceFieldId); } } but can't do that (the only problem being the private _resources). How can that be done in a Validator? I can't inject anything. I don't actually need to make my own field which exposes the ComponentResources, do I? Thanks. J On Mar 24, 2008, at 5:17 PM, Julian Wood wrote: How can you get access to an arbitrary Field from inside a Validator, given its id? In t4 it was relatively easy to grab the form and from there grab a field. Thanks, J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [t5] Validator question
Sorry, those APIs are not in place yet. I have JIRA issue add optional validators, which is a loose, general term for what you are aiming for (password is required if userName is given). I think some relationships may not be expressable using the @Validate annotation, i.e., the string representation; I'm thinking there will be a kind of JavaScript template object that will be used to generate some kinds of JavaScript. Things have slowed down on 5.0 for a moment, while I work on an urgent client project (in Tapestry 5). On Tue, Mar 25, 2008 at 11:08 AM, Julian Wood [EMAIL PROTECTED] wrote: Not possible? Sometimes a validator needs to look at input from another field to see if it is valid (ie password/confirmPassword). I know it's easy to do in onValidateForm, but I'd like to see how to do it in a nice modular Validator. I'm looking for something like: public void validate(Field field, String sourceFieldId, MessageFormatter formatter, Object value) throws ValidationException { Component page = ((AbstractField) field)._resources.getPage(); try { Method getter = page.getClass().getDeclaredMethod(getMethodName(sourceFieldId)); String sourceValue = (String) getter.invoke(page); if (value == null || !value.toString().equals(sourceValue)) throw new ValidationException(buildMessage(formatter, field)); } catch (Exception e) { log.error(No public getter field in page for: + sourceFieldId); } } but can't do that (the only problem being the private _resources). How can that be done in a Validator? I can't inject anything. I don't actually need to make my own field which exposes the ComponentResources, do I? Thanks. J On Mar 24, 2008, at 5:17 PM, Julian Wood wrote: How can you get access to an arbitrary Field from inside a Validator, given its id? In t4 it was relatively easy to grab the form and from there grab a field. Thanks, J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: SelectModel - a real world example
Is the way I'm building my custom select model the approved Tap 5 way? My concern is if OptionModelImpl and SelectModelImpl are still considered internal Tapestry classes and should be avoided? This stuff works fine for me and it's fairly elegant (IMHO), I just want to know if there is a better way. div class=w-row div class=w-tlabelt:label for=article /:/div t:select t:id=article style=width:60%; t:value=articleId t:model=articlesModel //div @Cached public SelectModel getArticlesModel() { final ListSelfHelpArticleBean articles = getArticles(); return new SelectModel() { private final SelectModel model; { OptionModel[] options = new OptionModel[articles.size()+1]; options[0] = new OptionModelImpl(-- Please Select, 0); int index = 1; for(SelfHelpArticleBean article : articles) { String label = article.getId() + : + article.getAnchorBody(); int value = article.getId(); options[index++] = new OptionModelImpl(label, value); } model = new SelectModelImpl(options); } public ListOptionGroupModel getOptionGroups() { return model.getOptionGroups(); } public ListOptionModel getOptions() { return model.getOptions(); } public void visit(SelectModelVisitor aVisitor) { model.visit(aVisitor); } }; } On Tue, May 8, 2007 at 12:50 AM, Bill Holloway [EMAIL PROTECTED] wrote: I'm just hoping for a stable, best-practice, and relatively simple way to set things up like Selects. Whatever you think is the best approach and put in the documentation. Things like selects should be a snap, IMHO. Bill On 5/7/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: My approach has to been to keep everything internal if possible. Thus an interface is public, the implementation is internal. If something is truly necessary, such as OptionModelImpl, there are two approaches: 1) Make the implementation class public (possibly breaking existing code that extends from the internal class) oh, and probably make it final as well. 2) Define a public factory service for the implementation. Right now, you can actually use the TypeCoercer as a kind of factory; if you pass in a comma-separated string and ask for an SelectModel you'll get it. Here, though, you're looking for something a little better adapted to your entity classes. However, a bare-bones implementation of OptionModel (that always returns false for isDisabled(), and null for getAttributes() ) is only a couple of lines of code. I think T4 fell into a trap of too much convenience stuff exposed as public APIs. I would rather err on the side of over-zealousness for T5. You can take internals public, but not the other way around, and once something is public, it also is (or should be) final. On 5/7/07, Bill Holloway [EMAIL PROTECTED] wrote: I've written similar code -- while remembering that OptionModelImpl is an internal class that Howard, in the documentation, has admonished us not to use. Community, what's the better solution? Bill On 5/7/07, Joel Wiegman [EMAIL PROTECTED] wrote: Eureka! Finally got it all working. What caused the drop down to not be defaulting is the fact that I declared my Brand list in two separate lists... One for the ValueEncoder and one for the SelectModel. Big no no! An equals is called on the value from the SelectModel and the value from the ValueEncoder, so if they are initialized as separate objects in separate lists the framework won't notice that they are equal (because they would point to a different memory location). I found that the framework also seems to like things better if the List of Brands is @Persisted between pages. Here's the final source code that I used to get it all working (Enjoy!): Brand.java (simple POJO): public class Brand { private String id; private String description; public Brand() {} public Brand(String id, String
T5 and Eclipse 3.3.2 and Tomcat 5.5
Does anyone have suggestions for running/debugging Tapestry using Tomcat 5.5 and working in Eclipse? IE: a) Should you create the eclipse project as a dynamic web project or just a java project or some sort of J2EE project? b) Does a maven-built project map over to the type of project answered in question a? c) Suggestions for pushing war over to tomcat's local directory, debugging through tomcat with code changes visible. d) Any plugins? THANKS!
Re: Is it possible to hide javascript source?
http://tapestry.apache.org/tapestry4.1/usersguide/script.html see the include-script element On Tue, Mar 25, 2008 at 1:15 PM, Grigoris Ioannou [EMAIL PROTECTED] wrote: Hi all, I am including lots of javascript in my code through e.g. span jwcid=@Script script=/script/myscript.xml / Tapestry includes the whole source of the javascript files in the page source, which results in pages whose source may be consisting of hundreds of lines of java code. Is there a way to avoid this? For instance, instead of including them, a script src='...' type='text/javascript'/script wouldnt be sufficient? Grigoris -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Tapestry-Hibernate and Hibernate validator
Horay to that! It would also be great if someone could help me and vote on http://opensource.atlassian.com/projects/hibernate/browse/HV-44 (Make Hibernate Validator multi-lingual). Regards, Olle 2008/3/24, Howard Lewis Ship [EMAIL PROTECTED]: Eventually, it would be nice if we could come up with a way to extract the validation meta data and use that to generate Tapestry validations. Maybe in 5.1. On Mon, Mar 24, 2008 at 9:37 AM, Josh Canfield [EMAIL PROTECTED] wrote: Tapestry doesn't do anything with the hibernate Validators so you use them just like you would outside of a tapestry project. In tapestry you'd handle them the same way you do other constraint violoations. On Fri, Mar 21, 2008 at 3:38 PM, Angelo Chen [EMAIL PROTECTED] wrote: Hi Josh, Anything need to be done in order to use it? thanks. A.C. joshcanfield wrote: yes -- View this message in context: http://www.nabble.com/T5%3A-Tapestry-Hibernate-and-Hibernate-validator-tp16198439p16210329.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Olle Hallin M.Sc. +46 70 6653071 [EMAIL PROTECTED] www.hit.se
Re: T5: SelectModel - a real world example
Use of internal classes isn't forbidden, but there's no promise of backwards compatibility. We may rename, move, refactor or change those classes at any time and with no notice. Because backwards compatibility is so hard, it's limited to as few classes, interfaces and annotations as possible, with as much as possible under the internal umbrella. In terms of your use, it looks fine, though the idea of have a null-option-as-a-label is kind of out of date for modern browsers, that support optgroup as well as option inside select, with optgroup exists to provide that kind of label. On Tue, Mar 25, 2008 at 11:51 AM, Adam Zimowski [EMAIL PROTECTED] wrote: Is the way I'm building my custom select model the approved Tap 5 way? My concern is if OptionModelImpl and SelectModelImpl are still considered internal Tapestry classes and should be avoided? This stuff works fine for me and it's fairly elegant (IMHO), I just want to know if there is a better way. div class=w-row div class=w-tlabelt:label for=article /:/div t:select t:id=article style=width:60%; t:value=articleId t:model=articlesModel //div @Cached public SelectModel getArticlesModel() { final ListSelfHelpArticleBean articles = getArticles(); return new SelectModel() { private final SelectModel model; { OptionModel[] options = new OptionModel[articles.size()+1]; options[0] = new OptionModelImpl(-- Please Select, 0); int index = 1; for(SelfHelpArticleBean article : articles) { String label = article.getId() + : + article.getAnchorBody(); int value = article.getId(); options[index++] = new OptionModelImpl(label, value); } model = new SelectModelImpl(options); } public ListOptionGroupModel getOptionGroups() { return model.getOptionGroups(); } public ListOptionModel getOptions() { return model.getOptions(); } public void visit(SelectModelVisitor aVisitor) { model.visit(aVisitor); } }; } On Tue, May 8, 2007 at 12:50 AM, Bill Holloway [EMAIL PROTECTED] wrote: I'm just hoping for a stable, best-practice, and relatively simple way to set things up like Selects. Whatever you think is the best approach and put in the documentation. Things like selects should be a snap, IMHO. Bill On 5/7/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: My approach has to been to keep everything internal if possible. Thus an interface is public, the implementation is internal. If something is truly necessary, such as OptionModelImpl, there are two approaches: 1) Make the implementation class public (possibly breaking existing code that extends from the internal class) oh, and probably make it final as well. 2) Define a public factory service for the implementation. Right now, you can actually use the TypeCoercer as a kind of factory; if you pass in a comma-separated string and ask for an SelectModel you'll get it. Here, though, you're looking for something a little better adapted to your entity classes. However, a bare-bones implementation of OptionModel (that always returns false for isDisabled(), and null for getAttributes() ) is only a couple of lines of code. I think T4 fell into a trap of too much convenience stuff exposed as public APIs. I would rather err on the side of over-zealousness for T5. You can take internals public, but not the other way around, and once something is public, it also is (or should be) final. On 5/7/07, Bill Holloway [EMAIL PROTECTED] wrote: I've written similar code -- while remembering that OptionModelImpl is an internal class that Howard, in the documentation, has admonished us not to use. Community, what's the better solution? Bill On 5/7/07, Joel Wiegman [EMAIL PROTECTED] wrote: Eureka! Finally got it all working. What caused the drop down to not be defaulting is the fact that I declared my Brand list in two separate lists... One for the ValueEncoder and one for the SelectModel. Big no no! An equals is called on
Re: [T5] Maven2 or Ivy?
I could agree to Howards despair over some of the Maven oddities, but all-in-all I think Maven2 is a very good tool. We use it on all our products, ranging from 5 to 20 modules. We have recently converted from Ant+Ivy, and I surely don''t want to go back! Regards, Olle 2008/3/25, Peter Beshai [EMAIL PROTECTED]: Sorry if this has been mentioned before, but I couldn't find any information about it in my searches (which is perhaps the answer already). I noticed on Howard's blog he condemned the use of Maven2, and I was wondering if there have been any changes to Tapestry5 that make it less maven-centric, or if there are tutorials on building Tapestry applications without maven. Is everyone still using maven2? Ivy? Thanks, Peter Beshai -- Olle Hallin M.Sc. +46 70 6653071 [EMAIL PROTECTED] www.hit.se
Re: [t5] Validator question
Ok no worries. On a related note, where do you put the messages file for a custom validator? In the example below, which looks for a key called 'confirm', I have tried Confirm.properties (in same package as validator called Confirm.java), Signup.properties (the page using the validator) and app.properties. The latter two of course have verifiably working messages. I always get a [[missing key: confirm]] though. Back to my validator question, I couldn't find the JIRA issue you were referring to. BTW, the client side of this type of a validator works quite nicely. In .java: @Validate(required) public String getPassword() { return password; } @Validate(required,confirm=password) public String getConfirmPassword() { return confirmPassword; } On the .tml: script Object.extend(Tapestry.Validator, { confirm: function(field, message, constraint) { Tapestry.addValidator(field, true, function(value, event) { var confirmationSourceField = $(constraint); if (confirmationSourceField == null) { console.error(No such field: + constraint); return; } else if (value != confirmationSourceField.value) { event.recordError(message); } }); } }) /script And in Confirm.java (the validator): public void render(Field field, String sourceFieldId, MessageFormatter formatter, MarkupWriter markupWriter, FormSupport formSupport) { formSupport.addValidation(field, confirm, buildMessage(formatter, field), sourceFieldId); } J On Mar 25, 2008, at 12:27 PM, Howard Lewis Ship wrote: Sorry, those APIs are not in place yet. I have JIRA issue add optional validators, which is a loose, general term for what you are aiming for (password is required if userName is given). I think some relationships may not be expressable using the @Validate annotation, i.e., the string representation; I'm thinking there will be a kind of JavaScript template object that will be used to generate some kinds of JavaScript. Things have slowed down on 5.0 for a moment, while I work on an urgent client project (in Tapestry 5). On Tue, Mar 25, 2008 at 11:08 AM, Julian Wood [EMAIL PROTECTED] wrote: Not possible? Sometimes a validator needs to look at input from another field to see if it is valid (ie password/confirmPassword). I know it's easy to do in onValidateForm, but I'd like to see how to do it in a nice modular Validator. I'm looking for something like: public void validate(Field field, String sourceFieldId, MessageFormatter formatter, Object value) throws ValidationException { Component page = ((AbstractField) field)._resources.getPage(); try { Method getter = page.getClass().getDeclaredMethod(getMethodName(sourceFieldId)); String sourceValue = (String) getter.invoke(page); if (value == null || ! value.toString().equals(sourceValue)) throw new ValidationException(buildMessage(formatter, field)); } catch (Exception e) { log.error(No public getter field in page for: + sourceFieldId); } } but can't do that (the only problem being the private _resources). How can that be done in a Validator? I can't inject anything. I don't actually need to make my own field which exposes the ComponentResources, do I? Thanks. J On Mar 24, 2008, at 5:17 PM, Julian Wood wrote: How can you get access to an arbitrary Field from inside a Validator, given its id? In t4 it was relatively easy to grab the form and from there grab a field. Thanks, J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 and Eclipse 3.3.2 and Tomcat 5.5
Bruce Petro a écrit : Does anyone have suggestions for running/debugging Tapestry using Tomcat 5.5 and working in Eclipse? IE: a) Should you create the eclipse project as a dynamic web project or just a java project or some sort of J2EE project? b) Does a maven-built project map over to the type of project answered in question a? c) Suggestions for pushing war over to tomcat's local directory, debugging through tomcat with code changes visible. d) Any plugins? THANKS! I've given up Tomcat for Jetty and run jetty run plugin. It just works, and as I don't use any specific servlet container API, my web app works on Tomcat without a glitch. And for debug, Jetty reloads well, Tomcat just doesn't. Also, project has not to be a dynamic web project! And if you really need to debug once with Tomcat, you still can open debug port and connect on it with Eclipse. -- Gabriel [EMAIL PROTECTED] http://www.codelutin.com tel : 02 40 50 29 28 / fax : 09 59 92 29 28 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Maven2 or Ivy?
AFAIK maven2 is still being used for the project, although a jar apparently for maven ant tasks appeared in the repo not too long ago. My understanding is that T5 will continue to be distributed by way of maven + repos - poms and all (based on HLS' own responses on this list). I think maven archetypes will also continue to exist. chris Peter Beshai wrote: Sorry if this has been mentioned before, but I couldn't find any information about it in my searches (which is perhaps the answer already). I noticed on Howard's blog he condemned the use of Maven2, and I was wondering if there have been any changes to Tapestry5 that make it less maven-centric, or if there are tutorials on building Tapestry applications without maven. Is everyone still using maven2? Ivy? Thanks, Peter Beshai -- http://thegodcode.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Upload progress, grid sorting
hi all, is there a way to extend the tapestry 5 upload component for some sort of ajax progress. seems that commons fileupload allows to hook in a ProgressListener for ServletFileUpload. My second question is, how can i set the initial sortorder for a grid in tapestry 5.0.11? thank you for your help, harald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie,T5: Grid limitations (long).
Jesper Zedlitz wrote: Alec Leamas wrote: - The paging policy with a fixed number of numbered pages is hardcoded and can't be changed. Other policies e. g., overlap between pages Isn't that something you can handle inside your own GridDataSource? With the page number, the number of results per page, the number of overlapping items (ok, you need a separate parameter for that) it should be possible return the correct entries. Obviouly, I was not clear about this. It's about starting a page at just any item, not just on even page boundaries as defined by the page size. See http://www.nabble.com/T5%2C-newbie%3A-Grid-use-w-dynamic-columns-td16080438.html - It is not possible to change the overall rendering of a row e. g,, to to embed each TR.../TR in a DIV class=xxx TR.../TR/DIV. That is not valid XHTML 1.0 Strict I do not know enough about the Grid component to write something about the other questions. What I miss is the columns attribute from T4's Table component.. Yep, when coming from T4 you miss the column component. Anyway, I don't want to write bad HTML. So after some more RTFM I've concluded that the microformat issue (the tr.../tr above) can be resolved by the rowclass attribute, together with som explicit column fomatting as described in the manual. One item of four resolved. Thanks! --alec - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [T5] Maven2 or Ivy?
Peter, Howard's frustration with Maven comes in the development OF Tapestry, as opposed to development WITH Tapestry. Things that once worked suddenly break as Maven plugins get updated. This has come up from time to time in the Dev list. I've hit similar things, but the visibility (I'm not running an Open Source project) and complexity are vastly different. There has been a clear message that the tapestry jars will continue to be available in Maven repos. The creation of those jars might be moved from Maven. Personally, I'm still using Maven. I like it. It beats the heck out of my old Ant scripts. Jonathan -Original Message- From: Peter Beshai [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 2:05 PM To: Tapestry User Mailing List Subject: [T5] Maven2 or Ivy? Sorry if this has been mentioned before, but I couldn't find any information about it in my searches (which is perhaps the answer already). I noticed on Howard's blog he condemned the use of Maven2, and I was wondering if there have been any changes to Tapestry5 that make it less maven-centric, or if there are tutorials on building Tapestry applications without maven. Is everyone still using maven2? Ivy? Thanks, Peter Beshai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Inner Enums of Pages and Components
If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Maven2 or Ivy?
We're using/investigating Tapestry5 by using our own Ivy repository, which has the required dependencies installed. Working your way through Tapestry (luckily) doesn't force you in using Maven - I gave up on that piece of junk long time ago. Peter Beshai wrote: Sorry if this has been mentioned before, but I couldn't find any information about it in my searches (which is perhaps the answer already). I noticed on Howard's blog he condemned the use of Maven2, and I was wondering if there have been any changes to Tapestry5 that make it less maven-centric, or if there are tutorials on building Tapestry applications without maven. Is everyone still using maven2? Ivy? Thanks, Peter Beshai No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.0/1341 - Release Date: 24-3-2008 15:03 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
This is most likely due to serialization of the enum in the session, I use a workarround that does not affect the code too much, and I can track references to the enum. I persist a string variable, but always use enum.name() to change the variable. I use this to keep track of major blocks that are visible in a page or comp private enum Blocks{EDIT,DETAILS, EDIT_DANGER} I persist the string @Persistprivate String _currentBlock = Blocks.EDIT.name (); I return block: public Block getCurrentBlock(){ return _resources.getBlock(_currentBlock); } whne I change current block, I use the enum public void resetView() { _currentBlock = Blocks.DETAILS.name(); _splitGoodId = null; _containerId = null; } public boolean onGoTo() { resetView(); return true; } public boolean onGoToEditor() { _currentBlock = Blocks.EDIT.name(); return true; } this might be helpfull... and it is not too far from classic usage Davor Hrg On Tue, Mar 25, 2008 at 10:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
That makes totally perfect sense, and yes, I am storing an enum value in session. So I had enum defined internally in the page, and then @Persist on its value... I understand the limitation, and I can only image what cool things could be accomplished if Tapestry was budnled with embedded Jetty public class AddBaseItemArticle { @Persist private DisplayMode _displayMode = DisplayMode.Fresh; /** * Represents modes in which page can be rendered. If page is entered * directly, or if it is reset, display mode is [EMAIL PROTECTED] DisplayMode#Fresh}. * If after fresh input block has been validated and article information * is being collected, the mode is [EMAIL PROTECTED] DisplayMode#BlockValidated}. If * another page referred block input (create new block for a known base * item), then display mode is [EMAIL PROTECTED] DisplayMode#DefineBlock}. Finally, * if another page referred article input (which requires fully defined * block input), display mode is [EMAIL PROTECTED] DisplayMode#DefineArticle}. * * @author Adam Zimowski */ public enum DisplayMode { Fresh, BlockValidated, DefineBlock, DefineArticle } void setDisplayMode(DisplayMode aDisplayMode) { _displayMode = aDisplayMode; } } On Tue, Mar 25, 2008 at 4:57 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
Yeah, I haven't thought of that. I'll give it a shot, it just may work for us :) On Tue, Mar 25, 2008 at 5:03 PM, Davor Hrg [EMAIL PROTECTED] wrote: This is most likely due to serialization of the enum in the session, I use a workarround that does not affect the code too much, and I can track references to the enum. I persist a string variable, but always use enum.name() to change the variable. I use this to keep track of major blocks that are visible in a page or comp private enum Blocks{EDIT,DETAILS, EDIT_DANGER} I persist the string @Persistprivate String _currentBlock = Blocks.EDIT.name (); I return block: public Block getCurrentBlock(){ return _resources.getBlock(_currentBlock); } whne I change current block, I use the enum public void resetView() { _currentBlock = Blocks.DETAILS.name(); _splitGoodId = null; _containerId = null; } public boolean onGoTo() { resetView(); return true; } public boolean onGoToEditor() { _currentBlock = Blocks.EDIT.name(); return true; } this might be helpfull... and it is not too far from classic usage Davor Hrg On Tue, Mar 25, 2008 at 10:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
An idea: I belive it has many pitfalls :(, but might be useful an idea, tapestry could for example extend such enum (persist worker might trigger it) and add serialization code to it. Then when reloading it could force serializing enum values, plus if the value gets serialized outside tapestry it could be better handled (if servlet container serializes it). this might only help enums.. On Tue, Mar 25, 2008 at 10:57 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie,T5: Grid limitations (long).
There's certainly an issue that if the Grid component grew to encompass every possible user's most remote needs, the end result would not be useable by anybody (a Grid component with 27 required parameters of which six are detailed interfaces, etc., etc.). The point is, the common components need to hit a 90/10 rule of usefulness. A secondary goal would be to make the underlying components of Grid (GridRows, GridColumns, GridPager) easy to reuse/extend for a more application-specific Grid implementation. On Tue, Mar 25, 2008 at 2:41 PM, Alec Leamas [EMAIL PROTECTED] wrote: Jesper Zedlitz wrote: Alec Leamas wrote: - The paging policy with a fixed number of numbered pages is hardcoded and can't be changed. Other policies e. g., overlap between pages Isn't that something you can handle inside your own GridDataSource? With the page number, the number of results per page, the number of overlapping items (ok, you need a separate parameter for that) it should be possible return the correct entries. Obviouly, I was not clear about this. It's about starting a page at just any item, not just on even page boundaries as defined by the page size. See http://www.nabble.com/T5%2C-newbie%3A-Grid-use-w-dynamic-columns-td16080438.html - It is not possible to change the overall rendering of a row e. g,, to to embed each TR.../TR in a DIV class=xxx TR.../TR/DIV. That is not valid XHTML 1.0 Strict I do not know enough about the Grid component to write something about the other questions. What I miss is the columns attribute from T4's Table component.. Yep, when coming from T4 you miss the column component. Anyway, I don't want to write bad HTML. So after some more RTFM I've concluded that the microformat issue (the tr.../tr above) can be resolved by the rowclass attribute, together with som explicit column fomatting as described in the manual. One item of four resolved. Thanks! --alec - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
t5: multiple databases with Tapestry-Hibernate
Hi, Can we access multiple databases with Tapestry-Hibernate? any tips to do this? Thanks. -- View this message in context: http://www.nabble.com/t5%3A-multiple-databases-with-Tapestry-Hibernate-tp16294517p16294517.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [t5] Validator question
Actually, I was able to get this done. I had to contributeValidationMessagesSource to get the messages. And to get to the current page component from within the Validator, I was able to do this: public static void contributeFieldValidatorSource (MappedConfigurationString, Validator configuration, @InjectService (ComponentSource)ComponentSource componentSource, @InjectService (Request)Request request ) { configuration.add(confirm, new Confirm(componentSource, request)); } and then: String[] pathComponents = request.getPath().split(/); String pageComponent = pathComponents[pathComponents.length - 1]; String[] pageComponents = pageComponent.split(\\.); Component page = componentSource.getPage(pageComponents[0]); but this seems a little fragile. Is there a better way? I do see what you mean though - there is nowhere to attach a piece of javascript to accompany this validator, so it just goes into my own global library. But I'm pretty happy overall with this solution. J On 25-Mar-08, at 2:13 PM, Julian Wood wrote: Ok no worries. On a related note, where do you put the messages file for a custom validator? In the example below, which looks for a key called 'confirm', I have tried Confirm.properties (in same package as validator called Confirm.java), Signup.properties (the page using the validator) and app.properties. The latter two of course have verifiably working messages. I always get a [[missing key: confirm]] though. Back to my validator question, I couldn't find the JIRA issue you were referring to. BTW, the client side of this type of a validator works quite nicely. In .java: @Validate(required) public String getPassword() { return password; } @Validate(required,confirm=password) public String getConfirmPassword() { return confirmPassword; } On the .tml: script Object.extend(Tapestry.Validator, { confirm: function(field, message, constraint) { Tapestry.addValidator(field, true, function(value, event) { var confirmationSourceField = $(constraint); if (confirmationSourceField == null) { console.error(No such field: + constraint); return; } else if (value != confirmationSourceField.value) { event.recordError(message); } }); } }) /script And in Confirm.java (the validator): public void render(Field field, String sourceFieldId, MessageFormatter formatter, MarkupWriter markupWriter, FormSupport formSupport) { formSupport.addValidation(field, confirm, buildMessage (formatter, field), sourceFieldId); } J On Mar 25, 2008, at 12:27 PM, Howard Lewis Ship wrote: Sorry, those APIs are not in place yet. I have JIRA issue add optional validators, which is a loose, general term for what you are aiming for (password is required if userName is given). I think some relationships may not be expressable using the @Validate annotation, i.e., the string representation; I'm thinking there will be a kind of JavaScript template object that will be used to generate some kinds of JavaScript. Things have slowed down on 5.0 for a moment, while I work on an urgent client project (in Tapestry 5). On Tue, Mar 25, 2008 at 11:08 AM, Julian Wood [EMAIL PROTECTED] wrote: Not possible? Sometimes a validator needs to look at input from another field to see if it is valid (ie password/confirmPassword). I know it's easy to do in onValidateForm, but I'd like to see how to do it in a nice modular Validator. I'm looking for something like: public void validate(Field field, String sourceFieldId, MessageFormatter formatter, Object value) throws ValidationException { Component page = ((AbstractField) field)._resources.getPage(); try { Method getter = page.getClass().getDeclaredMethod(getMethodName(sourceFieldId)); String sourceValue = (String) getter.invoke(page); if (value == null || !value.toString().equals (sourceValue)) throw new ValidationException(buildMessage (formatter, field)); } catch (Exception e) { log.error(No public getter field in page for: + sourceFieldId); } } but can't do that (the only problem being the private _resources). How can that be done in a Validator? I can't inject anything. I don't actually need to make my own field which exposes the ComponentResources, do I? Thanks. J On Mar 24, 2008, at 5:17 PM, Julian Wood wrote: How can you get access to an arbitrary Field from inside a Validator, given its id? In t4 it was relatively easy to grab the form and from there grab a field. Thanks, J
RE: t5: multiple databases with Tapestry-Hibernate
Angelo, I do this routinely using Hibernate via Spring and tapestry-spring, but I haven't tried it with tapestry-hibernate. Looking at the source: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src /main/java/org/apache/tapestry/hibernate/HibernateModule.java?view=markup tapestry-hibernate makes it really easy to use a single database if you conform to the tapestry app-package conventions. You could probably mimic what is being done in HibernateModule to create a second configuration, a second HibernateSessionManager, HibernateSessionSource and a second Session. The problem will then be that you will have multiple options available for each of those, so the injection that works so well now in auto-wiring services will fail. I think you would need to re-write HibernateModule with @InjectService() all over the place. Jonathan -Original Message- From: Angelo Chen [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 10:54 PM To: users@tapestry.apache.org Subject: t5: multiple databases with Tapestry-Hibernate Hi, Can we access multiple databases with Tapestry-Hibernate? any tips to do this? Thanks. -- View this message in context: http://www.nabble.com/t5%3A-multiple- databases-with-Tapestry-Hibernate-tp16294517p16294517.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select box and validation
So to finish this thread, the workaround is to create your own component, copy the entire Select component source, and make one change: void beginRender(MarkupWriter writer) { writer.element(select, name, getControlName(), id, getClientId()); _validate.render(writer); _resources.renderInformalParameters(writer); } That _validate.render(writer) is new. Is this the recommended way for extending components, which I know we're not supposed to (and can't) do? In any case, I feel this behaviour should at least be allowed by the Select component, if not made the default, without having to resort to this solution. I've filed a JIRA: https://issues.apache.org/jira/browse/TAPESTRY-2295 J On 24-Mar-08, at 3:32 PM, Julian Wood wrote: The situation is this: I have a select box in a form, and I want to make it required. This is simple enough, but the blank option disappears when the required validation is applied, client-side validation is not performed, and is indeed not needed, because there are no blank values. As a corollary, the first option is always selected by default upon entry into the form. The problem with this is that users have a tendency to skip these fields which are prepopulated, something which when having a blank option does not happen, so this is not the behaviour that I want. So to change this, I added t:blankoption=always to the select field, to restore the blank option. But now, I am bitten by the previous conclusion that client-side validation is not performed on these fields (in fact there is no client-side validation at all, ever - the paradigm explained here is used to cover the required case). So when combined with other fields which do have client-side validation, this looks quite disjointed. So I'm trying to figure out the best way to accomplish what I want, which is a select box with a blank option, which has a client-side required validation inline with the other client-side required validations. All that is required is the contribution to the Tapestry.validate (...) javascript code snippet by the select field, to get it to behave as wanted, but I can't figure out the proper mechanism for accomplishing this. I'm sure it's something very simple, somewhere, but what? I can see how it is added - org.apache.tapestry.internal.services.ClientBehaviorSupportImpl#addVal idation, coming from org.apache.tapestry.validator.Required#render but why is render called for a TextField with the 'required' validator, but not from a Select field? Anyway, I'm still digging, but maybe someone has a hint. Thanks, J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client side validation and IE
Hey guys, I think I found an easy solution for IE7. Just put the following line on top of the HTML you spit out. !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; -- View this message in context: http://www.nabble.com/Client-side-validation-and-IE-tp16172230p16296063.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]