aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-11-06 17:36:39 +0200
committerVaadin Code Review <review@vaadin.com>2012-11-07 13:59:29 +0000
commita7624344b46509afdcdf2424c3dbade627c03c64 (patch)
tree0c978795ca6387be3fdacc35d49c87cf13bd62bf /server/src/com/vaadin/ui
parentdb35e488161a33097eb9876c5adc2dbb793fd59e (diff)
downloadvaadin-framework-a7624344b46509afdcdf2424c3dbade627c03c64.tar.gz
vaadin-framework-a7624344b46509afdcdf2424c3dbade627c03c64.zip
Moved EventRouter from AbstractComponent to AbstractClientConnector (#9342)
Change-Id: I33981f0c80ab367d74bbbeebb48abbc81d4f182c
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java310
-rw-r--r--server/src/com/vaadin/ui/Component.java3
2 files changed, 3 insertions, 310 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index fb550fa944..5589223ac5 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -19,8 +19,6 @@ package com.vaadin.ui;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -28,8 +26,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.vaadin.event.ActionManager;
-import com.vaadin.event.EventRouter;
-import com.vaadin.event.MethodEventSource;
import com.vaadin.event.ShortcutListener;
import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.ClientConnector;
@@ -54,7 +50,7 @@ import com.vaadin.util.ReflectTools;
*/
@SuppressWarnings("serial")
public abstract class AbstractComponent extends AbstractClientConnector
- implements Component, MethodEventSource {
+ implements Component {
/* Private members */
@@ -65,15 +61,6 @@ public abstract class AbstractComponent extends AbstractClientConnector
private Object applicationData;
/**
- * The EventRouter used for the event model.
- *
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
- */
- @Deprecated
- private EventRouter eventRouter = null;
-
- /**
* The internal error message of the component.
*/
private ErrorMessage componentError = null;
@@ -669,301 +656,6 @@ public abstract class AbstractComponent extends AbstractClientConnector
.findMethod(Component.Listener.class, "componentEvent",
Component.Event.class);
- /**
- * <p>
- * Registers a new listener with the specified activation method to listen
- * events generated by this component. If the activation method does not
- * have any arguments the event object will not be passed to it when it's
- * called.
- * </p>
- *
- * <p>
- * This method additionally informs the event-api to route events with the
- * given eventIdentifier to the components handleEvent function call.
- * </p>
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventIdentifier
- * the identifier of the event to listen for
- * @param eventType
- * the type of the listened event. Events of this type or its
- * subclasses activate the listener.
- * @param target
- * the object instance who owns the activation method.
- * @param method
- * the activation method.
- *
- * @since 6.2
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
- */
- @Deprecated
- protected void addListener(String eventIdentifier, Class<?> eventType,
- Object target, Method method) {
- if (eventRouter == null) {
- eventRouter = new EventRouter();
- }
- boolean needRepaint = !eventRouter.hasListeners(eventType);
- eventRouter.addListener(eventType, target, method);
-
- if (needRepaint) {
- ComponentStateUtil.addRegisteredEventListener(getState(),
- eventIdentifier);
- }
- }
-
- /**
- * 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
- * parameters, it will unregister all <code>object</code>'s methods that are
- * registered to listen to events of type <code>eventType</code> generated
- * by this component.
- *
- * <p>
- * This method additionally informs the event-api to stop routing events
- * with the given eventIdentifier to the components handleEvent function
- * call.
- * </p>
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventIdentifier
- * the identifier of the event to stop listening for
- * @param eventType
- * the exact event type the <code>object</code> listens to.
- * @param target
- * the target object that has registered to listen to events of
- * type <code>eventType</code> with one or more methods.
- *
- * @since 6.2
- */
- protected void removeListener(String eventIdentifier, Class<?> eventType,
- Object target) {
- if (eventRouter != null) {
- eventRouter.removeListener(eventType, target);
- if (!eventRouter.hasListeners(eventType)) {
- ComponentStateUtil.removeRegisteredEventListener(getState(),
- eventIdentifier);
- }
- }
- }
-
- /**
- * <p>
- * Registers a new listener with the specified activation method to listen
- * events generated by this component. If the activation method does not
- * have any arguments the event object will not be passed to it when it's
- * called.
- * </p>
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventType
- * the type of the listened event. Events of this type or its
- * subclasses activate the listener.
- * @param target
- * the object instance who owns the activation method.
- * @param method
- * the activation method.
- *
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
- */
- @Override
- @Deprecated
- public void addListener(Class<?> eventType, Object target, Method method) {
- if (eventRouter == null) {
- eventRouter = new EventRouter();
- }
- eventRouter.addListener(eventType, target, method);
- }
-
- /**
- * <p>
- * Convenience method for registering a new listener with the specified
- * activation method to listen events generated by this component. If the
- * activation method does not have any arguments the event object will not
- * be passed to it when it's called.
- * </p>
- *
- * <p>
- * This version of <code>addListener</code> gets the name of the activation
- * method as a parameter. The actual method is reflected from
- * <code>object</code>, and unless exactly one match is found,
- * <code>java.lang.IllegalArgumentException</code> is thrown.
- * </p>
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * <p>
- * Note: Using this method is discouraged because it cannot be checked
- * during compilation. Use {@link #addListener(Class, Object, Method)} or
- * {@link #addListener(com.vaadin.ui.Component.Listener)} instead.
- * </p>
- *
- * @param eventType
- * the type of the listened event. Events of this type or its
- * subclasses activate the listener.
- * @param target
- * the object instance who owns the activation method.
- * @param methodName
- * the name of the activation method.
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
- */
- @Override
- @Deprecated
- public void addListener(Class<?> eventType, Object target, String methodName) {
- if (eventRouter == null) {
- eventRouter = new EventRouter();
- }
- eventRouter.addListener(eventType, target, methodName);
- }
-
- /**
- * Removes all registered listeners matching the given parameters. Since
- * this method receives the event type and the listener object as
- * parameters, it will unregister all <code>object</code>'s methods that are
- * registered to listen to events of type <code>eventType</code> generated
- * by this component.
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventType
- * the exact event type the <code>object</code> listens to.
- * @param target
- * the target object that has registered to listen to events of
- * type <code>eventType</code> with one or more methods.
- */
- @Override
- public void removeListener(Class<?> eventType, Object target) {
- if (eventRouter != null) {
- eventRouter.removeListener(eventType, target);
- }
- }
-
- /**
- * Removes one registered listener method. The given method owned by the
- * given object will no longer be called when the specified events are
- * generated by this component.
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventType
- * the exact event type the <code>object</code> listens to.
- * @param target
- * target object that has registered to listen to events of type
- * <code>eventType</code> with one or more methods.
- * @param method
- * the method owned by <code>target</code> that's registered to
- * listen to events of type <code>eventType</code>.
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
- */
- @Override
- @Deprecated
- public void removeListener(Class<?> eventType, Object target, Method method) {
- if (eventRouter != null) {
- eventRouter.removeListener(eventType, target, method);
- }
- }
-
- /**
- * <p>
- * Removes one registered listener method. The given method owned by the
- * given object will no longer be called when the specified events are
- * generated by this component.
- * </p>
- *
- * <p>
- * This version of <code>removeListener</code> gets the name of the
- * activation method as a parameter. The actual method is reflected from
- * <code>target</code>, and unless exactly one match is found,
- * <code>java.lang.IllegalArgumentException</code> is thrown.
- * </p>
- *
- * <p>
- * For more information on the inheritable event mechanism see the
- * {@link com.vaadin.event com.vaadin.event package documentation}.
- * </p>
- *
- * @param eventType
- * the exact event type the <code>object</code> listens to.
- * @param target
- * the target object that has registered to listen to events of
- * type <code>eventType</code> with one or more methods.
- * @param methodName
- * the name of the method owned by <code>target</code> that's
- * registered to listen to events of type <code>eventType</code>.
- */
- @Override
- public void removeListener(Class<?> eventType, Object target,
- String methodName) {
- if (eventRouter != null) {
- eventRouter.removeListener(eventType, target, methodName);
- }
- }
-
- /**
- * Returns all listeners that are registered for the given event type or one
- * of its subclasses.
- *
- * @param eventType
- * The type of event to return listeners for.
- * @return A collection with all registered listeners. Empty if no listeners
- * are found.
- */
- public Collection<?> getListeners(Class<?> eventType) {
- if (eventRouter == null) {
- return Collections.EMPTY_LIST;
- }
-
- return eventRouter.getListeners(eventType);
- }
-
- /**
- * Sends the event to all listeners.
- *
- * @param event
- * the Event to be sent to all listeners.
- */
- protected void fireEvent(Component.Event event) {
- if (eventRouter != null) {
- eventRouter.fireEvent(event);
- }
-
- }
-
/* Component event framework */
/*
diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java
index 36868c41e9..187d5b8590 100644
--- a/server/src/com/vaadin/ui/Component.java
+++ b/server/src/com/vaadin/ui/Component.java
@@ -753,8 +753,9 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
* @return the source component of the event
*/
public Component getComponent() {
- return (Component) getSource();
+ return getSource();
}
+
}
/**