T5.1 If/Conditional against a method?
Hi all, I've been searching the documentation/examples/list all morning, but can't find an answer to this so far. Can T5.1 do a conditional against a method instead of a variable (property)? I have something like: div t:type=If test=showFoo.../div For the Java, I have tried numerous varieties of: protected boolean showFoo() { ... } (isShowFoo, getShowFoo, etc, etc) I keep getting an exception that it can't convert showFoo to a component parameter binding, then it shows me all the variables (not methods) in my class. Of course, you can't put an @Property on a method, either. Is it not possible in T5 to bind your conditional to a method? (T4 could do this.) Thanks, mrg - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.1 If/Conditional against a method?
Em Thu, 13 Aug 2009 13:34:01 -0300, Michael Gentry mgen...@masslight.net escreveu: Hi all, Hi! div t:type=If test=showFoo.../div Try div t:type=If test=showFoo().../div. Notice the parenthesis. Without them, Tapestry looks for get or is methods. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.1 If/Conditional against a method?
On Aug 13, 2009, at 12:47 PM, Thiago H. de Paula Figueiredo wrote: Em Thu, 13 Aug 2009 13:34:01 -0300, Michael Gentry mgen...@masslight.net escreveu: Hi all, Hi! div t:type=If test=showFoo.../div Try div t:type=If test=showFoo().../div. Notice the parenthesis. Without them, Tapestry looks for get or is methods. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago One can also use the Chenille Kit's OGNL binding and do more complicated tests, I'd imagine. Norman Franke Answering Service for Directors, Inc. www.myasd.com
Re: T5.1 If/Conditional against a method?
If you want the method to be showFoo(), then you need to do test=showFoo(). But you can use test=showFoo if showFoo() is renamed to isShowFoo, iff you change the accessor to public (from protected). That is, for property access, tapestry is following java beans conventions, and a property is only a java beans property if it's public. :) Robert On Aug 13, 2009, at 8/1311:34 AM , Michael Gentry wrote: Hi all, I've been searching the documentation/examples/list all morning, but can't find an answer to this so far. Can T5.1 do a conditional against a method instead of a variable (property)? I have something like: div t:type=If test=showFoo.../div For the Java, I have tried numerous varieties of: protected boolean showFoo() { ... } (isShowFoo, getShowFoo, etc, etc) I keep getting an exception that it can't convert showFoo to a component parameter binding, then it shows me all the variables (not methods) in my class. Of course, you can't put an @Property on a method, either. Is it not possible in T5 to bind your conditional to a method? (T4 could do this.) Thanks, mrg - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.1 If/Conditional against a method?
Thanks Thiago/Robert! Both of your suggestions worked (although I had to change the method to public instead of protected for both). I didn't try Norman's (although I'm sure OGNL would be fine) because I'm not using CK (at least not yet). mrg On Thu, Aug 13, 2009 at 1:02 PM, Robert Zeiglerrobe...@scazdl.org wrote: If you want the method to be showFoo(), then you need to do test=showFoo(). But you can use test=showFoo if showFoo() is renamed to isShowFoo, iff you change the accessor to public (from protected). That is, for property access, tapestry is following java beans conventions, and a property is only a java beans property if it's public. :) Robert On Aug 13, 2009, at 8/1311:34 AM , Michael Gentry wrote: Hi all, I've been searching the documentation/examples/list all morning, but can't find an answer to this so far. Can T5.1 do a conditional against a method instead of a variable (property)? I have something like: div t:type=If test=showFoo.../div For the Java, I have tried numerous varieties of: protected boolean showFoo() { ... } (isShowFoo, getShowFoo, etc, etc) I keep getting an exception that it can't convert showFoo to a component parameter binding, then it shows me all the variables (not methods) in my class. Of course, you can't put an @Property on a method, either. Is it not possible in T5 to bind your conditional to a method? (T4 could do this.) Thanks, mrg - 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