You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Régis Piccand <gm...@piccand.com> on 2003/11/06 17:47:56 UTC
Render links in table value
Hi all,
I'm trying to render external and internal links as table values.
I use a SimpleTableModel, where the columns are constituted as follows :
private ITableColumn[] getITableColumns()
{
ITableColumn[] cols = new ITableColumn[2] ;
cols[0] = makeColumn("customer", "Customer name", "customer.company1",
false) ;
cols[1] = makeColumn("date", "Date", "date", false) ;
return cols;
}
private ITableColumn makeColumn(String name, String headerDisplay,
String ognlExpression, boolean sorted)
{
return new SimpleTableColumn(name, headerDisplay, new
OgnlTableColumnEvaluator(ognlExpression), sorted)
{
public ITableRendererSource getValueRendererSource()
{
return new LinkRendererSource() ;
}
} ;
}
LinkRendererSource is an inner class as follows :
private class LinkRendererSource implements ITableRendererSource
{
public IRender getRenderer(IRequestCycle arg0, ITableModelSource arg1,
ITableColumn arg2, Object arg3)
{
return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
}
}
LinkRenderer output the a href ...
public class LinkRenderer implements IRender
{
private String _value;
private String _url;
public LinkRenderer(String url, String value)
{
_url = url ;
_value = value ;
}
public void render(IMarkupWriter writer, IRequestCycle arg1)
{
writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
}
}
For now, nothing happens at all ... It prints out the object values,
instead of the links I try in LinkRenderer ... I have the feeling that
getValueRendererSource never gets called. Is that possible ?
I would be very happy if someone could give me some hints/readings, also
for making internal links from within tablevalues ...
Thanks a lot in advance
Best regards,
Régis
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Régis Piccand <gm...@piccand.com>.
Thanks a lot. You are right, it _is_ ok ... I was having problems with
Tomcat picking up the latest builds in conjunction with browser cache
not being emptied ...
For the sake of completness, it works with redefining
getRendererValueSource and getRendererValue.
In my case, I now use setValueRendererSource on ExpressionTableColumn,
which makes things much more readable.
Sorry for bothering ... and thanks a lot
Cheers,
Régis
Mindbridge wrote:
> Hi,
>
> Your code looks ok. There is probably a problem somewhere, but I cannot see
> it right away -- need to trace to find it. But it _looks_ ok.
>
> Here is a suggestion:
>
> (1) Change
>
> private ITableColumn makeColumn(String name, String headerDisplay,
> String ognlExpression, boolean sorted) {
> return new SimpleTableColumn(name, headerDisplay, new
> OgnlTableColumnEvaluator(ognlExpression), sorted)
> {
> ...
> }
> }
>
> to:
>
> private ITableColumn makeColumn(String name, String headerDisplay,
> String ognlExpression, boolean sorted) {
> ExpressionTableColumn col = new ExpressionTableColumn(name,
> headerDisplay, ognlExpression, sorted);
> col.setValueRendererSource(new LinkRendererSource()); // this could be
> just one instance btw
> return col;
> }
>
> This simplifies things a little, which might help.
>
> Does it work like that?
>
>
>
>
> ----- Original Message -----
> From: "Régis Piccand" <gm...@piccand.com>
> To: <ta...@jakarta.apache.org>
> Sent: Thursday, November 06, 2003 6:47 PM
> Subject: Render links in table value
>
>
>
>>Hi all,
>>
>>I'm trying to render external and internal links as table values.
>>
>>I use a SimpleTableModel, where the columns are constituted as follows :
>>
>>
>>
>>private ITableColumn[] getITableColumns()
>>{
>>ITableColumn[] cols = new ITableColumn[2] ;
>>cols[0] = makeColumn("customer", "Customer name", "customer.company1",
>>false) ;
>>cols[1] = makeColumn("date", "Date", "date", false) ;
>>return cols;
>>}
>>
>>private ITableColumn makeColumn(String name, String headerDisplay,
>>String ognlExpression, boolean sorted)
>>{
>>return new SimpleTableColumn(name, headerDisplay, new
>>OgnlTableColumnEvaluator(ognlExpression), sorted)
>>{
>>public ITableRendererSource getValueRendererSource()
>>{
>>return new LinkRendererSource() ;
>>}
>>
>>} ;
>>}
>>
>>
>>
>>LinkRendererSource is an inner class as follows :
>>
>>private class LinkRendererSource implements ITableRendererSource
>>{
>>
>>public IRender getRenderer(IRequestCycle arg0, ITableModelSource arg1,
>>ITableColumn arg2, Object arg3)
>>{
>>return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
>>}
>>
>>}
>>
>>LinkRenderer output the a href ...
>>
>>public class LinkRenderer implements IRender
>>{
>>
>>private String _value;
>>private String _url;
>>
>>public LinkRenderer(String url, String value)
>>{
>>_url = url ;
>>_value = value ;
>>}
>>
>>public void render(IMarkupWriter writer, IRequestCycle arg1)
>>{
>>writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
>>}
>>
>>}
>>
>>For now, nothing happens at all ... It prints out the object values,
>>instead of the links I try in LinkRenderer ... I have the feeling that
>>getValueRendererSource never gets called. Is that possible ?
>>
>>I would be very happy if someone could give me some hints/readings, also
>>for making internal links from within tablevalues ...
>>
>>Thanks a lot in advance
>>
>>Best regards,
>>
>>Régis
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Mindbridge <mi...@yahoo.com>.
Hi,
Your code looks ok. There is probably a problem somewhere, but I cannot see
it right away -- need to trace to find it. But it _looks_ ok.
Here is a suggestion:
(1) Change
private ITableColumn makeColumn(String name, String headerDisplay,
String ognlExpression, boolean sorted) {
return new SimpleTableColumn(name, headerDisplay, new
OgnlTableColumnEvaluator(ognlExpression), sorted)
{
...
}
}
to:
private ITableColumn makeColumn(String name, String headerDisplay,
String ognlExpression, boolean sorted) {
ExpressionTableColumn col = new ExpressionTableColumn(name,
headerDisplay, ognlExpression, sorted);
col.setValueRendererSource(new LinkRendererSource()); // this could be
just one instance btw
return col;
}
This simplifies things a little, which might help.
Does it work like that?
----- Original Message -----
From: "Régis Piccand" <gm...@piccand.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, November 06, 2003 6:47 PM
Subject: Render links in table value
> Hi all,
>
> I'm trying to render external and internal links as table values.
>
> I use a SimpleTableModel, where the columns are constituted as follows :
>
>
>
> private ITableColumn[] getITableColumns()
> {
> ITableColumn[] cols = new ITableColumn[2] ;
> cols[0] = makeColumn("customer", "Customer name", "customer.company1",
> false) ;
> cols[1] = makeColumn("date", "Date", "date", false) ;
> return cols;
> }
>
> private ITableColumn makeColumn(String name, String headerDisplay,
> String ognlExpression, boolean sorted)
> {
> return new SimpleTableColumn(name, headerDisplay, new
> OgnlTableColumnEvaluator(ognlExpression), sorted)
> {
> public ITableRendererSource getValueRendererSource()
> {
> return new LinkRendererSource() ;
> }
>
> } ;
> }
>
>
>
> LinkRendererSource is an inner class as follows :
>
> private class LinkRendererSource implements ITableRendererSource
> {
>
> public IRender getRenderer(IRequestCycle arg0, ITableModelSource arg1,
> ITableColumn arg2, Object arg3)
> {
> return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
> }
>
> }
>
> LinkRenderer output the a href ...
>
> public class LinkRenderer implements IRender
> {
>
> private String _value;
> private String _url;
>
> public LinkRenderer(String url, String value)
> {
> _url = url ;
> _value = value ;
> }
>
> public void render(IMarkupWriter writer, IRequestCycle arg1)
> {
> writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
> }
>
> }
>
> For now, nothing happens at all ... It prints out the object values,
> instead of the links I try in LinkRenderer ... I have the feeling that
> getValueRendererSource never gets called. Is that possible ?
>
> I would be very happy if someone could give me some hints/readings, also
> for making internal links from within tablevalues ...
>
> Thanks a lot in advance
>
> Best regards,
>
> Régis
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Hmmm.... my custom table model stuff does it this way to render Block's
dynamically and it works beautifully. I've got other customizations
that may be affecting this somehow too though.
Erik
On Thursday, November 6, 2003, at 12:27 PM, Régis Piccand wrote:
> Thanks for your answer Erik.
>
> I tried it to without success ...
>
> Régis
>
> Erik Hatcher wrote:
>
>> I think you should override getValueRenderer not
>> getValueRendererSource (which is only internal to the
>> SimpleTableColumn, not the general ITableColumn).
>> Erik
>> On Thursday, November 6, 2003, at 11:47 AM, Régis Piccand wrote:
>>> Hi all,
>>>
>>> I'm trying to render external and internal links as table values.
>>>
>>> I use a SimpleTableModel, where the columns are constituted as
>>> follows :
>>>
>>>
>>>
>>> private ITableColumn[] getITableColumns()
>>> {
>>> ITableColumn[] cols = new ITableColumn[2] ;
>>> cols[0] = makeColumn("customer", "Customer name",
>>> "customer.company1", false) ;
>>> cols[1] = makeColumn("date", "Date", "date", false) ;
>>> return cols;
>>> }
>>> private ITableColumn makeColumn(String name, String
>>> headerDisplay, String ognlExpression, boolean sorted)
>>> {
>>> return new SimpleTableColumn(name, headerDisplay, new
>>> OgnlTableColumnEvaluator(ognlExpression), sorted)
>>> {
>>> public ITableRendererSource getValueRendererSource()
>>> {
>>> return new LinkRendererSource() ;
>>> }
>>>
>>> } ;
>>> }
>>>
>>>
>>>
>>> LinkRendererSource is an inner class as follows :
>>>
>>> private class LinkRendererSource implements ITableRendererSource
>>> {
>>>
>>> public IRender getRenderer(IRequestCycle arg0,
>>> ITableModelSource arg1, ITableColumn arg2, Object arg3)
>>> {
>>> return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
>>> }
>>> }
>>>
>>> LinkRenderer output the a href ...
>>>
>>> public class LinkRenderer implements IRender
>>> {
>>>
>>> private String _value;
>>> private String _url;
>>>
>>> public LinkRenderer(String url, String value)
>>> {
>>> _url = url ;
>>> _value = value ;
>>> }
>>>
>>> public void render(IMarkupWriter writer, IRequestCycle arg1)
>>> {
>>> writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
>>> }
>>>
>>> }
>>>
>>> For now, nothing happens at all ... It prints out the object values,
>>> instead of the links I try in LinkRenderer ... I have the feeling
>>> that getValueRendererSource never gets called. Is that possible ?
>>>
>>> I would be very happy if someone could give me some hints/readings,
>>> also for making internal links from within tablevalues ...
>>>
>>> Thanks a lot in advance
>>>
>>> Best regards,
>>>
>>> Régis
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tapestry-user-help@jakarta.apache.org
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Régis Piccand <gm...@piccand.com>.
Thanks for your answer Erik.
I tried it to without success ...
Régis
Erik Hatcher wrote:
> I think you should override getValueRenderer not getValueRendererSource
> (which is only internal to the SimpleTableColumn, not the general
> ITableColumn).
>
> Erik
>
>
> On Thursday, November 6, 2003, at 11:47 AM, Régis Piccand wrote:
>
>> Hi all,
>>
>> I'm trying to render external and internal links as table values.
>>
>> I use a SimpleTableModel, where the columns are constituted as follows :
>>
>>
>>
>> private ITableColumn[] getITableColumns()
>> {
>> ITableColumn[] cols = new ITableColumn[2] ;
>> cols[0] = makeColumn("customer", "Customer name",
>> "customer.company1", false) ;
>> cols[1] = makeColumn("date", "Date", "date", false) ;
>> return cols;
>> }
>>
>> private ITableColumn makeColumn(String name, String headerDisplay,
>> String ognlExpression, boolean sorted)
>> {
>> return new SimpleTableColumn(name, headerDisplay, new
>> OgnlTableColumnEvaluator(ognlExpression), sorted)
>> {
>> public ITableRendererSource getValueRendererSource()
>> {
>> return new LinkRendererSource() ;
>> }
>>
>> } ;
>> }
>>
>>
>>
>> LinkRendererSource is an inner class as follows :
>>
>> private class LinkRendererSource implements ITableRendererSource
>> {
>>
>> public IRender getRenderer(IRequestCycle arg0,
>> ITableModelSource arg1, ITableColumn arg2, Object arg3)
>> {
>> return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
>> }
>>
>> }
>>
>> LinkRenderer output the a href ...
>>
>> public class LinkRenderer implements IRender
>> {
>>
>> private String _value;
>> private String _url;
>>
>> public LinkRenderer(String url, String value)
>> {
>> _url = url ;
>> _value = value ;
>> }
>>
>> public void render(IMarkupWriter writer, IRequestCycle arg1)
>> {
>> writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
>> }
>>
>> }
>>
>> For now, nothing happens at all ... It prints out the object values,
>> instead of the links I try in LinkRenderer ... I have the feeling that
>> getValueRendererSource never gets called. Is that possible ?
>>
>> I would be very happy if someone could give me some hints/readings,
>> also for making internal links from within tablevalues ...
>>
>> Thanks a lot in advance
>>
>> Best regards,
>>
>> Régis
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Régis Piccand <gm...@piccand.com>.
Thanks for your answer Erik.
I tried it to without success ...
Régis
Erik Hatcher wrote:
> I think you should override getValueRenderer not getValueRendererSource
> (which is only internal to the SimpleTableColumn, not the general
> ITableColumn).
>
> Erik
>
>
> On Thursday, November 6, 2003, at 11:47 AM, Régis Piccand wrote:
>
>> Hi all,
>>
>> I'm trying to render external and internal links as table values.
>>
>> I use a SimpleTableModel, where the columns are constituted as follows :
>>
>>
>>
>> private ITableColumn[] getITableColumns()
>> {
>> ITableColumn[] cols = new ITableColumn[2] ;
>> cols[0] = makeColumn("customer", "Customer name",
>> "customer.company1", false) ;
>> cols[1] = makeColumn("date", "Date", "date", false) ;
>> return cols;
>> }
>>
>> private ITableColumn makeColumn(String name, String headerDisplay,
>> String ognlExpression, boolean sorted)
>> {
>> return new SimpleTableColumn(name, headerDisplay, new
>> OgnlTableColumnEvaluator(ognlExpression), sorted)
>> {
>> public ITableRendererSource getValueRendererSource()
>> {
>> return new LinkRendererSource() ;
>> }
>>
>> } ;
>> }
>>
>>
>>
>> LinkRendererSource is an inner class as follows :
>>
>> private class LinkRendererSource implements ITableRendererSource
>> {
>>
>> public IRender getRenderer(IRequestCycle arg0,
>> ITableModelSource arg1, ITableColumn arg2, Object arg3)
>> {
>> return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
>> }
>>
>> }
>>
>> LinkRenderer output the a href ...
>>
>> public class LinkRenderer implements IRender
>> {
>>
>> private String _value;
>> private String _url;
>>
>> public LinkRenderer(String url, String value)
>> {
>> _url = url ;
>> _value = value ;
>> }
>>
>> public void render(IMarkupWriter writer, IRequestCycle arg1)
>> {
>> writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
>> }
>>
>> }
>>
>> For now, nothing happens at all ... It prints out the object values,
>> instead of the links I try in LinkRenderer ... I have the feeling that
>> getValueRendererSource never gets called. Is that possible ?
>>
>> I would be very happy if someone could give me some hints/readings,
>> also for making internal links from within tablevalues ...
>>
>> Thanks a lot in advance
>>
>> Best regards,
>>
>> Régis
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Render links in table value
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I think you should override getValueRenderer not getValueRendererSource
(which is only internal to the SimpleTableColumn, not the general
ITableColumn).
Erik
On Thursday, November 6, 2003, at 11:47 AM, Régis Piccand wrote:
> Hi all,
>
> I'm trying to render external and internal links as table values.
>
> I use a SimpleTableModel, where the columns are constituted as follows
> :
>
>
>
> private ITableColumn[] getITableColumns()
> {
> ITableColumn[] cols = new ITableColumn[2] ;
> cols[0] = makeColumn("customer", "Customer name",
> "customer.company1", false) ;
> cols[1] = makeColumn("date", "Date", "date", false) ;
> return cols;
> }
>
> private ITableColumn makeColumn(String name, String headerDisplay,
> String ognlExpression, boolean sorted)
> {
> return new SimpleTableColumn(name, headerDisplay, new
> OgnlTableColumnEvaluator(ognlExpression), sorted)
> {
> public ITableRendererSource getValueRendererSource()
> {
> return new LinkRendererSource() ;
> }
>
> } ;
> }
>
>
>
> LinkRendererSource is an inner class as follows :
>
> private class LinkRendererSource implements ITableRendererSource
> {
>
> public IRender getRenderer(IRequestCycle arg0, ITableModelSource
> arg1, ITableColumn arg2, Object arg3)
> {
> return new LinkRenderer("www.lyoba.ch", "visit Gruyère");
> }
>
> }
>
> LinkRenderer output the a href ...
>
> public class LinkRenderer implements IRender
> {
>
> private String _value;
> private String _url;
>
> public LinkRenderer(String url, String value)
> {
> _url = url ;
> _value = value ;
> }
>
> public void render(IMarkupWriter writer, IRequestCycle arg1)
> {
> writer.print("<a href='" + _url + "'>" + _value + "</a>") ;
> }
>
> }
>
> For now, nothing happens at all ... It prints out the object values,
> instead of the links I try in LinkRenderer ... I have the feeling that
> getValueRendererSource never gets called. Is that possible ?
>
> I would be very happy if someone could give me some hints/readings,
> also for making internal links from within tablevalues ...
>
> Thanks a lot in advance
>
> Best regards,
>
> Régis
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org