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 Pardeike <an...@pardeike.net> on 2004/11/25 18:18:10 UTC

Help! How to overwrite column/value renderers

Hi,

how can I overwrite the default renderers on a @TableView ?
I like to keep the basic functionality of it but want to
provide my own renderer for the columns and values.

Is this possible? I have spend too much time on this and can't
find a solution. I tried to overwrite it using @Block with the
column name stuff but first, I would need to define the block
for too many different columns and that seems redundant and
second, I am having a hard time to define the ognl expressions
to simulate what the default column header does.

Also, I want to put the TableView into its own component and
suddenly the localized lookup of column names won't work anymore
because the .properties file of the page that contains that
new component isn't any longer visible tot the table. (that's
one reason why I want to overwrite the default renderer).

Andreas Pardeike


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


Re: Help! How to overwrite column/value renderers

Posted by Andreas Pardeike <an...@pardeike.net>.
> On 26 nov 2004, at 09.11, Sakaki wrote:
>
>> You can create new component with nearly the same component
>> specification as
>> TableColumns and write your own html for it but use the same java
>> class. This
>> way you can change only look of the columns and the functionality
>> remains the
>> same.
>>
>> <component-specification
>> class="org.apache.tapestry.contrib.table.components.TableColumns"

That was quite helpful. I am on the right track and I even managed to 
get
most of my subcomponents bound correctly.

However, the only thing left is the <a jwcid="linkColumn"> that sorts 
the
table differently. It seems that I got the parameters up correctly 
(phew!)
but the listener is left to be converted and I have not the slightest 
clue
on how to do this:

<component id="linkColumn" type="DirectLink">

     <binding name="listener" expression="listeners.columnSelected"/>
     <binding name="parameters" expression="new java.lang.Object[] { new 
org.apache.tapestry.util.ComponentAddress(tableModelSource), 
tableColumn.columnName }"/>

</component>

What should I put in there to replace listeners.columnSelected ?

Thanks,
Andreas Pardeike


On 26 nov 2004, at 15.21, Sakaki wrote:

<snip>
>>
>> <span jwcid="$content$">
>>    <span jwcid="iterColumns">
>>      <th jwcid="informal">
>>        <span jwcid="condSorted">
>>          <a jwcid="linkColumn">
>>            <span jwcid="imageSort"/><span jwcid="insertSortedColumn"/>
>>          </a>
>>        </span>
>>        <span jwcid="condNotSorted">
>>          <span jwcid="insertNotSortedColumn"/>
>>        </span>
>>      </th>
>>    </span>
>> </span>
>>
>> and I don't understand how to define all those subcomponents like
>> i.e. 'condSorted' so they bind to the same values as the original
>> column. Since this isn't a straight component tree but some funky
>> columnRenderer stuff I am totally lost in getting the connection
>> to my original TableView and its model and data.
>
> For example:
>
> <component id="condSorted" type="FormConditional">
>    <binding name="condition" expression="tableColumn.sortable"/>
> </component>
>
> you can find this in SimpleTableColumnFormComponent
>
> public boolean getColumnSorted()
> {
>   return getTableColumn().getSortable();
> }


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


Re: Help! How to overwrite column/value renderers

Posted by Sakaki <sa...@gmail.com>.
Andreas Pardeike <andreas <at> pardeike.net> writes:

> 
> On 26 nov 2004, at 09.11, Sakaki wrote:
> 
> > You can create new component with nearly the same component 
> > specification as
> > TableColumns and write your own html for it but use the same java 
> > class. This
> > way you can change only look of the columns and the functionality 
> > remains the
> > same.
> >
> > <component-specification
> > class="org.apache.tapestry.contrib.table.components.TableColumns"
> 
> That's what I tried. The problem is: where do I specify that the
> TableView should use the new column class?
> 
> Here's what I did. Inside <span jwcid="table <at> TableView"> I have replaced
> 
> <span jwcid=" <at> contrib:TableColumns"/>
> with
> <span jwcid=" <at> FSTableColumns"/>
> 
> and duplicated the original  <at> TableColumns that looks like this:
> 
> <span jwcid="$content$">
>    <span jwcid="iterColumns">
>      <th jwcid="informal"><span jwcid="insertColumnRenderer"/></th>
>    </span>
> </span>
> 
> with this:
> 
> <span jwcid="$content$">
>    <span jwcid="iterColumns">
>      <th jwcid="informal">
>        <span jwcid="condSorted">
>          <a jwcid="linkColumn">
>            <span jwcid="imageSort"/><span jwcid="insertSortedColumn"/>
>          </a>
>        </span>
>        <span jwcid="condNotSorted">
>          <span jwcid="insertNotSortedColumn"/>
>        </span>
>      </th>
>    </span>
> </span>
> 
> and I don't understand how to define all those subcomponents like
> i.e. 'condSorted' so they bind to the same values as the original
> column. Since this isn't a straight component tree but some funky
> columnRenderer stuff I am totally lost in getting the connection
> to my original TableView and its model and data.

For example:

<component id="condSorted" type="FormConditional">
   <binding name="condition" expression="tableColumn.sortable"/>
</component>

you can find this in SimpleTableColumnFormComponent

public boolean getColumnSorted()
{
  return getTableColumn().getSortable();
}


> >> Also, I want to put the TableView into its own component and
> >> suddenly the localized lookup of column names won't work anymore
> >> because the .properties file of the page that contains that
> >> new component isn't any longer visible tot the table. (that's
> >> one reason why I want to overwrite the default renderer).
> >
> > You can call your component with the same parameters as the TableView, 
> > cant
> > you ? That way localized column names wont be problem...
> 
> I don't think that it works that way. The default (SimpleTableColumn)
> fetches the properties from the page to translate the column headers
> and this won't work if the table is inside another component (it will
> then try to look up the properties in that components .property file
> (if that component is a generic component that gets the column def
> via the string syntax then I don't want to define all possible column
> names inside that component but in the page that contains that 
> component).
> 
> Andreas Pardeike
> 
So what about getPage().getMessage("") method? you can call it from your 
definition of TableView 

<table jwcid="@Table" ...
columns="ognl:'id:Project id:id, name:'+getMessage('Name.chjc')+':name, 
abbreviation:Abbreviation:abbreviation, customer:Customer:customer, !Action'" 
		row="ognl:project"
		rowsClass="ognl:beans.rowClass.next"
		sortListener="ognl:listeners.sortProjects" 
		filterable="true"  	
		selectable="true" columnSort="ognl:columnSort" 
ascendingSort="ognl:ascendingSort"
		rowSelected="ognl:projectSelected" 
tfoot="ognl:components.deleteSelected" pageSize="5" pagesDisplayed="5"/>	
	





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


Re: Help! How to overwrite column/value renderers

Posted by Andreas Pardeike <an...@pardeike.net>.
On 26 nov 2004, at 09.11, Sakaki wrote:

> You can create new component with nearly the same component 
> specification as
> TableColumns and write your own html for it but use the same java 
> class. This
> way you can change only look of the columns and the functionality 
> remains the
> same.
>
> <component-specification
> class="org.apache.tapestry.contrib.table.components.TableColumns"

That's what I tried. The problem is: where do I specify that the
TableView should use the new column class?

Here's what I did. Inside <span jwcid="table@TableView"> I have replaced

<span jwcid="@contrib:TableColumns"/>
with
<span jwcid="@FSTableColumns"/>

and duplicated the original @TableColumns that looks like this:

<span jwcid="$content$">
   <span jwcid="iterColumns">
     <th jwcid="informal"><span jwcid="insertColumnRenderer"/></th>
   </span>
</span>

with this:

<span jwcid="$content$">
   <span jwcid="iterColumns">
     <th jwcid="informal">
       <span jwcid="condSorted">
         <a jwcid="linkColumn">
           <span jwcid="imageSort"/><span jwcid="insertSortedColumn"/>
         </a>
       </span>
       <span jwcid="condNotSorted">
         <span jwcid="insertNotSortedColumn"/>
       </span>
     </th>
   </span>
</span>

and I don't understand how to define all those subcomponents like
i.e. 'condSorted' so they bind to the same values as the original
column. Since this isn't a straight component tree but some funky
columnRenderer stuff I am totally lost in getting the connection
to my original TableView and its model and data.

>> Also, I want to put the TableView into its own component and
>> suddenly the localized lookup of column names won't work anymore
>> because the .properties file of the page that contains that
>> new component isn't any longer visible tot the table. (that's
>> one reason why I want to overwrite the default renderer).
>
> You can call your component with the same parameters as the TableView, 
> cant
> you ? That way localized column names wont be problem...

I don't think that it works that way. The default (SimpleTableColumn)
fetches the properties from the page to translate the column headers
and this won't work if the table is inside another component (it will
then try to look up the properties in that components .property file
(if that component is a generic component that gets the column def
via the string syntax then I don't want to define all possible column
names inside that component but in the page that contains that 
component).

Andreas Pardeike


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


Re: Help! How to overwrite column/value renderers

Posted by Sakaki <sa...@gmail.com>.
Andreas Pardeike <andreas <at> pardeike.net> writes:

> 
> Hi,
> 
> how can I overwrite the default renderers on a  <at> TableView ?
> I like to keep the basic functionality of it but want to
> provide my own renderer for the columns and values.
> 
You can create new component with nearly the same component specification as 
TableColumns and write your own html for it but use the same java class. This 
way you can change only look of the columns and the functionality remains the 
same.

<component-specification 
class="org.apache.tapestry.contrib.table.components.TableColumns"

> Also, I want to put the TableView into its own component and
> suddenly the localized lookup of column names won't work anymore
> because the .properties file of the page that contains that
> new component isn't any longer visible tot the table. (that's
> one reason why I want to overwrite the default renderer).

You can call your component with the same parameters as the TableView, cant 
you ? That way localized column names wont be problem...


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