Re: conditional expression

2013-11-18 Thread Thiago H de Paula Figueiredo
On Sun, 17 Nov 2013 15:30:05 -0200, Matthias thegreatme...@gmail.com wrote: @Howard Thanks for your reply. I know that it was possible with Java code, but i tried to avoid to write extra methods for such simple tasks. Please don't ask us how to make your code and templates be worse and

conditional expression

2013-11-17 Thread Matthias
Hi, if theres something in tapestry for inline conditional expressions? I think of something like a href=www.google.com class=${isActive ? 'active' : 'notActive'}google/a I found nothing like that, but i loved to have it. Thanks in advance Matthias

Re: conditional expression

2013-11-17 Thread Howard Lewis Ship
You do it in Java code. public String getLinkClass() { return isActive ? active : notActive; } and just reference ${linkClass} in the template. On Sun, Nov 17, 2013 at 6:30 AM, Matthias thegreatme...@gmail.com wrote: Hi, if theres something in tapestry for inline conditional expressions? I

Re: conditional expression

2013-11-17 Thread Michael
//Binding public class CondBinding extends AbstractBinding { private final Binding conditionBinding; private final Binding trueBinding; private final Binding falseBinding; private final TypeCoercer resolver; public CondBinding(Binding conditionBinding, Binding trueBinding, Binding falseBinding,

Re: conditional expression

2013-11-17 Thread Matthias
@Howard Thanks for your reply. I know that it was possible with Java code, but i tried to avoid to write extra methods for such simple tasks. @Michael WOW! Thats really nice. Exactly what I was looking for. I improved it a bit to make the false value optional. // constructor without

Re: conditional expression

2013-11-17 Thread Howard Lewis Ship
I get nervous about creating new binding factories that then try to parse the (rather complex) property binding syntax, that's all. We've kind of used up all the punctuation and delimiters. On Sun, Nov 17, 2013 at 9:30 AM, Matthias thegreatme...@gmail.com wrote: @Howard Thanks for your reply.

Re: conditional expression

2013-11-17 Thread Boris Horvat
But why would you want that? I can see the benefit but I am afraid that that will just make your tml more complicated where in my mind logic like that belongs in .java just my 2 cents cheers On Sun, Nov 17, 2013 at 6:30 PM, Matthias thegreatme...@gmail.com wrote: @Howard Thanks for your

Re: conditional expression

2013-11-17 Thread Matthias
Hi Boris, in my opinion it makes the tml less complicated and much more readable. Cause you don't have to look into java for just setting a css-class to an element. In my case I tried to add a simple navigation with 3 elements and want to highlight the currently selected: ul