You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexandru Dragomir <al...@gmail.com> on 2006/12/19 23:09:02 UTC

EventListener , target being a programatically created widget (dojo)

I might be asking too much :
Is it possible to use the @EventListener with the target being a
programatically created widget ?

The widget is the dojo tree widget.
I built a tapestry component out of it , which creates the tree in a
programatic way.
At the creation of the tree i provide a widgetId.

I want in my page to have something like this :

@EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
public void doSomething() {
}

The event afterAddCHild is an existent event in the widget tree.

I have already tried it.
What i'm not sure is if it should normally work or not since the widgetId
doesn't exist in the html template.

Thanks !
Alex

Re: EventListener , target being a programatically created widget (dojo)

Posted by Alexandru Dragomir <al...@gmail.com>.
It worked.
I just needed to make sure that the id of the widget is the same as the id
of the component. This is what i was missing in the begining.
(And i passed the id as a target.)

Alex

On 12/20/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Have you even tried it?
>
> This is definitely thought out and well supported so I don't see why
> it wouldn't work. Dojo has an internal client side "manager" that
> knows about widgetId's so it lets me do things like
> dojo.widget.byId("yourComponent.clientId") to get a reference to your
> widget without any help from you.
>
> The Tapestry Timetracker demo is a perfect example of this. It targets
> a function of the Autocomplete component which wraps a dojo Select
> widget.
>
> This should be working perfectly. If it does not please let me know.
>
> On 12/19/06, Alexandru Dragomir <al...@gmail.com> wrote:
> > The tapestry component  extends AbstractWidget but i don't think this
> has
> > any influence on targeting the widget..
> >
> > Alex
> >
> > On 12/20/06, Alexandru Dragomir <al...@gmail.com> wrote:
> > >
> > > I'm a bit confused..
> > >
> > > What i want to target is not a tapestry component but the dojo widget
> > > created by the component.
> > > As a matter of fact , in the generated html, the tapestry component id
> is
> > > not even present anymore.
> > > Instead i have the javascript which created the tree with the
> parameters
> > > provided by the tapestry component. And one of the parameter is the
> widgetId
> > > which i want to target.
> > >
> > > The events i would like to listen to are , in fact , the events of the
> > > dojo tree and not of the component i built.
> > > So, very simplified , my component does :
> > > var tree = dojo.widget.createWidget("TreeV3",{widgetId:
> > > "myProvidedWidgetId"});
> > >
> > > I got the feeling my component is wrong  :)
> > >
> > > Alex
> > >
> > >
> > > On 12/20/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > >
> > > > Yes that will work, but only if the component being targeted
> > > > implements IWidget. (or extends AbstractWidget)
> > > >
> > > > On 12/19/06, Alexandru Dragomir <alex.dragomir@gmail.com > wrote:
> > > > > I might be asking too much :
> > > > > Is it possible to use the @EventListener with the target being a
> > > > > programatically created widget ?
> > > > >
> > > > > The widget is the dojo tree widget.
> > > > > I built a tapestry component out of it , which creates the tree in
> a
> > > > > programatic way.
> > > > > At the creation of the tree i provide a widgetId.
> > > > >
> > > > > I want in my page to have something like this :
> > > > >
> > > > > @EventListener(targets="theProvidedWidgetId"
> ,events="afterAddChild")
> > > > > public void doSomething() {
> > > > > }
> > > > >
> > > > > The event afterAddCHild is an existent event in the widget tree.
> > > > >
> > > > > I have already tried it.
> > > > > What i'm not sure is if it should normally work or not since the
> > > > widgetId
> > > > > doesn't exist in the html template.
> > > > >
> > > > > Thanks !
> > > > > Alex
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Jesse Kuhnert
> > > > Tapestry/Dojo team member/developer
> > > >
> > > > Open source based consulting work centered around
> > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: EventListener , target being a programatically created widget (dojo)

Posted by Jesse Kuhnert <jk...@gmail.com>.
Have you even tried it?

This is definitely thought out and well supported so I don't see why
it wouldn't work. Dojo has an internal client side "manager" that
knows about widgetId's so it lets me do things like
dojo.widget.byId("yourComponent.clientId") to get a reference to your
widget without any help from you.

The Tapestry Timetracker demo is a perfect example of this. It targets
a function of the Autocomplete component which wraps a dojo Select
widget.

This should be working perfectly. If it does not please let me know.

On 12/19/06, Alexandru Dragomir <al...@gmail.com> wrote:
> The tapestry component  extends AbstractWidget but i don't think this has
> any influence on targeting the widget..
>
> Alex
>
> On 12/20/06, Alexandru Dragomir <al...@gmail.com> wrote:
> >
> > I'm a bit confused..
> >
> > What i want to target is not a tapestry component but the dojo widget
> > created by the component.
> > As a matter of fact , in the generated html, the tapestry component id is
> > not even present anymore.
> > Instead i have the javascript which created the tree with the parameters
> > provided by the tapestry component. And one of the parameter is the widgetId
> > which i want to target.
> >
> > The events i would like to listen to are , in fact , the events of the
> > dojo tree and not of the component i built.
> > So, very simplified , my component does :
> > var tree = dojo.widget.createWidget("TreeV3",{widgetId:
> > "myProvidedWidgetId"});
> >
> > I got the feeling my component is wrong  :)
> >
> > Alex
> >
> >
> > On 12/20/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > >
> > > Yes that will work, but only if the component being targeted
> > > implements IWidget. (or extends AbstractWidget)
> > >
> > > On 12/19/06, Alexandru Dragomir <alex.dragomir@gmail.com > wrote:
> > > > I might be asking too much :
> > > > Is it possible to use the @EventListener with the target being a
> > > > programatically created widget ?
> > > >
> > > > The widget is the dojo tree widget.
> > > > I built a tapestry component out of it , which creates the tree in a
> > > > programatic way.
> > > > At the creation of the tree i provide a widgetId.
> > > >
> > > > I want in my page to have something like this :
> > > >
> > > > @EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
> > > > public void doSomething() {
> > > > }
> > > >
> > > > The event afterAddCHild is an existent event in the widget tree.
> > > >
> > > > I have already tried it.
> > > > What i'm not sure is if it should normally work or not since the
> > > widgetId
> > > > doesn't exist in the html template.
> > > >
> > > > Thanks !
> > > > Alex
> > > >
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: EventListener , target being a programatically created widget (dojo)

Posted by Alexandru Dragomir <al...@gmail.com>.
The tapestry component  extends AbstractWidget but i don't think this has
any influence on targeting the widget..

Alex

On 12/20/06, Alexandru Dragomir <al...@gmail.com> wrote:
>
> I'm a bit confused..
>
> What i want to target is not a tapestry component but the dojo widget
> created by the component.
> As a matter of fact , in the generated html, the tapestry component id is
> not even present anymore.
> Instead i have the javascript which created the tree with the parameters
> provided by the tapestry component. And one of the parameter is the widgetId
> which i want to target.
>
> The events i would like to listen to are , in fact , the events of the
> dojo tree and not of the component i built.
> So, very simplified , my component does :
> var tree = dojo.widget.createWidget("TreeV3",{widgetId:
> "myProvidedWidgetId"});
>
> I got the feeling my component is wrong  :)
>
> Alex
>
>
> On 12/20/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > Yes that will work, but only if the component being targeted
> > implements IWidget. (or extends AbstractWidget)
> >
> > On 12/19/06, Alexandru Dragomir <alex.dragomir@gmail.com > wrote:
> > > I might be asking too much :
> > > Is it possible to use the @EventListener with the target being a
> > > programatically created widget ?
> > >
> > > The widget is the dojo tree widget.
> > > I built a tapestry component out of it , which creates the tree in a
> > > programatic way.
> > > At the creation of the tree i provide a widgetId.
> > >
> > > I want in my page to have something like this :
> > >
> > > @EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
> > > public void doSomething() {
> > > }
> > >
> > > The event afterAddCHild is an existent event in the widget tree.
> > >
> > > I have already tried it.
> > > What i'm not sure is if it should normally work or not since the
> > widgetId
> > > doesn't exist in the html template.
> > >
> > > Thanks !
> > > Alex
> > >
> > >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: EventListener , target being a programatically created widget (dojo)

Posted by Alexandru Dragomir <al...@gmail.com>.
I'm a bit confused..

What i want to target is not a tapestry component but the dojo widget
created by the component.
As a matter of fact , in the generated html, the tapestry component id is
not even present anymore.
Instead i have the javascript which created the tree with the parameters
provided by the tapestry component. And one of the parameter is the widgetId
which i want to target.

The events i would like to listen to are , in fact , the events of the dojo
tree and not of the component i built.
So, very simplified , my component does :
var tree = dojo.widget.createWidget("TreeV3",{widgetId:
"myProvidedWidgetId"});

I got the feeling my component is wrong  :)

Alex


On 12/20/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Yes that will work, but only if the component being targeted
> implements IWidget. (or extends AbstractWidget)
>
> On 12/19/06, Alexandru Dragomir <al...@gmail.com> wrote:
> > I might be asking too much :
> > Is it possible to use the @EventListener with the target being a
> > programatically created widget ?
> >
> > The widget is the dojo tree widget.
> > I built a tapestry component out of it , which creates the tree in a
> > programatic way.
> > At the creation of the tree i provide a widgetId.
> >
> > I want in my page to have something like this :
> >
> > @EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
> > public void doSomething() {
> > }
> >
> > The event afterAddCHild is an existent event in the widget tree.
> >
> > I have already tried it.
> > What i'm not sure is if it should normally work or not since the
> widgetId
> > doesn't exist in the html template.
> >
> > Thanks !
> > Alex
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: EventListener , target being a programatically created widget (dojo)

Posted by Jesse Kuhnert <jk...@gmail.com>.
Yes that will work, but only if the component being targeted
implements IWidget. (or extends AbstractWidget)

On 12/19/06, Alexandru Dragomir <al...@gmail.com> wrote:
> I might be asking too much :
> Is it possible to use the @EventListener with the target being a
> programatically created widget ?
>
> The widget is the dojo tree widget.
> I built a tapestry component out of it , which creates the tree in a
> programatic way.
> At the creation of the tree i provide a widgetId.
>
> I want in my page to have something like this :
>
> @EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
> public void doSomething() {
> }
>
> The event afterAddCHild is an existent event in the widget tree.
>
> I have already tried it.
> What i'm not sure is if it should normally work or not since the widgetId
> doesn't exist in the html template.
>
> Thanks !
> Alex
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: EventListener , target being a programatically created widget (dojo)

Posted by Alexandru Dragomir <al...@gmail.com>.
In the mean time i found out that the afterAddChild is a topic .
So my problem is solved by subscribing to this topic with whatever function
i want.

I'm still interested in the answer though.

thanks for any feedback !
Alex

On 12/19/06, Alexandru Dragomir <al...@gmail.com> wrote:
>
> I might be asking too much :
> Is it possible to use the @EventListener with the target being a
> programatically created widget ?
>
> The widget is the dojo tree widget.
> I built a tapestry component out of it , which creates the tree in a
> programatic way.
> At the creation of the tree i provide a widgetId.
>
> I want in my page to have something like this :
>
> @EventListener(targets="theProvidedWidgetId" ,events="afterAddChild")
> public void doSomething() {
> }
>
> The event afterAddCHild is an existent event in the widget tree.
>
> I have already tried it.
> What i'm not sure is if it should normally work or not since the widgetId
> doesn't exist in the html template.
>
> Thanks !
> Alex
>
>