You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an at first invisble panel to render some data, which gets its data by an event using AnnotationEventDispatcher and the availibility of the data influences isVisible of the panel. AnnotationEventSink.canCallListenerInterface is used to decide if an event should be dispatched to an EventSink or not and by default my panel is ignored because it starts invisble. As I understand the docs of Component.canCallListenerInterface, this is a use case in which I should override canCallListenerInterface and decide that the event should be dispatched to the invisible panel without running into too much trouble. So I did that and dispatching the event and rendering the data works.
@Override
public boolean canCallListenerInterface(Method method)
{
if (method.isAnnotationPresent(OnEvent.class))
{
return true;
}
return super.canCallListenerInterface(method);
}
This implemenation is much like the criteria AnnotationEventDispatcher uses on its own to find the annotated event callbacks.
So what do you think about enhancing the OnEvent annotation itself with a boolean to optionally be able override the check of AnnotationEventSink.canCallListenerInterface directly? The additionaly booleas would simply be taken into account like stop already. This way one wouldn't need to override canCallListenerInterface per component in uses cases like mine, but the annotated event handler itself could already decide to dispatch an event in all cases.
Additionally, the boolean could be used as well to simply document the fact that canCallListenerInterface is called before an event is dispatched to an EventSink and may easier be recognized. I was not aware of that behavior, wondered why my handler is never called and needed to find out using the debugger.
Thanks.
The text was updated successfully, but these errors were encountered:
ams-tschoening
changed the title
Additional annotation for AnnotationEventSink.canCallListenerInterface to easier work with hidden components?
Additional annotation for OnEvent to override AnnotationEventSink.canCallListenerInterface to easier work with hidden components?
May 11, 2016
I have an at first invisble panel to render some data, which gets its data by an event using
AnnotationEventDispatcher
and the availibility of the data influences isVisible of the panel.AnnotationEventSink.canCallListenerInterface
is used to decide if an event should be dispatched to an EventSink or not and by default my panel is ignored because it starts invisble. As I understand the docs ofComponent.canCallListenerInterface
, this is a use case in which I should overridecanCallListenerInterface
and decide that the event should be dispatched to the invisible panel without running into too much trouble. So I did that and dispatching the event and rendering the data works.This implemenation is much like the criteria
AnnotationEventDispatcher
uses on its own to find the annotated event callbacks.So what do you think about enhancing the OnEvent annotation itself with a boolean to optionally be able override the check of
AnnotationEventSink.canCallListenerInterface
directly? The additionaly booleas would simply be taken into account likestop
already. This way one wouldn't need to overridecanCallListenerInterface
per component in uses cases like mine, but the annotated event handler itself could already decide to dispatch an event in all cases.Additionally, the boolean could be used as well to simply document the fact that
canCallListenerInterface
is called before an event is dispatched to an EventSink and may easier be recognized. I was not aware of that behavior, wondered why my handler is never called and needed to find out using the debugger.Thanks.
The text was updated successfully, but these errors were encountered: