Dom,

This is working great!  Following your example helped me to better
understand the table component too.

Specifically, it never occurred to me that I could generate the string
for the table columns in the class file like this:

public String getTableColumns()
{       //Column id:Column Title:ognl expression
        //value="literal:id, firstName:First
name:name.firstName,lastName:name.lastName, telNo"/>
return 
"data0:ID:getUserDetails('USERGUID'),data1:Email:getUserDetails('EMAIL'),data2:First
Name:getUserDetails('FIRSTNAME'),data3:Last
Name:getUserDetails('LASTNAME')";
}

Here is my page spec:

   <component id="table" type="Contrib:Table">
       <binding name="source" value="users"/>
       <binding name="columns" value="tableColumns"/>
       <binding name="columnsClass" value="literal:title"/>
       <binding name="pageSize" value="10"/>
   </component>

   <component id="data1ColumnValue" type="Block"/>

        <component id="emailLink" type="DirectLink">
        <binding name="listener" value="listener:onShowDetails"/>
        <binding name="parameters"
value="components.table.tableRow.getUserDetails('EMAIL')"/>
        </component>

   <component id="emailLinkDisplay" type="Insert">
        <binding name="value"
value="components.table.tableRow.getUserDetails('EMAIL')"/>
        </component>

and my html:

<table border="1" jwcid="table">
<tr>
<th>id</th><th>email</th>
</tr>
<tr>
<td>1</td>
<td jwcid="data1ColumnValue">
<a href="" jwcid="emailLink">
<span jwcid="emailLinkDisplay">[EMAIL PROTECTED]</span>
</a></td></tr></table>

I am really liking the results, but I feel like I am violating the MVC
separation.  I think that is because my keys (like "LASTNAME") are the
column names I read from a db table's metadata (part of the model).

I guess I am wanting the best of both: MVC separation and not having
to write redundant code to access all the parts of the model.  At the
moment I am not using an ORM to create accessor methods for me, so
that's why I am using a map with db columns (grabbed via metadata
commands) as the keys.

This is kinda OT for Tapestry, but do you think this is violating MVC?

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to