Example usage for com.vaadin.ui AbstractComponent getListeners

List of usage examples for com.vaadin.ui AbstractComponent getListeners

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractComponent getListeners.

Prototype

public Collection<?> getListeners(Class<?> eventType) 

Source Link

Document

Returns all listeners that are registered for the given event type or one of its subclasses.

Usage

From source file:com.jain.addon.I18N.listners.JAttachDetachListner.java

License:Apache License

/**
 * Add this listener to a component//  w  w  w. j  a v  a2  s.  co  m
 * @param parent
 * @param component
 */
public static void addListenerToComponent(AbstractComponent parent, Component component) {
    Collection<?> collection = parent.getListeners(ComponentAttachEvent.class);
    for (Object object : collection) {
        if (object instanceof JAttachDetachListner)
            ((JAttachDetachListner) object).initializeNAddRemoveListner(component, false);
    }

    System.out.println(collection);
}

From source file:com.jain.addon.I18N.listners.JAttachDetachListner.java

License:Apache License

/**
 * Remove this listener from component/*  w ww. j a v  a  2 s  .  c  o m*/
 * @param parent
 * @param component
 */
public static void removeListenerFromComponent(AbstractComponent parent, Component component) {
    Collection<?> collection = parent.getListeners(ComponentAttachEvent.class);
    for (Object object : collection) {
        if (object instanceof JAttachDetachListner)
            ((JAttachDetachListner) object).initializeNAddRemoveListner(component, true);
    }

    System.out.println(collection);
}