You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian <ch...@bluepenguin.ch> on 2005/05/28 13:24:26 UTC
who is listening anyways...
Hi folks
I have a page (MessageView) which contains a component (MessageList),
which again is responsible for managing a list of messages in a
contrib:table.
I have recently moved this component out of the page, since it might
become useful later (and for the mere practical reason that the page has
become too fat for my likings :))
Anyways, here comes the situation:
1. when you click on a message header in the contrib:table of the
component, a DirectLink is triggered:
<span jwcid="@DirectLink"
listener="ognl:listeners.actionDisplayMessage"
parameters="ognl:components.table.tableRow.ID">
*
--> *what I would like to achieve here, is that the *page* and not the
component is the listener. Currently I have implemented
public void actionDisplayMessage(IRequestCycle cycle) {
((MessageView)cycle.getPage()).actionDisplayMessage(cycle);
}
in the component. Which is bad, since it makes the component depending
on the page, which is not necessary.
2. This is more or less the other way round: I have a direct link in the
page which has another listener:
<span jwcid="@DirectLink"
listener="ognl:listeners.actionMoveMessage">
Move</span>
Now here I would like to give *both the page and the component* the
chance to catch that event.
--> So my question boils down to:
How can I attach another listener to a directlink event?
Cheers
cs
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: who is listening anyways...
Posted by Geoff Longman <gl...@gmail.com>.
Tapestry does magic behind the scenes that really makes it not
necessary to worry about the interface itself. When you invoke
ognl:listeners.someListener Tapestry has a keen Map implementation
that wraps the someListener method in a synthetic instance of
IActionListener. You could probably get away with the parameter type
being Object actually which is better since tapestry developers
generally don't deal directly with IActionListener (unless they want
to). ergo don't worry about ActionLink vs DirectLink.
Page reference itself? Try ognl:page
Pushing info back out? You could have another parameter that takes an
arbitrary ognl expression that your component invokes when something
happens. Make sense?
Geoff
On 5/30/05, Christian <ch...@bluepenguin.ch> wrote:
> Geoff Longman schrieb:
>
> >If I understand correctly, your component is now hardwired to a page
> >that has a particular listener method. Pretty closely coupled don't
> >you think?
> >
> >Why not add a listener parameter to the component?
> >
> ><parameter name="moveListener" type="IActionListener">
> >
> ><span jwcid="@DirectLink"
> > listener="ognl:moveListener">
> > Move</span>
> >
> >Geoff
> >
> >
> >
> Yes, I would like some "decouplage" here, too. Your suggestion would
> make the fact that the containing page has to provide a certain method
> obsolote.
>
> I got some questions regarding your suggestion, forgive me to jump at
> the chance to have a real pro answered it :)
> IActionListener has a method
> public void actionTriggered(IComponent component, IRequestCycle cycle);
>
> --> how do I get from "actionTriggered(IComponent component,
> IRequestCycle cycle)" to "moveListener(IRequestCycle cycle)""?
> (I guess I don't get a fundamental concept here)
> --> and, ehm, how can the page reference itself? (ognl:this does not
> work ::))
> --> third, isn't IActionListener meant for ActionLinks instead of
> DirectLinks? I got the impression that
> ActionLink==nada and that good boys use DirectLinks
>
> Furthermore this doesn't get me where I would like to go: Some way to be
> able to attach listeners to a kind of well defined event chain and to
> act properly to the event:
> I hope you see what I mean: When some messages are moved, and one of
> those happens to be displayed I should visually display the fact, that
> the message has moved.
>
> Cheers
>
> cs.
>
> ---------------------------------------------------------------------
> 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: who is listening anyways...
Posted by Christian <ch...@bluepenguin.ch>.
Geoff Longman schrieb:
>If I understand correctly, your component is now hardwired to a page
>that has a particular listener method. Pretty closely coupled don't
>you think?
>
>Why not add a listener parameter to the component?
>
><parameter name="moveListener" type="IActionListener">
>
><span jwcid="@DirectLink"
> listener="ognl:moveListener">
> Move</span>
>
>Geoff
>
>
>
Yes, I would like some "decouplage" here, too. Your suggestion would
make the fact that the containing page has to provide a certain method
obsolote.
I got some questions regarding your suggestion, forgive me to jump at
the chance to have a real pro answered it :)
IActionListener has a method
public void actionTriggered(IComponent component, IRequestCycle cycle);
--> how do I get from "actionTriggered(IComponent component,
IRequestCycle cycle)" to "moveListener(IRequestCycle cycle)""?
(I guess I don't get a fundamental concept here)
--> and, ehm, how can the page reference itself? (ognl:this does not
work ::))
--> third, isn't IActionListener meant for ActionLinks instead of
DirectLinks? I got the impression that
ActionLink==nada and that good boys use DirectLinks
Furthermore this doesn't get me where I would like to go: Some way to be
able to attach listeners to a kind of well defined event chain and to
act properly to the event:
I hope you see what I mean: When some messages are moved, and one of
those happens to be displayed I should visually display the fact, that
the message has moved.
Cheers
cs.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: who is listening anyways...
Posted by Geoff Longman <gl...@gmail.com>.
If I understand correctly, your component is now hardwired to a page
that has a particular listener method. Pretty closely coupled don't
you think?
Why not add a listener parameter to the component?
<parameter name="moveListener" type="IActionListener">
<span jwcid="@DirectLink"
listener="ognl:moveListener">
Move</span>
Geoff
On 5/29/05, Christian <ch...@bluepenguin.ch> wrote:
> Pablo Ruggia schrieb:
>
> >
> >you can use "ognl:page.listeners.actionDisplayMessage" as the value of
> >listener parameter to get the Page to listen to that event.
> >
> >
> yepp, perfect, thx
>
>
> >
> >
> >>2. This is more or less the other way round: I have a direct link in the
> >>page which has another listener:
> >><span jwcid="@DirectLink"
> >> listener="ognl:listeners.actionMoveMessage">
> >> Move</span>
> >>Now here I would like to give *both the page and the component* the
> >>chance to catch that event.
> >>
> >>--> So my question boils down to:
> >>How can I attach another listener to a directlink event?
> >>
> >>
> >
> >Mmm, i can't imagine a solution to that.
> >I would call the component listener and then insede it call page
> >listener inside the method.
> >
> >Sorry if i don't understand what you need.
> >
> >
> >
>
> You understood perfectly :) I now simply delegate everything to the page
> (e.g. your suggestion) an let it call whatever method needed from the
> component.
>
> So no listener adding whatsover, but it does the trick,
>
> thank you for your help
>
> Cheers
>
> cs
>
> ---------------------------------------------------------------------
> 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: who is listening anyways...
Posted by Christian <ch...@bluepenguin.ch>.
Pablo Ruggia schrieb:
>
>you can use "ognl:page.listeners.actionDisplayMessage" as the value of
>listener parameter to get the Page to listen to that event.
>
>
yepp, perfect, thx
>
>
>>2. This is more or less the other way round: I have a direct link in the
>>page which has another listener:
>><span jwcid="@DirectLink"
>> listener="ognl:listeners.actionMoveMessage">
>> Move</span>
>>Now here I would like to give *both the page and the component* the
>>chance to catch that event.
>>
>>--> So my question boils down to:
>>How can I attach another listener to a directlink event?
>>
>>
>
>Mmm, i can't imagine a solution to that.
>I would call the component listener and then insede it call page
>listener inside the method.
>
>Sorry if i don't understand what you need.
>
>
>
You understood perfectly :) I now simply delegate everything to the page
(e.g. your suggestion) an let it call whatever method needed from the
component.
So no listener adding whatsover, but it does the trick,
thank you for your help
Cheers
cs
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: who is listening anyways...
Posted by Pablo Ruggia <pr...@gmail.com>.
On 5/28/05, Christian <ch...@bluepenguin.ch> wrote:
> Hi folks
>
> I have a page (MessageView) which contains a component (MessageList),
> which again is responsible for managing a list of messages in a
> contrib:table.
>
> I have recently moved this component out of the page, since it might
> become useful later (and for the mere practical reason that the page has
> become too fat for my likings :))
>
> Anyways, here comes the situation:
> 1. when you click on a message header in the contrib:table of the
> component, a DirectLink is triggered:
> <span jwcid="@DirectLink"
> listener="ognl:listeners.actionDisplayMessage"
> parameters="ognl:components.table.tableRow.ID">
> *
> --> *what I would like to achieve here, is that the *page* and not the
> component is the listener. Currently I have implemented
> public void actionDisplayMessage(IRequestCycle cycle) {
> ((MessageView)cycle.getPage()).actionDisplayMessage(cycle);
> }
> in the component. Which is bad, since it makes the component depending
> on the page, which is not necessary.
you can use "ognl:page.listeners.actionDisplayMessage" as the value of
listener parameter to get the Page to listen to that event.
>
> 2. This is more or less the other way round: I have a direct link in the
> page which has another listener:
> <span jwcid="@DirectLink"
> listener="ognl:listeners.actionMoveMessage">
> Move</span>
> Now here I would like to give *both the page and the component* the
> chance to catch that event.
>
> --> So my question boils down to:
> How can I attach another listener to a directlink event?
Mmm, i can't imagine a solution to that.
I would call the component listener and then insede it call page
listener inside the method.
Sorry if i don't understand what you need.
>
> Cheers
>
> cs
>
> ---------------------------------------------------------------------
> 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