From ccd94db68dffb2e8d4562199b718325298a0e80c Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 28 Oct 2010 13:48:34 +0000 Subject: [PATCH] added method for implementations to check if component has a listener for a specific event type. Needed e.g. for paint optimizations. svn changeset:15762/svn branch:6.5 --- src/com/vaadin/ui/AbstractComponent.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java index 061323bf22..f0938780fe 100644 --- a/src/com/vaadin/ui/AbstractComponent.java +++ b/src/com/vaadin/ui/AbstractComponent.java @@ -940,6 +940,17 @@ public abstract class AbstractComponent implements Component, MethodEventSource } } + /** + * Checks if the given {@link Event} type is listened for this component. + * + * @param eventType + * the event type to be checked + * @return true if a listener is registered for the given event type + */ + protected boolean hasListeners(Class eventType) { + return eventRouter != null && eventRouter.hasListeners(eventType); + } + /** * Removes all registered listeners matching the given parameters. Since * this method receives the event type and the listener object as -- 2.39.5