You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Bruno Borges <br...@gmail.com> on 2007/05/04 21:36:17 UTC

Concept: Methods versus Listeners

When I've started using Wicket few months ago, I found myself wondering: why
do I have to override methods instead add listeners to my component?

Developing forms is quite strange to me, when I have to override the
onSubmit() method. If we say "Swing-like OO Component Model", why there's no
listeners and events? I say this because I'm thinking on writing a Genesis
Binding <http://genesis.dev.java.net> between Genesis and Wicket, and
because it's lack of listener architecture,  it's impossible to do it
easily. Instead, I have two options only:

1) Write subclasses for every component and base class (almost, re-write
entire Wicket) like GenesisWebPage, GenesisForm, GenesisButton, GenesisThis,
GenesisThat.

2) AspectWerkz. Genesis itself has AOP but the Binding component no. It has
binding with SWT, Swing and Thinlet, but no for any web
framework/technology.

Maybe, listeners/events could resolve some other problems like that one
about onFirstAttach or whatever.

What you guys think?

[]'s
-- 
Bruno Borges
Summa Technologies Inc.
www.summa-tech.com
(48) 8404-1300
(11) 3055-2060

Re: Concept: Methods versus Listeners

Posted by Eelco Hillenius <ee...@gmail.com>.
We (Johan and me) actually discussed this with Jonathan right after we
became active. Jonathan's reason was that he thought it was just
simpler/ more straightforward. On top of that, it saves a little bit
of memory.

Imho, I could live with both, but my preference now would be to keep
what we have for the simple fact that we've had that from the start.
Also, you won't have that many custom classes if you want to implement
it yourself. It's only Form, and maybe Link and a couple of others
right?

Eelco


On 5/4/07, Bruno Borges <br...@gmail.com> wrote:
> When I've started using Wicket few months ago, I found myself wondering: why
> do I have to override methods instead add listeners to my component?
>
> Developing forms is quite strange to me, when I have to override the
> onSubmit() method. If we say "Swing-like OO Component Model", why there's no
> listeners and events? I say this because I'm thinking on writing a Genesis
> Binding <http://genesis.dev.java.net> between Genesis and Wicket, and
> because it's lack of listener architecture,  it's impossible to do it
> easily. Instead, I have two options only:
>
> 1) Write subclasses for every component and base class (almost, re-write
> entire Wicket) like GenesisWebPage, GenesisForm, GenesisButton, GenesisThis,
> GenesisThat.
>
> 2) AspectWerkz. Genesis itself has AOP but the Binding component no. It has
> binding with SWT, Swing and Thinlet, but no for any web
> framework/technology.
>
> Maybe, listeners/events could resolve some other problems like that one
> about onFirstAttach or whatever.
>
> What you guys think?
>
> []'s
> --
> Bruno Borges
> Summa Technologies Inc.
> www.summa-tech.com
> (48) 8404-1300
> (11) 3055-2060
>

Re: Concept: Methods versus Listeners

Posted by Igor Vaynberg <ig...@gmail.com>.
wicket uses callback methods instead of listeners for a simple reason: it is
a smaller memory footprint - there is no list to store, no listener
implementations to serialize. it is further my experience that you very very
rarely need more then one listener, so it cannot justify the overhead imho.

-igor


On 5/4/07, Bruno Borges <br...@gmail.com> wrote:
>
> When I've started using Wicket few months ago, I found myself wondering:
> why
> do I have to override methods instead add listeners to my component?
>
> Developing forms is quite strange to me, when I have to override the
> onSubmit() method. If we say "Swing-like OO Component Model", why there's
> no
> listeners and events? I say this because I'm thinking on writing a Genesis
> Binding <http://genesis.dev.java.net> between Genesis and Wicket, and
> because it's lack of listener architecture,  it's impossible to do it
> easily. Instead, I have two options only:
>
> 1) Write subclasses for every component and base class (almost, re-write
> entire Wicket) like GenesisWebPage, GenesisForm, GenesisButton,
> GenesisThis,
> GenesisThat.
>
> 2) AspectWerkz. Genesis itself has AOP but the Binding component no. It
> has
> binding with SWT, Swing and Thinlet, but no for any web
> framework/technology.
>
> Maybe, listeners/events could resolve some other problems like that one
> about onFirstAttach or whatever.
>
> What you guys think?
>
> []'s
> --
> Bruno Borges
> Summa Technologies Inc.
> www.summa-tech.com
> (48) 8404-1300
> (11) 3055-2060
>