From 93a4cf274faa47c27025770c277512e3b6b5b8f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Fri, 23 Nov 2012 14:19:50 +0200 Subject: [PATCH] Rename ComponentEventListener to ConnectorEventListener (#10340) Change-Id: I8e5d60e0e6d7003eeff984ceb0b4bf04347267b0 --- .../src/com/vaadin/event/ConnectorEvent.java | 31 +++++++++++++++++++ ...tener.java => ConnectorEventListener.java} | 2 +- server/src/com/vaadin/event/FieldEvents.java | 6 ++-- server/src/com/vaadin/event/LayoutEvents.java | 2 +- server/src/com/vaadin/event/MouseEvents.java | 4 +-- .../com/vaadin/server/ClientConnector.java | 19 +++--------- .../src/com/vaadin/ui/AbstractSplitPanel.java | 4 +-- server/src/com/vaadin/ui/Component.java | 5 +-- server/src/com/vaadin/ui/LegacyComponent.java | 5 ++- server/src/com/vaadin/ui/UI.java | 4 +-- .../AttachDetachListeners.java | 2 +- 11 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 server/src/com/vaadin/event/ConnectorEvent.java rename server/src/com/vaadin/event/{ComponentEventListener.java => ConnectorEventListener.java} (91%) diff --git a/server/src/com/vaadin/event/ConnectorEvent.java b/server/src/com/vaadin/event/ConnectorEvent.java new file mode 100644 index 0000000000..629dee47d4 --- /dev/null +++ b/server/src/com/vaadin/event/ConnectorEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.event; + +import java.util.EventObject; + +import com.vaadin.server.ClientConnector; + +public abstract class ConnectorEvent extends EventObject { + public ConnectorEvent(ClientConnector source) { + super(source); + } + + public ClientConnector getConnector() { + return (ClientConnector) getSource(); + } +} \ No newline at end of file diff --git a/server/src/com/vaadin/event/ComponentEventListener.java b/server/src/com/vaadin/event/ConnectorEventListener.java similarity index 91% rename from server/src/com/vaadin/event/ComponentEventListener.java rename to server/src/com/vaadin/event/ConnectorEventListener.java index 820697ac9c..1d6739a5d4 100644 --- a/server/src/com/vaadin/event/ComponentEventListener.java +++ b/server/src/com/vaadin/event/ConnectorEventListener.java @@ -18,6 +18,6 @@ package com.vaadin.event; import java.io.Serializable; import java.util.EventListener; -public interface ComponentEventListener extends EventListener, Serializable { +public interface ConnectorEventListener extends EventListener, Serializable { } \ No newline at end of file diff --git a/server/src/com/vaadin/event/FieldEvents.java b/server/src/com/vaadin/event/FieldEvents.java index e0a8b8348b..1e4581c11c 100644 --- a/server/src/com/vaadin/event/FieldEvents.java +++ b/server/src/com/vaadin/event/FieldEvents.java @@ -163,7 +163,7 @@ public interface FieldEvents { * @see FocusEvent * @since 6.2 */ - public interface FocusListener extends ComponentEventListener { + public interface FocusListener extends ConnectorEventListener { public static final Method focusMethod = ReflectTools.findMethod( FocusListener.class, "focus", FocusEvent.class); @@ -203,7 +203,7 @@ public interface FieldEvents { * @see BlurEvent * @since 6.2 */ - public interface BlurListener extends ComponentEventListener { + public interface BlurListener extends ConnectorEventListener { public static final Method blurMethod = ReflectTools.findMethod( BlurListener.class, "blur", BlurEvent.class); @@ -265,7 +265,7 @@ public interface FieldEvents { * * @since 6.5 */ - public interface TextChangeListener extends ComponentEventListener { + public interface TextChangeListener extends ConnectorEventListener { public static String EVENT_ID = "ie"; public static Method EVENT_METHOD = ReflectTools.findMethod( diff --git a/server/src/com/vaadin/event/LayoutEvents.java b/server/src/com/vaadin/event/LayoutEvents.java index 1a1283912c..491e74e792 100644 --- a/server/src/com/vaadin/event/LayoutEvents.java +++ b/server/src/com/vaadin/event/LayoutEvents.java @@ -27,7 +27,7 @@ import com.vaadin.util.ReflectTools; public interface LayoutEvents { - public interface LayoutClickListener extends ComponentEventListener { + public interface LayoutClickListener extends ConnectorEventListener { public static final Method clickMethod = ReflectTools.findMethod( LayoutClickListener.class, "layoutClick", diff --git a/server/src/com/vaadin/event/MouseEvents.java b/server/src/com/vaadin/event/MouseEvents.java index dd0651047c..430cc2659b 100644 --- a/server/src/com/vaadin/event/MouseEvents.java +++ b/server/src/com/vaadin/event/MouseEvents.java @@ -191,7 +191,7 @@ public interface MouseEvents { * @author Vaadin Ltd. * @since 6.2 */ - public interface ClickListener extends ComponentEventListener { + public interface ClickListener extends ConnectorEventListener { public static final Method clickMethod = ReflectTools.findMethod( ClickListener.class, "click", ClickEvent.class); @@ -229,7 +229,7 @@ public interface MouseEvents { * @author Vaadin Ltd. * @since 6.2 */ - public interface DoubleClickListener extends ComponentEventListener { + public interface DoubleClickListener extends ConnectorEventListener { public static final Method doubleClickMethod = ReflectTools.findMethod( DoubleClickListener.class, "doubleClick", diff --git a/server/src/com/vaadin/server/ClientConnector.java b/server/src/com/vaadin/server/ClientConnector.java index a6821a4269..442d5c7862 100644 --- a/server/src/com/vaadin/server/ClientConnector.java +++ b/server/src/com/vaadin/server/ClientConnector.java @@ -16,16 +16,15 @@ package com.vaadin.server; import java.io.IOException; -import java.io.Serializable; import java.lang.reflect.Method; import java.util.Collection; -import java.util.EventListener; -import java.util.EventObject; import java.util.List; import org.json.JSONException; import org.json.JSONObject; +import com.vaadin.event.ConnectorEvent; +import com.vaadin.event.ConnectorEventListener; import com.vaadin.shared.Connector; import com.vaadin.shared.communication.SharedState; import com.vaadin.ui.Component; @@ -43,16 +42,6 @@ import com.vaadin.util.ReflectTools; */ public interface ClientConnector extends Connector { - public static abstract class ConnectorEvent extends EventObject { - public ConnectorEvent(ClientConnector source) { - super(source); - } - - public ClientConnector getConnector() { - return (ClientConnector) getSource(); - } - } - /** * Event fired after a connector is attached to the application. */ @@ -68,7 +57,7 @@ public interface ClientConnector extends Connector { * Interface for listening {@link DetachEvent connector detach events}. * */ - public static interface AttachListener extends EventListener, Serializable { + public static interface AttachListener extends ConnectorEventListener { public static final Method attachMethod = ReflectTools.findMethod( AttachListener.class, "attach", AttachEvent.class); @@ -96,7 +85,7 @@ public interface ClientConnector extends Connector { * Interface for listening {@link DetachEvent connector detach events}. * */ - public static interface DetachListener extends EventListener, Serializable { + public static interface DetachListener extends ConnectorEventListener { public static final Method detachMethod = ReflectTools.findMethod( DetachListener.class, "detach", DetachEvent.class); diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index 926c8e2c86..5e3f7ec24d 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -20,7 +20,7 @@ import java.io.Serializable; import java.lang.reflect.Method; import java.util.Iterator; -import com.vaadin.event.ComponentEventListener; +import com.vaadin.event.ConnectorEventListener; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.server.Sizeable; import com.vaadin.shared.EventId; @@ -477,7 +477,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @see SplitterClickEvent * @since 6.2 */ - public interface SplitterClickListener extends ComponentEventListener { + public interface SplitterClickListener extends ConnectorEventListener { public static final Method clickMethod = ReflectTools.findMethod( SplitterClickListener.class, "splitterClick", diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index afde1cdbdf..20fb10b5dc 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -17,9 +17,10 @@ package com.vaadin.ui; import java.io.Serializable; -import java.util.EventListener; import java.util.Locale; +import com.vaadin.event.ConnectorEvent; +import com.vaadin.event.ConnectorEventListener; import com.vaadin.event.FieldEvents; import com.vaadin.server.ClientConnector; import com.vaadin.server.ErrorMessage; @@ -817,7 +818,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * * @see Component#addListener(Listener) */ - public interface Listener extends EventListener, Serializable { + public interface Listener extends ConnectorEventListener { /** * Notifies the listener of a component event. diff --git a/server/src/com/vaadin/ui/LegacyComponent.java b/server/src/com/vaadin/ui/LegacyComponent.java index f7c5194bfd..694ab3114e 100644 --- a/server/src/com/vaadin/ui/LegacyComponent.java +++ b/server/src/com/vaadin/ui/LegacyComponent.java @@ -15,8 +15,7 @@ */ package com.vaadin.ui; -import java.util.EventListener; - +import com.vaadin.event.ConnectorEventListener; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.VariableOwner; @@ -35,7 +34,7 @@ import com.vaadin.server.VariableOwner; */ @Deprecated public interface LegacyComponent extends VariableOwner, Component, - EventListener { + ConnectorEventListener { /** *

diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index d8e440a0bf..2887c71adf 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -20,7 +20,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.EventListener; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; @@ -28,6 +27,7 @@ import java.util.Map; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ActionManager; +import com.vaadin.event.ConnectorEventListener; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.event.MouseEvents.ClickListener; import com.vaadin.navigator.Navigator; @@ -101,7 +101,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements * Interface for listening {@link UI.CleanupEvent UI cleanup events}. * */ - public interface CleanupListener extends EventListener { + public interface CleanupListener extends ConnectorEventListener { public static final Method cleanupMethod = ReflectTools.findMethod( CleanupListener.class, "cleanup", CleanupEvent.class); diff --git a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java index f5b940d97b..8a61ec6352 100644 --- a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java +++ b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java @@ -10,9 +10,9 @@ import org.easymock.IMocksControl; import org.junit.Before; import org.junit.Test; +import com.vaadin.event.ConnectorEvent; import com.vaadin.server.ClientConnector.AttachEvent; import com.vaadin.server.ClientConnector.AttachListener; -import com.vaadin.server.ClientConnector.ConnectorEvent; import com.vaadin.server.ClientConnector.DetachEvent; import com.vaadin.server.ClientConnector.DetachListener; import com.vaadin.server.VaadinRequest; -- 2.39.5