You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sebastian Hennebrueder <us...@laliluna.de> on 2009/09/03 11:39:11 UTC

Extending ActionLink

Hello,
I try to extend ActionLink in order to get rendered the following code.

<t:actionlink t:id="delete" context="aModel.id">
    <img src="${context:images/delete.png}" alt="Delete image" 
title="message:icon_delete"/>
</t:actionlink>

using something like this in my template

<t:delete context="aModel.id"/>

My first try had the effect that the actionlink rendered  like this 
inside of a loop.
http://localhost:8080/content/editreadlist.delete_0.delete/$005bLjava.lang.Object$003b$00407369f6b9?t:ac=770671

Do you have any ideas, how I can achieve what I wanted?

I used the following class
public class Delete {

   
    @Parameter
    private Object[] context;

    public Object[] getContext() {
        return context;
    }


}
with the following template.
<body xmlns="http://www.w3.org/1999/xhtml"
            xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">

<t:actionlink t:id="delete" context="${context}">
    <img src="${context:images/delete.png}" alt="Delete image" 
title="message:icon_delete"/>
</t:actionlink>

</body>

-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de




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


Re: Extending ActionLink

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 03 Sep 2009 10:07:56 -0300, Sebastian Hennebrueder  
<us...@laliluna.de> escreveu:

> the problem is not the encoded parameter, which is probably due to the  
> fact that there is an Object array.

You should *never* use an expression (${}) when passing parameters to a  
component, as it cause its value to be coerced to a String before being  
passed to the component.

> I just want to get the onActionFromDelete called and not an  
> onActionFromDelete_0

In inside a loop or grid, there's no solution I can recall. If not, use  
EventLink instead.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: Extending ActionLink

Posted by Sebastian Hennebrueder <us...@laliluna.de>.
Felix Gonschorek schrieb:
> hi
> 
> Sebastian Hennebrueder schrieb:
>> <t:actionlink t:id="delete" context="${context}">
> 
> shouldn't this be:
> 
> <t:actionlink t:id="delete" context="context">
> 
> ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
Hello Felix,

the problem is not the encoded parameter, which is probably due to the 
fact that there is an Object array.

I just want to get the onActionFromDelete called and not an 
onActionFromDelete_0
-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de



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


Re: Extending ActionLink

Posted by Felix Gonschorek <fe...@ggmedia.net>.
hi

Sebastian Hennebrueder schrieb:
> <t:actionlink t:id="delete" context="${context}">

shouldn't this be:

<t:actionlink t:id="delete" context="context">

?

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


Re: Extending ActionLink

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
yes, you can do it with css! :) just apply an invisble border.
on hover you just set your color. this prevents layout to "shake"
(redraw)

you're right you don't need an ValueEncoder.a TypeCoercer is
used to convert the context type. it seems like your context object
is being serialized but i cannot find a TypeCoerceTuple doing
this. nor do i understand why it is doing that. i'll try it myself and 
report tomorrow





Sebastian Hennebrueder <us...@laliluna.de> 
03.09.2009 12:20
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: Extending ActionLink







Kristian Marinkovic schrieb:
> what type is "aModel.id"?
> 
aModel is a simple domain class, where as id is an Integer value

But I don't think that this is the problem.

> maybe you have to register an own ValueEncoder to 
> convert "aModel.id" to a valid client representation
> and vice versa. 
no
> 
> just out of curiosity: why dont you define a .btn_delete
> css class? should be easier.
The title of the image is used to show a help bubble and I want to show 
an ALT attribute to follow HTML standards as well.
I am not sure if an background image of the action link alines properly 
if I apply a hoover effect to it showing a thin border.

Best Regards

Sebastian Hennebrueder
> 
> g,
> kris
> 
> 
> 
> 
> 
> Sebastian Hennebrueder <us...@laliluna.de> 
> 03.09.2009 11:39
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
> 
> 
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
> 
> Thema
> Extending ActionLink
> 
> 
> 
> 
> 
> 
> 
> Hello,
> I try to extend ActionLink in order to get rendered the following code.
> 
> <t:actionlink t:id="delete" context="aModel.id">
>     <img src="${context:images/delete.png}" alt="Delete image" 
> title="message:icon_delete"/>
> </t:actionlink>
> 
> using something like this in my template
> 
> <t:delete context="aModel.id"/>
> 
> My first try had the effect that the actionlink rendered  like this 
> inside of a loop.
> 
http://localhost:8080/content/editreadlist.delete_0.delete/$005bLjava.lang.Object$003b$00407369f6b9?t:ac=770671

> 
> 
> Do you have any ideas, how I can achieve what I wanted?
> 
> I used the following class
> public class Delete {
> 
> 
>     @Parameter
>     private Object[] context;
> 
>     public Object[] getContext() {
>         return context;
>     }
> 
> 
> }
> with the following template.
> <body xmlns="http://www.w3.org/1999/xhtml"
>             xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
> 
> <t:actionlink t:id="delete" context="${context}">
>     <img src="${context:images/delete.png}" alt="Delete image" 
> title="message:icon_delete"/>
> </t:actionlink>
> 
> </body>
> 



-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de



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



Re: Extending ActionLink

Posted by Sebastian Hennebrueder <us...@laliluna.de>.
Kristian Marinkovic schrieb:
> what type is "aModel.id"?
> 
aModel is a simple domain class, where as id is an Integer value

But I don't think that this is the problem.

> maybe you have to register an own ValueEncoder to 
> convert "aModel.id" to a valid client representation
> and vice versa. 
no
> 
> just out of curiosity: why dont you define a .btn_delete
> css class? should be easier.
The title of the image is used to show a help bubble and I want to show 
an ALT attribute to follow HTML standards as well.
I am not sure if an background image of the action link alines properly 
if I apply a hoover effect to it showing a thin border.

Best Regards

Sebastian Hennebrueder
> 
> g,
> kris
> 
> 
> 
> 
> 
> Sebastian Hennebrueder <us...@laliluna.de> 
> 03.09.2009 11:39
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
> 
> 
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
> 
> Thema
> Extending ActionLink
> 
> 
> 
> 
> 
> 
> 
> Hello,
> I try to extend ActionLink in order to get rendered the following code.
> 
> <t:actionlink t:id="delete" context="aModel.id">
>     <img src="${context:images/delete.png}" alt="Delete image" 
> title="message:icon_delete"/>
> </t:actionlink>
> 
> using something like this in my template
> 
> <t:delete context="aModel.id"/>
> 
> My first try had the effect that the actionlink rendered  like this 
> inside of a loop.
> http://localhost:8080/content/editreadlist.delete_0.delete/$005bLjava.lang.Object$003b$00407369f6b9?t:ac=770671
> 
> 
> Do you have any ideas, how I can achieve what I wanted?
> 
> I used the following class
> public class Delete {
> 
>  
>     @Parameter
>     private Object[] context;
> 
>     public Object[] getContext() {
>         return context;
>     }
> 
> 
> }
> with the following template.
> <body xmlns="http://www.w3.org/1999/xhtml"
>             xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
> 
> <t:actionlink t:id="delete" context="${context}">
>     <img src="${context:images/delete.png}" alt="Delete image" 
> title="message:icon_delete"/>
> </t:actionlink>
> 
> </body>
> 



-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de



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


Re: Extending ActionLink

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
what type is "aModel.id"?

maybe you have to register an own ValueEncoder to 
convert "aModel.id" to a valid client representation
and vice versa. 

just out of curiosity: why dont you define a .btn_delete
css class? should be easier.

g,
kris





Sebastian Hennebrueder <us...@laliluna.de> 
03.09.2009 11:39
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Extending ActionLink







Hello,
I try to extend ActionLink in order to get rendered the following code.

<t:actionlink t:id="delete" context="aModel.id">
    <img src="${context:images/delete.png}" alt="Delete image" 
title="message:icon_delete"/>
</t:actionlink>

using something like this in my template

<t:delete context="aModel.id"/>

My first try had the effect that the actionlink rendered  like this 
inside of a loop.
http://localhost:8080/content/editreadlist.delete_0.delete/$005bLjava.lang.Object$003b$00407369f6b9?t:ac=770671


Do you have any ideas, how I can achieve what I wanted?

I used the following class
public class Delete {

 
    @Parameter
    private Object[] context;

    public Object[] getContext() {
        return context;
    }


}
with the following template.
<body xmlns="http://www.w3.org/1999/xhtml"
            xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
">

<t:actionlink t:id="delete" context="${context}">
    <img src="${context:images/delete.png}" alt="Delete image" 
title="message:icon_delete"/>
</t:actionlink>

</body>

-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de




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