You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Aleksej <al...@ivs.lt> on 2005/12/20 11:07:32 UTC
T4: How to invoke listener from other than current page object?
Lets say, I have some listener:
-----
<component id="onItem" type="DirectLink">
<binding name="listener" value="listener:onItemDetails" />
<binding name="parameters" value="item.id" />
</component>
-----
also special navigation service is injected in that page:
-----
<inject property="flow" object="service:mvctest.flow" />
-----
which has IRequestCicle object injected.
'flow' object has set of methods returning IPage, so
to go on ItemDetails page in listener I need only to do next think:
-----
public IPage onItemDetails( Long itemId ){
return getFlow().showItemDetails( itemId );
}
-----
So, the question is:
Can I change somehow 'onItem' component description to point
directly on 'flow' object method?
Something like that ( new onItem ):
-----
<component id="onItem" type="DirectLink">
<binding name="listener" value="listener:flow.showItemDetails" />
<binding name="parameters" value="item.id" />
</component>
-----
The problem for me is that DirectLink component listener parameter
required IActionListener object, and it is almost undocumented :(
I simply don't know where to start.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: T4: How to invoke listener from other than current page object?
Posted by Aleksej <al...@ivs.lt>.
But in this case I must analize parameters from Object[] what is really
not what I want after simple Tapestry4 listeners. Tapestry analizes that
array
of parameters and methods available in object and calls method that fits
most.
Maybe this functionality is accessible manually? Something like method,
which
gets object where listener is, listener name and Object[] with
parameters for that
method, so I could call that method by my self?
Ron Piterman wrote:
> just implement your own IActionListener. That should be pretty
> straight forward.
>
> What tapestry does when you define listener:method is create an
> IActionListener implementation on the fly. now, you could just
> delegate the getFlow().doSomething() method to a method in your
> page/component class or implement the listener yourself. no need to
> use the listener: prefix.
>
> Aleksej wrote:
>
>> Lets say, I have some listener:
>> -----
>> <component id="onItem" type="DirectLink">
>> <binding name="listener" value="listener:onItemDetails" />
>> <binding name="parameters" value="item.id" />
>> </component>
>> -----
>> also special navigation service is injected in that page:
>> -----
>> <inject property="flow" object="service:mvctest.flow" />
>> -----
>> which has IRequestCicle object injected.
>> 'flow' object has set of methods returning IPage, so
>> to go on ItemDetails page in listener I need only to do next think:
>> -----
>> public IPage onItemDetails( Long itemId ){
>> return getFlow().showItemDetails( itemId );
>> }
>> -----
>> So, the question is:
>> Can I change somehow 'onItem' component description to point
>> directly on 'flow' object method?
>> Something like that ( new onItem ):
>> -----
>> <component id="onItem" type="DirectLink">
>> <binding name="listener" value="listener:flow.showItemDetails" />
>> <binding name="parameters" value="item.id" />
>> </component>
>> -----
>>
>> The problem for me is that DirectLink component listener parameter
>> required IActionListener object, and it is almost undocumented :(
>> I simply don't know where to start.
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: T4: How to invoke listener from other than current page object?
Posted by Ron Piterman <rp...@gmx.net>.
just implement your own IActionListener. That should be pretty straight
forward.
What tapestry does when you define listener:method is create an
IActionListener implementation on the fly. now, you could just delegate
the getFlow().doSomething() method to a method in your page/component
class or implement the listener yourself. no need to use the listener:
prefix.
Aleksej wrote:
> Lets say, I have some listener:
> -----
> <component id="onItem" type="DirectLink">
> <binding name="listener" value="listener:onItemDetails" />
> <binding name="parameters" value="item.id" />
> </component>
> -----
> also special navigation service is injected in that page:
> -----
> <inject property="flow" object="service:mvctest.flow" />
> -----
> which has IRequestCicle object injected.
> 'flow' object has set of methods returning IPage, so
> to go on ItemDetails page in listener I need only to do next think:
> -----
> public IPage onItemDetails( Long itemId ){
> return getFlow().showItemDetails( itemId );
> }
> -----
> So, the question is:
> Can I change somehow 'onItem' component description to point
> directly on 'flow' object method?
> Something like that ( new onItem ):
> -----
> <component id="onItem" type="DirectLink">
> <binding name="listener" value="listener:flow.showItemDetails" />
> <binding name="parameters" value="item.id" />
> </component>
> -----
>
> The problem for me is that DirectLink component listener parameter
> required IActionListener object, and it is almost undocumented :(
> I simply don't know where to start.
>
>
>
>
> ---------------------------------------------------------------------
> 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