You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Vombach <an...@psi.ch> on 2004/10/21 16:32:41 UTC

Styling for TableColumns

I would like to style up my table columns in a way that their display 
names are not given in a string but set by a java class.
This is useful e.g. to put all days of a month in a table header like | 
Fr, 1. | Sa, 2. | So, 3...
I do so using the SimpleTableColumn class:

            for (int i = 1; i < 32; i++)
            {
                String dn = getDayName(i);
                 list.add(new SimpleTableColumn("wh_" + i + "ID", dn + 
", " + i + ".", false));
            }
            setWorksheetColumns(list);

(former it was !wh_1ID:1:wh_1, !wh_2ID:2:wh_2, !wh_3ID:3:wh_3 ...)

    <span jwcid="wh_1IDColumnValue@Block">
    <span jwcid="editableWh_1@TextField" 
value="ognl:components.table.tableRow.wh_1" size="3"/>
    </span>

Unfortunately the Table does not get the link to the wh_1ID etc. 
anymore, how do I do it right?
I guess the mistake is that the |strColumnName of the |SimpleTableColumn 
does not connect to colunm IDs?

Thanks Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: more styling for TableColumns

Posted by Markus Wiederkehr <ma...@gmail.com>.
Table has some parameters to control the CSS class of table pages,
columns, rows and values (pagesClass, columnsClass, rowsClass and
valuesClass). You can use these parameters to apply some basic styles
to your table. You could bind an EvenOdd bean to rowsClass, for
example.

But you have even more control. The first parameter of
SimpleTableColumn or ExpressionTableColumn is the column name (the
parameter 'columns' of Table works as well). This name is used as CSS
class of the corresponding column. For example if the column name is
'date' the table will contain cells like this: <td
class="dateColumnValue">. Now all you have to do is to apply a style
to 'td.dateColumnValue'.

See http://jakarta.apache.org/tapestry/doc/ComponentReference/contrib.Table.html
for more details.

On Fri, 22 Oct 2004 10:27:15 +0200, Andreas Vombach
<an...@psi.ch> wrote:
> Thank you, Markus, the setValueRendererSource works well.
> Now, for even more styling the TableColumns I would like to set things
> like the background color and other attributes.
> I guess this is done in the style.css, anybody knows the naming?
> (table.header, th or other)
> Or another way to do it?
> 
> Thanks Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


more styling for TableColumns

Posted by Andreas Vombach <an...@psi.ch>.
Thank you, Markus, the setValueRendererSource works well.
Now, for even more styling the TableColumns I would like to set things 
like the background color and other attributes.
I guess this is done in the style.css, anybody knows the naming? 
(table.header, th or other)
Or another way to do it?

Thanks Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Styling for TableColumns

Posted by Markus Wiederkehr <ma...@gmail.com>.
I think you have to use setValueRendererSource():

SimpleTableColumn c = new SimpleTableColumn("wh_" + i +
    "ID", dn + ", " + i + ".", false));
c.setValueRendererSource(new BlockTableRendererSource(
    new ComponentAddress(getComponent("wh_" + i + "IDColumnValue"))));
list.add(c);

hth
Markus

On Thu, 21 Oct 2004 16:32:41 +0200, Andreas Vombach
<an...@psi.ch> wrote:
> I would like to style up my table columns in a way that their display
> names are not given in a string but set by a java class.
> This is useful e.g. to put all days of a month in a table header like |
> Fr, 1. | Sa, 2. | So, 3...
> I do so using the SimpleTableColumn class:
> 
>             for (int i = 1; i < 32; i++)
>             {
>                 String dn = getDayName(i);
>                  list.add(new SimpleTableColumn("wh_" + i + "ID", dn +
> ", " + i + ".", false));
>             }
>             setWorksheetColumns(list);
> 
> (former it was !wh_1ID:1:wh_1, !wh_2ID:2:wh_2, !wh_3ID:3:wh_3 ...)
> 
>     <span jwcid="wh_1IDColumnValue@Block">
>     <span jwcid="editableWh_1@TextField"
> value="ognl:components.table.tableRow.wh_1" size="3"/>
>     </span>
> 
> Unfortunately the Table does not get the link to the wh_1ID etc.
> anymore, how do I do it right?
> I guess the mistake is that the |strColumnName of the |SimpleTableColumn
> does not connect to colunm IDs?
> 
> Thanks Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org