From: Artur Signell Date: Thu, 29 Nov 2012 17:56:43 +0000 (+0200) Subject: Moved hasEventListener to ServerConnector (#10433) X-Git-Tag: 7.0.0.beta11~86 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F444%2F2;p=vaadin-framework.git Moved hasEventListener to ServerConnector (#10433) Change-Id: I1223c8ece8951b69b540979ef6f782dc292d31e0 --- diff --git a/client/src/com/vaadin/client/ComponentConnector.java b/client/src/com/vaadin/client/ComponentConnector.java index ae889c1dbd..63e55153b6 100644 --- a/client/src/com/vaadin/client/ComponentConnector.java +++ b/client/src/com/vaadin/client/ComponentConnector.java @@ -94,8 +94,6 @@ public interface ComponentConnector extends ServerConnector { @Deprecated public boolean isReadOnly(); - public boolean hasEventListener(String eventIdentifier); - /** * Return true if parent handles caption, false if the paintable handles the * caption itself. diff --git a/client/src/com/vaadin/client/ServerConnector.java b/client/src/com/vaadin/client/ServerConnector.java index c5f42d3bd0..2ff2cb5ab5 100644 --- a/client/src/com/vaadin/client/ServerConnector.java +++ b/client/src/com/vaadin/client/ServerConnector.java @@ -179,4 +179,16 @@ public interface ServerConnector extends Connector { * {@link SharedState}. Never null. */ public SharedState getState(); + + /** + * Checks if an event listener has been registered on the server side for + * the given event identifier. + * + * @param eventIdentifier + * The identifier for the event + * @return true if a listener has been registered on the server side, false + * otherwise + */ + public boolean hasEventListener(String eventIdentifier); + } diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index cda6e8f369..16b5adef81 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -17,7 +17,6 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.List; -import java.util.Set; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Focusable; @@ -25,8 +24,8 @@ import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; -import com.vaadin.client.HasComponentsConnector; import com.vaadin.client.ConnectorMap; +import com.vaadin.client.HasComponentsConnector; import com.vaadin.client.LayoutManager; import com.vaadin.client.ServerConnector; import com.vaadin.client.StyleConstants; @@ -391,21 +390,6 @@ public abstract class AbstractComponentConnector extends AbstractConnector return LayoutManager.get(getConnection()); } - /** - * Checks if there is a registered server side listener for the given event - * identifier. - * - * @param eventIdentifier - * The identifier to check for - * @return true if an event listener has been registered with the given - * event identifier on the server side, false otherwise - */ - @Override - public boolean hasEventListener(String eventIdentifier) { - Set reg = getState().registeredEventListeners; - return (reg != null && reg.contains(eventIdentifier)); - } - @Override public void updateEnabledState(boolean enabledState) { super.updateEnabledState(enabledState); diff --git a/client/src/com/vaadin/client/ui/AbstractConnector.java b/client/src/com/vaadin/client/ui/AbstractConnector.java index 68f09ce471..980f4c90ec 100644 --- a/client/src/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractConnector.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerManager; @@ -408,4 +409,14 @@ public abstract class AbstractConnector implements ServerConnector, return urlReference.getURL(); } } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.ServerConnector#hasEventListener(java.lang.String) + */ + public boolean hasEventListener(String eventIdentifier) { + Set reg = getState().registeredEventListeners; + return (reg != null && reg.contains(eventIdentifier)); + } }