You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by shymon <sh...@poczta.onet.pl> on 2009/07/07 17:15:05 UTC

ActionLink in bundle message


How can I insert actionLink into message from resource bundle?

I have message with parameter which I replace using messages.format method.
I also create link object with createEventLink() and   element using Element
class.
It almost works, but link created this way has no id so I cannot handle only
it's action.

I have some other solutions to my problem, but I wonder how can I add
id to dynamically created link.
-- 
View this message in context: http://www.nabble.com/ActionLink-in-bundle-message-tp24375267p24375267.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: ActionLink in bundle message

Posted by Kai Weber <ka...@glorybox.de>.
Thiago H. de Paula Figueiredo wrote:
> On Tue, Jul 7, 2009 at 12:15 PM, shymon<sh...@poczta.onet.pl> wrote:
> 
>> I have message with parameter which I replace using messages.format method.
>> I also create link object with createEventLink() and   element using Element
>> class.
>> It almost works, but link created this way has no id so I cannot handle only
>> it's action.
> 
> You don't need a component id to handle its event: just handle the
> event normally:
> 
> @OnEvent("nameOfYourEvent")
> void handle() {...}
> 
> If you create more than one event link this way, generate their links
> with different event names or provide some activation context to them.
> 

Could you elaborate me if i create:

<a href="#" t:type="ActionLink" t:id="detailLink"
t:context="literal:1">more</a>
<a href="#" t:type="ActionLink" t:id="detailLink"
t:context="literal:2">more</a>

and

@OnEvent("detailLink")
void handle(int id) {...}

I always get an exception that the same id is not allowed for a component.

What did I wrong?

Kai

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


Re: ActionLink in bundle message

Posted by shymon <sh...@poczta.onet.pl>.


Thiago H. de Paula Figueiredo wrote:
> 
> On Tue, Jul 7, 2009 at 12:15 PM, shymon<sh...@poczta.onet.pl> wrote:
> 
> You don't need a component id to handle its event: just handle the
> event normally:
> 
> @OnEvent("nameOfYourEvent")
> void handle() {...}
> 
> If you create more than one event link this way, generate their links
> with different event names or provide some activation context to them.
> 
> 

I have done it this way for now. It's simple and good enough.
Was just wondering if I am missing something, and can learn sth. new :)


-- 
View this message in context: http://www.nabble.com/ActionLink-in-bundle-message-tp24375267p24376097.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: ActionLink in bundle message

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, Jul 7, 2009 at 12:15 PM, shymon<sh...@poczta.onet.pl> wrote:

> I have message with parameter which I replace using messages.format method.
> I also create link object with createEventLink() and   element using Element
> class.
> It almost works, but link created this way has no id so I cannot handle only
> it's action.

You don't need a component id to handle its event: just handle the
event normally:

@OnEvent("nameOfYourEvent")
void handle() {...}

If you create more than one event link this way, generate their links
with different event names or provide some activation context to them.

-- 
Thiago

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