You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2012/10/04 06:38:03 UTC
arithmetic calculations
Folks,
Want to say thanks for the help from engineers... I am receiving output now on my gallery widget... and keepin pluggin away... looks promising.
I have tried to render raw markup in what one could call the page and perform property de-referencing or specify pojo and invoke method with dot notation.
I am trying to do some arithmetic... on the page or what could be called markup space...
and I appear to be getting the expression I specified instead of the actual value or result of the arithmetic expression.
Here is a table row of my gallery header
<td colspan="0">
<div style="font-weight:bold; text-align: center;">
<Label/>
<t:outputRaw value="${cursor} + 1"/>
<Label> to </Label>
<t:if test="cursor">
<t:outputRaw value="${cursor} + min(collection.size,itemsPerPage) "/>
<p:else>
<t:outputRaw value="${cursor} + min(collection.size,itemsPerPage) "/>
</p:else>
</t:if>
<Label> of </Label>
<Label>collection.size</Label>
<Label/>
</div>
</td>
all this table data element does is render something like... "1 to 10 of 50"
which seems like a typical metric for autopaging objects in a gallery.
And I am using arithmetic operations as specified above.
I know Thiago is going to slam me for not putting this in the JAVA module...
Am I compelled to put this in the JAVA... ? or should arithmetic operations be supported in the page space for TAP-5
Thanks for your confirmation.
kcolassi@live.com
Re: arithmetic calculations
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 04 Oct 2012 01:38:03 -0300, Ken in Nashua <kc...@live.com>
wrote:
> Folks,
Hi!
> And I am using arithmetic operations as specified above.
>
> I know Thiago is going to slam me for not putting this in the JAVA
> module...
I'm not slamming you: I'm just saying that you're ignoring over and over
our advice to use the best practices and also to follow the Tapestry 5
philosophy about where to put logic (which is not just Tapestry's). You've
also ignored our advice that the Label component and the <label> HTML
element should only be used for labeling form fields. It's very
frustrating to give the same advice again and again a and being
completely ignored. And this advice isn't made up from me, it's just the
best practices in GUI development in general and Web interfaces in
particular, and best practices which are part of Tapestry 5's philosophy.
> Am I compelled to put this in the JAVA... ?
Yes. If you really want to go ahead and do the wrong thing, use the
ChennileKit's OGNL binding.
> or should arithmetic operations be supported in the page space for TAP-5
No. They never will because it's against the framework philosophy and best
practices in general.
I know you're converting something from T4 from T5. T5 is an evolution
from T4. Some good stuff was added and some bad stuff was dropped. Why
don't you use the fact that you're porting code from T4 to T5 and also
improve it by following the best practices?
I had already given up on answering your repeated question on how to write
logic in Tapestry templates. I've just answered now because my name was
mentioned.
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: arithmetic calculations
Posted by Lance Java <la...@googlemail.com>.
1. The html label is for labelling an input, not for arbitrary text. As has
been mentioned on this list, use a span or similar for arbitrary text.
http://www.w3schools.com/tags/tag_label.asp
2. Instead of ${a} + b, I think you mean ${a + b} (see
http://tapestry.apache.org/property-expressions.html)
3. I'll join Thago in "slamming" you. Tapestry's live class/template
reloading makes it just as simple to put this in a java class as it is to
put it in a template. It then becomes easier to test and re-usable.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/arithmetic-calculations-tp5716614p5716620.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org