On Tue, 31 Jul 2012 23:02:53 -0300, George Ludwig <georgelud...@gmail.com>
wrote:
The <t:if> component is fine. What is unwieldy are the hoops I'd need to
jump through in order to use it in this particular case.
In this case, seeing your code, I'd write a component that uses
MarkupWriter, not a template, to output the HTML you need. You could even
use the same code you already have, just adapt it to use MarkupWriter
instead of a StringBuilder.
Something like this (inside your component class source):
void beginRender(MarkupWriter writer) {
...
}
That's why we ask people to post what they want to do, not how to do X or
Y, because sometimes X or Y are the wrong approach. ;)
Now having thought about it, I'm not even sure how to replicate the
server
side java code in tmi. Here's the code:
// figure out some display booleans
boolean isYes=this.positiveTermList.contains(member);
boolean isNo=this.negativeTermList.contains(member);
// start row, add hashtag
sb.append("<tr><td >");
sb.append(member);
// add "yes"
sb.append("</td><td>");
if((!isNo&&!isYes)||isNo)
sb.append("<a href=\"/discoveryassistant/refine:addyesterm/"+member+
"\">yes</a>");
else if(isYes)
sb.append("<font color='green'>yes!</font>");
// add "no"
sb.append("</td><td>");
if((!isNo&&!isYes)||isYes)
sb.append("<a href=\"/discoveryassistant/refine:addnoterm/"+member+
"\">no</a>");
else if(isNo)
sb.append("<font color='red'>no!</font>");
// terminate row
sb.append("</td></tr>");
Would I not need to create a wrapper around the member object, and a then
have several boolean methods to return !isNo&&!isYes)||isYes etc.? Does
it
even work if you do <t:if source="member.myBooleanTest">?
On Tue, Jul 31, 2012 at 6:52 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:
On Tue, 31 Jul 2012 21:43:22 -0300, George Ludwig
<georgelud...@gmail.com>
wrote:
I use outputraw because it would be unwieldy to use Tapestry's <t:if>
construct to control the rendering.
Could you please say why you think Tapestry's If component is unwieldy?
And what exactly changes from the if to the else? It seems to me you can
avoid the If, as you could use t:event="prop:eventName" and have a
getEventName() method that defines which event will be triggered.
--
Thiago H. de Paula Figueiredo
------------------------------**------------------------------**---------
To unsubscribe, e-mail:
users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org