Example usage for com.vaadin.event MethodEventSource addListener

List of usage examples for com.vaadin.event MethodEventSource addListener

Introduction

In this page you can find the example usage for com.vaadin.event MethodEventSource addListener.

Prototype

public Registration addListener(Class<?> eventType, Object object, String methodName);

Source Link

Document

Registers a new listener with the specified activation method to listen events generated by this component.

Usage

From source file:org.lunifera.runtime.web.vaadin.databinding.component.internal.ComponentListenerUtil.java

License:Open Source License

/**
 * @param widget/* w ww .j  a v a 2s .co  m*/
 * @param event
 * @param listener
 */
public static void asyncAddListener(final MethodEventSource widget,
        final Class<? extends Component.Event> event, final Component.Listener listener,
        Method listenerMethod) {
    if (widget == null) {
        return;
    }

    UI ui = UI.getCurrent();
    if (ui != null) {
        widget.addListener(event, listener, listenerMethod);
    } else {
        throw new IllegalStateException("Not a valid web transaction");
    }
}