You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by samlai <sy...@gmail.com> on 2008/03/02 02:23:15 UTC
Format Output in Grid Table
I have a grid table in "Roster.tml". The grid table prints out information
for "User(s)". An "User" has many properties including rank and status
defined as follow:
public enum Rank {INITIATE, MEMBER, GROUP_ADMIN}
public enum Status {NEW, OLD}
With the template below, the output values for column "Rank" is unformated
(noticed all caps and underscore): INITIATE, MEMBER, GROUP_ADMIN. While the
output values for column "Status" is formated: New, Old.
My question is how to print out formated rank when overriding the "rankCell"
in the Grid table. Obviously, it's not "${user.rank}". Thanks.
Roster.tml
=======
<div id="rosterComp" class="comp"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<div class="title">Roster</div>
<div id="rosterView" class="mainpost">
<t:grid source="userList" row="user" model="model" rowClass="rowClass"
pagerPosition="top" rowsPerPage="20">
<t:parameter name="rankCell">
${user.rank}
</t:parameter>
</t:grid>
</div>
</div>
--
View this message in context: http://www.nabble.com/Format-Output-in-Grid-Table-tp15782616p15782616.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
Re: Format Output in Grid Table
Posted by Howard Lewis Ship <hl...@gmail.com>.
You can peek in at how Tapestry is doing this by looking at the
PropertyDisplayBlocks page.
It comes down to this:
public String getConvertedEnumValue()
{
Enum value = (Enum) _context.getPropertyValue();
if (value == null) return null;
return TapestryInternalUtils.getLabelForEnum(_context.getMessages(),
value);
}
There is not a public API for converting a Enum to a user-presentable
label, so use TapestryInternalUtils at your own risk.
On Sat, Mar 1, 2008 at 5:23 PM, samlai <sy...@gmail.com> wrote:
>
> I have a grid table in "Roster.tml". The grid table prints out information
> for "User(s)". An "User" has many properties including rank and status
> defined as follow:
>
> public enum Rank {INITIATE, MEMBER, GROUP_ADMIN}
>
> public enum Status {NEW, OLD}
>
> With the template below, the output values for column "Rank" is unformated
> (noticed all caps and underscore): INITIATE, MEMBER, GROUP_ADMIN. While the
> output values for column "Status" is formated: New, Old.
>
> My question is how to print out formated rank when overriding the "rankCell"
> in the Grid table. Obviously, it's not "${user.rank}". Thanks.
>
> Roster.tml
> =======
>
> <div id="rosterComp" class="comp"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <div class="title">Roster</div>
>
> <div id="rosterView" class="mainpost">
> <t:grid source="userList" row="user" model="model" rowClass="rowClass"
> pagerPosition="top" rowsPerPage="20">
> <t:parameter name="rankCell">
> ${user.rank}
> </t:parameter>
> </t:grid>
> </div>
> </div>
>
> --
> View this message in context: http://www.nabble.com/Format-Output-in-Grid-Table-tp15782616p15782616.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
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org