Description
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 it. 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?
Attachments
Issue Links
- duplicates
-
WICKET-3684 Introduce IComponentAwareEventSink which will pass the behavior's component as context to onEvent
- Resolved