/** * 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>For more information on the inheritable event mechanism see the {@link com.vaadin.event * com.vaadin.event package documentation}. * * @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. */ @Override public void addListener(Class<?> eventType, Object target, Method method) { if (eventRouter == null) { eventRouter = new EventRouter(); } eventRouter.addListener(eventType, target, method); }
/** * 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. * * @param eventType the type of the listened event. Events of this type or its subclasses activate * the listener. * @param listener the object instance who owns the activation method. * @param method the activation method. * @return a registration for the listener */ protected Registration addListener( Class<?> eventType, DataProviderListener listener, Method method) { if (eventRouter == null) { eventRouter = new EventRouter(); } return eventRouter.addListener(eventType, listener, method); }
/** * 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>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>For more information on the inheritable event mechanism see the {@link com.vaadin.event * com.vaadin.event package documentation}. * * <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. * * @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 As of 7.0. This method should be avoided. Use {@link #addListener(Class, Object, * Method)} or {@link #addListener(String, Class, Object, Method)} instead. */ @Override @Deprecated public void addListener(Class<?> eventType, Object target, String methodName) { if (eventRouter == null) { eventRouter = new EventRouter(); } eventRouter.addListener(eventType, target, methodName); }
/** * 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>This method additionally informs the event-api to route events with the given * eventIdentifier to the components handleEvent function call. * * <p>For more information on the inheritable event mechanism see the {@link com.vaadin.event * com.vaadin.event package documentation}. * * @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 */ 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); } }