You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Jesse Kuhnert <jk...@gmail.com> on 2006/06/11 18:20:05 UTC

annotation design question

For a lot of these new components there are a lot of "events" (aka
functions) that can be connected/listened to via the EventListener
annotation, but no easy way of knowing ~which~ events are available for
listening without going into the js source.

I'd like to be able to create annotation/enum lists of which events are
available for these widgets..Does that make sense? I tried this a while back
but got frustrated when it didn't seem like it was possible to define a base
enum list containing all shared events (basic browser stuff like
onclick/onblur/blah blah) .

Any thoughts on this?

-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: annotation design question

Posted by Norbert Sándor <de...@erinors.com>.
I think that the string version is good enough, I don't see the enum 
version so much more useful. Spindle will probably provide a filtered 
dropdown list anyway ;)
Besides in case of custom component events (like "onOverCountry" in case 
of a map component) the user would get confused because the custom event 
is not in the "common" enumeration.

Please correct me if I misunderstood something :)

An idea: when the @EventListener annotation is processed it would be 
very useful to verify if it has a valid event name. This would prevent 
many runtime errors, even because of simple misspellings!

Regards,
Norbi

Jesse Kuhnert wrote:
> Definitely.
>
> Let's say I have a DatePicker widget/component. The actual javascript
> representation of that widget might have the functions:
>
> onSetDate();
> onDaySelected();
> onYearSelected();
>
> In my page, I would like to be able to do something like:
>
> @EventListener(events = EnumFoo.daySelected, targets="myDatePicker"}
> public void daySelected(BrowserEvent evt)
> {
>
> }
>
> You currently can only do this though:
>
> @EventListener(events = "onDaySelected", targets="myDatePicker"}
> public void daySelected(BrowserEvent evt)
> {
>
> }
>
> This is probably more helpful in auto-completing editors, but does at 
> least
> also expose which functions are available for "listening" on without 
> having
> to define an overly verbose swing style set of useless methods on the
> DatePicker java component.
>
> On 6/11/06, Howard Lewis Ship <hl...@gmail.com> wrote:
>>
>> Not sure I'm following how this would be used; could you provide an
>> example
>> for illustrative purposes?
>>
>> On 6/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>> >
>> > For a lot of these new components there are a lot of "events" (aka
>> > functions) that can be connected/listened to via the EventListener
>> > annotation, but no easy way of knowing ~which~ events are available 
>> for
>> > listening without going into the js source.
>> >
>> > I'd like to be able to create annotation/enum lists of which events 
>> are
>> > available for these widgets..Does that make sense? I tried this a 
>> while
>> > back
>> > but got frustrated when it didn't seem like it was possible to 
>> define a
>> > base
>> > enum list containing all shared events (basic browser stuff like
>> > onclick/onblur/blah blah) .
>> >
>> > Any thoughts on this?
>> >
>> > --
>> > Jesse Kuhnert
>> > Tacos/Tapestry, team member/developer
>> >
>> > Open source based consulting work centered around
>> > dojo/tapestry/tacos/hivemind.
>> >
>> >
>>
>>
>> -- 
>> Howard M. Lewis Ship
>> Independent J2EE / Open-Source Java Consultant
>> Creator and PMC Chair, Apache Tapestry
>> Creator, Jakarta HiveMind
>>
>> Professional Tapestry training, mentoring, support
>> and project work.  http://howardlewisship.com
>>
>>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 2006.06.09.
>   

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


Re: annotation design question

Posted by Jesse Kuhnert <jk...@gmail.com>.
Definitely.

Let's say I have a DatePicker widget/component. The actual javascript
representation of that widget might have the functions:

onSetDate();
onDaySelected();
onYearSelected();

In my page, I would like to be able to do something like:

@EventListener(events = EnumFoo.daySelected, targets="myDatePicker"}
public void daySelected(BrowserEvent evt)
{

}

You currently can only do this though:

@EventListener(events = "onDaySelected", targets="myDatePicker"}
public void daySelected(BrowserEvent evt)
{

}

This is probably more helpful in auto-completing editors, but does at least
also expose which functions are available for "listening" on without having
to define an overly verbose swing style set of useless methods on the
DatePicker java component.

On 6/11/06, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> Not sure I'm following how this would be used; could you provide an
> example
> for illustrative purposes?
>
> On 6/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > For a lot of these new components there are a lot of "events" (aka
> > functions) that can be connected/listened to via the EventListener
> > annotation, but no easy way of knowing ~which~ events are available for
> > listening without going into the js source.
> >
> > I'd like to be able to create annotation/enum lists of which events are
> > available for these widgets..Does that make sense? I tried this a while
> > back
> > but got frustrated when it didn't seem like it was possible to define a
> > base
> > enum list containing all shared events (basic browser stuff like
> > onclick/onblur/blah blah) .
> >
> > Any thoughts on this?
> >
> > --
> > Jesse Kuhnert
> > Tacos/Tapestry, team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind.
> >
> >
>
>
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Jakarta HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: annotation design question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Not sure I'm following how this would be used; could you provide an example
for illustrative purposes?

On 6/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> For a lot of these new components there are a lot of "events" (aka
> functions) that can be connected/listened to via the EventListener
> annotation, but no easy way of knowing ~which~ events are available for
> listening without going into the js source.
>
> I'd like to be able to create annotation/enum lists of which events are
> available for these widgets..Does that make sense? I tried this a while
> back
> but got frustrated when it didn't seem like it was possible to define a
> base
> enum list containing all shared events (basic browser stuff like
> onclick/onblur/blah blah) .
>
> Any thoughts on this?
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com