[ 
https://issues.apache.org/jira/browse/WICKET-3516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029483#comment-13029483
 ] 

Bertrand Guay-Paquet edited comment on WICKET-3516 at 5/5/11 6:24 PM:
----------------------------------------------------------------------

I have finally gotten around to using this new feature! Ater implementing a 
first Behavior event sink, I noticed that Behavior#onEvent(IEvent<?>) is the 
only Behavior method which does not receive a reference to the attached 
Component. This means that a Behavior which wants to work on a Component when 
an Event is received must keep a reference to its Component. Because of that, 
such Behaviors cannot be reused across different components.

Could the onEvent method signature be modified like so:
        public void onEvent(Component component, IEvent<?> event) ?

Modifying the signature as proposed entails dropping the IEventSink interface 
as it is which complicates matters for IEventDispatcher.

What do you think? Is there a way to work around this issue and make 
Behavior#onEvent more like other Behavior methods?

      was (Author: berniegp):
    I have finally gotten around to using this new feature! Ater implementing a 
first Behavior event sink, I noticed that Behavior#onEvent(IEvent<?>) is the 
only Behavior method which does not receive a reference to the attached 
Component. This means that a Behavior which wants to work on a Component when 
an Event is received must keep a reference to its Component. Because of that, 
such Behaviors cannot be reused across different components.

Could we the onEvent method signature be modified like so:
        public void onEvent(Component component, IEvent<?> event) ?

Modifying the signature as proposed entails dropping the IEventSink interface 
as it is which complicates matters for IEventDispatcher.

What do you think? Is there a way to work around this issue and make 
Behavior#onEvent more like other Behavior methods?
  
> Add behaviors to the event processing chain
> -------------------------------------------
>
>                 Key: WICKET-3516
>                 URL: https://issues.apache.org/jira/browse/WICKET-3516
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>            Reporter: Bertrand Guay-Paquet
>            Assignee: Martin Grigorov
>              Labels: event
>             Fix For: 1.5-RC3
>
>         Attachments: WICKET-3516.patch
>
>
> I am currently using the new inter-component events system to communicate 
> between components. My primary use is to "bubble up" requests (ajax requests, 
> switch panel events) to parent components. This enables decoupling inner 
> panels so they can be reused more easily in other panels.
> I am now in a situation where I want to provide the same IEventSink 
> "behavior" to multiple component types. No problem, I'll just create a 
> Behavior for this I thought. The problem is that Behaviors are not included 
> in the processing of IEvents.
> This request is therefore to include Behaviors in the event processing chain 
> to enable reusable event-reacting behaviors.
> Reference email thread: http://markmail.org/message/ha47wfx35uzxlkae

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to