FWD: Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Vladimir Bauer
Исходное сообщение Thank you very much for your replies! I'm not the guy who is going to abandon Java boat and Tapestry ) one of my concern was that Manning pub has claimed that Play book being MEAP version is the best seller of the month. Whereas we all remember what they did with Igor Drobiazk

Re: Best place to initialize form data

2012-05-04 Thread Geoff Callender
Ajax? No problem. If the page is only redisplayed due to error then try this: void onPrepareForRender() { // If fresh start, populate screen with initial values if (form.isValid()) { // Do init here... } }

Re: Best place to initialize form data

2012-05-04 Thread Geoff Callender
Just triple-checked the What Is Called And When page and it is correct. http://jumpstart.doublenegative.com.au/jumpstart/examples/navigation/whatiscalledandwhen On 05/05/2012, at 8:41 AM, Thiago H. de Paula Figueiredo wrote: > On Fri, 04 May 2012 16:27:44 -0300, Norman Franke wrote: >

Re: Best place to initialize form data

2012-05-04 Thread Felix Gonschorek
Hi Arno, you can use the onActivate method in the following form: class MyPage { @Property String x; public onActivate(EventContext context) { if (context.getCount() > 0) { this.x = context.get(String.class, 0); } else { this.x = "default value"; } } } the "onA

Re: Is is possible to specify an HREFLANG attribute for an ActionLink?

2012-05-04 Thread Bob Harner
Nevermind, I see Robert.Zeigler asked the same question a few hours ago in a different thread. On Fri, May 4, 2012 at 7:55 PM, Bob Harner wrote: > Maybe I'm misunderstanding the question, but since all Tapestry link > components support informal parameters, why can't you just add it > directly: >

Re: Is is possible to specify an HREFLANG attribute for an ActionLink?

2012-05-04 Thread Bob Harner
Maybe I'm misunderstanding the question, but since all Tapestry link components support informal parameters, why can't you just add it directly: On Fri, May 4, 2012 at 9:04 AM, Julien Martin wrote: > Hello Thiago! > Thanks. I am going to look for relevant documentation (about mixins) and do

Re: Best place to initialize form data

2012-05-04 Thread Arno Haase
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> Thanks for the help - onActivate() at least looks better than >> all ideas I had come up with. It still does not seem like an >> elegant, intuitive solution to me. > > Why not elegant and intuitive? To me, they are. :) Just curious. > ;) If a page

Re: Best place to initialize form data

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 17:59:58 -0300, Arno Haase wrote: Thanks for the help - onActivate() at least looks better than all ideas I had come up with. It still does not seem like an elegant, intuitive solution to me. Why not elegant and intuitive? To me, they are. :) Just curious. ;) -- Thiago

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 16:29:09 -0300, Julien Martin wrote: Thanks anyway to both of you. I wrote my first tapestry mixin today! Congratulations! Mixins are a powerful Tapestry concept which is hard to understand at first, but when you do, it becomes simple. :) This moment usually comes with

Re: Best place to initialize form data

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 16:27:44 -0300, Norman Franke wrote: I'm sorry for not having the time to check this with code now, but I don't think this is correct. As far as I know, onActivate() is only invoked when the page is requested. onPassivate() is invoked every time you generate an event li

TypeCoercer..? Example.?

2012-05-04 Thread sommeralex
Hi! I was upgrading vom Tapestry 2.6 to 3.0 and have one issue: if(encoder == null){ encoder = new EnumValueEncoder(enumType); } return encoder; the EnumValueEncoder does not exist anymore as a contructor with one parameter

Re: Can Component Template be Informed by Page Class

2012-05-04 Thread netdawg
1. Removing @Persist breaks the input form - as designed - not using beaneditor, beaneditform. 2. Changing the person field breaks the grid - again, as designed - workaround being context=0. 3. I have removed the onActivate, OnPassivate - easy. As I see it the app is hanging together, no

Re: Best place to initialize form data

2012-05-04 Thread Arno Haase
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for the help - onActivate() at least looks better than all ideas I had come up with. It still does not seem like an elegant, intuitive solution to me. - - Arno Am 04.05.2012 21:27, schrieb Norman Franke: > On May 4, 2012, at 12:52 PM, Thiago H

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Julien Martin
Thanks anyway to both of you. I wrote my first tapestry mixin today! Regards, Julien. 2012/5/4 Thiago H. de Paula Figueiredo > On Fri, 04 May 2012 15:41:50 -0300, Robert Zeigler < > robert.zeig...@roxanemy.com> wrote: > > Just thinking out loud... not sure why you need a mixin here in the first

Re: Best place to initialize form data

2012-05-04 Thread Norman Franke
On May 4, 2012, at 12:52 PM, Thiago H. de Paula Figueiredo wrote: > On Fri, 04 May 2012 12:31:26 -0300, Norman Franke wrote: > >> Good question. I never came up with a good solution, either, without having >> two events. One can do onActivate(), but if you are doing something slow, >> like rea

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 15:41:50 -0300, Robert Zeigler wrote: Just thinking out loud... not sure why you need a mixin here in the first place? All of tapestry's links support informal parameters. So, eg: Link Should should just work? Ouch, I completely forgot ActionLink and EventLink support

Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Vladimir Bauer
Thank you very much for your replies! I'm not the guy who is going to abandon Java boat and Tapestry ) one of my concern was that Manning pub has claimed that Play book being MEAP version is the best seller of the month. Whereas we all remember what they did with Igor Drobiazko's MEAP Tapestry 5

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Robert Zeigler
Just thinking out loud... not sure why you need a mixin here in the first place? All of tapestry's links support informal parameters. So, eg: Link Should should just work? Robert On May 4, 2012, at 5/412:01 PM , Julien Martin wrote: > Hello, > > I am trying to write/code a mixin that will si

Re: Retrieving and displaying the current locale

2012-05-04 Thread derkoe
Julien Martin wrote > > Hello, > What is the best way to retrieve and display the currently used locale's > language on a page with tapestry? > Thanks in advance, > Julien. > In your page class: @Property(write=false) @Inject Locale locale; In your tml: Current language is: ${locale.language}

Re: Slightly more involved question about creating mixins with Tapestry

2012-05-04 Thread Julien Martin
Thanks to Thiago I managed to get it to work as follows: public class HrefLangMixin { @InjectContainer private ClientElement clientElement;//NEW @Parameter(name = "lang", required = true, defaultPrefix = BindingConstants.LITERAL) private String lang; @AfterRender public void afterRender(MarkupW

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Julien Martin
Hello Thiago, Success! It works. Here is what I tried (was not able to understand the forceAttribute() syntax...). @AfterRender public void afterRender(MarkupWriter writer) { String id = clientElement.getClientId(); Element element = writer.getDocument().getElementById(id); element.attribute("hr

Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 14:11:51 -0300, Jon Williams wrote: EE Java has always included some crap, always will. It's evolving constantly for sure. (...) Conclusion: Java EE is never going away, it's just gonna get better, even more of the stupid excess fat will be refactored or totally abandone

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Julien Martin
Hello Thiago, It does display a hreflang but in the "body" tag as follows: It now just boils down to locating the right "a" tag. Any idea? Regards, Julien. P.S. Sorry for writing to you directly Thiago. 2012/5/4 Julien Martin > Hi, > It does not display any "hreflang" attribute in the

Re: Beginner needs help with writing a mixin

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 14:01:24 -0300, Julien Martin wrote: Hello, Hi! I am trying to write/code a mixin that will simply add the hreflang attribute to tapestry action links. Here is what I tried (it does not work unfortunately...) Please define 'it doesn't work'. ;) You seem to be in the r

Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Jon Williams
EE Java has always included some crap, always will. It's evolving constantly for sure. Oracle has proven that this is their intent to keep making it better. They are doing this for 1 reason, because no matter how you break it down all this truely means to them is more Oracle DB licences (which are

Re: Best place to initialize form data

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 12:31:26 -0300, Norman Franke wrote: Good question. I never came up with a good solution, either, without having two events. One can do onActivate(), but if you are doing something slow, like reading values from a database, I wouldn't recommend it. This is because onAct

Re: Best place to initialize form data

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 12:31:26 -0300, Norman Franke wrote: Good question. I never came up with a good solution, either, without having two events. One can do onActivate(), but if you are doing something slow, like reading values from a database, I wouldn't recommend it. This is because onAct

Re: Possible to build a Table from multiple sources?

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 12:48:43 -0300, Az Madu wrote: java.lang.reflect.InvocationTargetExceptiontargetExceptionorg.apache.tapestry5.ioc.internal.OperationException: Unable to create new accessor method public int getPosition() on class com.sony.otg.c3demoapp.pages.DoStuff as the method is already

Re: Possible to build a Table from multiple sources?

2012-05-04 Thread Az Madu
With all distractions I have right now I haven't had a lot of time to finish my table, but I got back to it and followed advise from you guys and a similar example to my own which seems very straight forward. I'm following the 'Grid row highlighter demo

Re: Best place to initialize form data

2012-05-04 Thread Norman Franke
On May 4, 2012, at 8:53 AM, Arno Haase wrote: >>> onPrepare() is called before data binding, but it is called >>> again after data binding. So simple initialization code in >>> onPrepare() would overwrite the form data with the default. >> >> This isn't correct. It's called once per request. And

Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 10:57:57 -0300, Vladimir Bauer wrote: Is it really anything based on servlet api, Tapestry for example, is a dying technology? By the way, what does the death or dying of a technology is? I'd say it's the same as with natural languages: they die when nobody use them any

Re: Tapestry 5 vs Play! 2

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 10:57:57 -0300, Vladimir Bauer wrote: Dear experts, I'm no expert, but hi! :) Reading introductory chapter of his book, I had a picture that anything relying on Java EE is dying technology (or author wanted to crea

Tapestry 5 vs Play! 2

2012-05-04 Thread Vladimir Bauer
Dear experts, The author of the Play! 2 framework claims the Play! 2 to be as high-productivity and scalable web framework, Because it doesn't rely on any Java EE layer such as servlet api, though can use JVM and java api. Reading introductory chapter

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 10:32:12 -0300, wout86 wrote: I disagree. Tapestry would need to persist the validators somehow. Ok, if it isn't persisting the TextField already, I agree with you. But I thought it did that somehow. Nope, TextField doesn't persist anything. -- Thiago H. de Paula Figu

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread Lance Java
The onPrepare() event will be fired in both cases (rendering the form and submitting the form). -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685917.html Sent from the Tapestry - User mailing list archive at

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread wout86
>I disagree. Tapestry would need to persist the validators somehow. Ok, if it isn't persisting the TextField already, I agree with you. But I thought it did that somehow. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 10:16:33 -0300, wout86 wrote: Anyway, after inspecting the stack trace, I found out that Tapestry is re-evaluating the /validate/ parameter of a TextField upon form submission. More specifically, when the form is submitted, the TextField is asked to validate itself and

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread wout86
PS: If I recall correctly, a component can only be implemented in terms of render event handlers, and the activate event isn't a render event (http://tapestry.apache.org/component-rendering.html). Either way, I tried to add an onActivate() method to be sure, and it didn't get invoked. -- View this

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread wout86
I know, it's only called during (before) rendering. Anyway, after inspecting the stack trace, I found out that Tapestry is re-evaluating the /validate/ parameter of a TextField upon form submission. More specifically, when the form is submitted, the TextField is asked to validate itself and to thi

Re: Is is possible to specify an HREFLANG attribute for an ActionLink?

2012-05-04 Thread Julien Martin
Hello Thiago! Thanks. I am going to look for relevant documentation (about mixins) and do as you advised. Regards, Julien. 2012/5/4 Thiago H. de Paula Figueiredo > On Fri, 04 May 2012 09:36:40 -0300, Julien Martin > wrote: > > Hello, >> > > Hi! > > > I need to be able to specify the anchor's

Re: Best place to initialize form data

2012-05-04 Thread Arno Haase
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> onPrepare() is called before data binding, but it is called >> again after data binding. So simple initialization code in >> onPrepare() would overwrite the form data with the default. > > This isn't correct. It's called once per request. And Tapes

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread Lance Java
setupRender() will not be called on form submission http://jumpstart.doublenegative.com.au/jumpstart/examples/navigation/whatiscalledandwhen I'm still not sure I entirely understand what it is that you are doing but perhaps you need to put your logic in onActivate() -- View this message in contex

Re: Is is possible to specify an HREFLANG attribute for an ActionLink?

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 09:36:40 -0300, Julien Martin wrote: Hello, Hi! I need to be able to specify the anchor's hreflang attribute for a ActionLink. There does not seem to be any such attribute for the tapestry action link. Is there a workaround? You can write a mixin that adds this attribu

Re: Best place to initialize form data

2012-05-04 Thread Thiago H. de Paula Figueiredo
On Fri, 04 May 2012 08:43:27 -0300, Arno Haase wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, this may be an obvious newbie question, but I have found no answer that looks good to me. Anyway, here goes: What is the best place to initialize a property with a default value

Is is possible to specify an HREFLANG attribute for an ActionLink?

2012-05-04 Thread Julien Martin
Hello, I need to be able to specify the anchor's hreflang attribute for a ActionLink. There does not seem to be any such attribute for the tapestry action link. Is there a workaround? Regards, Julien.

Best place to initialize form data

2012-05-04 Thread Arno Haase
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, this may be an obvious newbie question, but I have found no answer that looks good to me. Anyway, here goes: What is the best place to initialize a property with a default value for a form? I am looking at a page that makes heavy use of

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread wout86
Full error output: ERROR org.apache.tapestry5.ioc.Registry - Failure reading parameter 'validate' of component MyPage:fieldID: Component MyPage does not contain a stored render variable with name 'validators'. Stored render variables: (none). ERROR org.apache.tapestry5.ioc.Registry - Operations t

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread wout86
Yup, I avoided that code because I'd like the customcomponent to be flexible, not requiring a specific type of Field in its body, or a specific name for that Field. In the meanwhile, I've been able to get the field reference in the custom component as follows: This works , but: apparently t

Re: Tapestry-Boostrap Alpha 2 available

2012-05-04 Thread Immutability
Barry, I really love your work on the tapestry-bootstrap and I'm just trying to use it for one of our projects. I'm using the latest snapshot jar of the library and so far everything worked nicely but now I'm trying to use the bootstrap supported help-block within a BeanEditForm. I was looking at t

Re: Can Component Template be Informed by Page Class

2012-05-04 Thread Lance Java
I've just gone through the thread here http://tapestry.1045711.n5.nabble.com/Pagelink-above-grid-picks-up-context-from-last-pagelink-in-grid-td5660049.html And I've taken out a few comments: --- Can I see the serverside code for your edit page? I get the fe

Re: Is it possible to add Field validators at render-time?

2012-05-04 Thread Lance Java
There was a slight typo in my solution before (I used @Inject instead of @InjectComponent) Is there something stopping you from doing this in your component? public class MyComponent { @InjectComponent private Field textField; } -- View this message in context: http://tapestry.1045711.n5