What if, instead of having configuration for visible/invisible and
enabled/disabled, we just use the
Component.canCallListenerInterface(Method) method, passing in the event
handler method?  By default this requires a component to be both enabled
and visible in the hierarchy.  Also, this allows event handling to be
configured at the component level (if you really want the event dispatched
to a disabled or invisible component, override the canCallListenerInterface
method) and nicely reuses the Wicket API.  This is also consistent with how
behaviors work (Behavior.canCallListenerInterface(Component,method)).


On Thu, Jun 5, 2014 at 3:07 AM, Martin Grigorov <notifications@github.com>
wrote:

> In
> jdk-1.7-parent/annotationeventdispatcher-parent/annotationeventdispatcher/src/main/java/org/wicketstuff/event/annotation/AnnotationEventDispatcher.java:
>
> > @@ -75,9 +76,27 @@ private boolean containsOnEventMethod(final Class<?> clazz)
> >  	public void dispatchEvent(final Object sink, final IEvent<?> event, final Component component)
> >  	{
> >  		AnnotationEventSink eventSink = eventSinkByClass.get(sink.getClass());
> > -		if (eventSink != null && eventSink != EMPTY_SINK)
> > +		AnnotationEventDispatcherConfig config = Application.get().getMetaData(
> > +				Initializer.ANNOTATION_EVENT_DISPATCHER_CONFIG_CONTEXT_KEY);
> > +		if (eventSink != null
> > +				&& eventSink != EMPTY_SINK
> > +				&& (config.getEventFilter() == null || config.getEventFilter().isAssignableFrom(
> > +						event.getPayload().getClass()))
> > +				&& (config.isDispatchToNonVisibleComponents() || isVisible(sink)))
>
> s/NonVisible/Invisible/ ?
>
> should there be something similar for disabled components ?!
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/wicketstuff/core/pull/309/files#r13426573>.
>