E - The type of the eventpublic abstract class VaadinApplicationListener<E extends ApplicationEvent> extends VaadinExternalListener<ApplicationEventMulticaster> implements ApplicationListener<E>
ApplicationListener support superclass customized for use by
listeners that are part of a Vaadin application when listening to non-Vaadin application event sources.
Listeners that are part of a Vaadin application should use this superclass if they are going to be registered with non-Vaadin event sources. This will ensure that events are delivered in the proper Vaadin application context and memory leaks are avoided when the session closes.
| Constructor and Description |
|---|
VaadinApplicationListener(ApplicationEventMulticaster multicaster)
Convenience constructor.
|
VaadinApplicationListener(ApplicationEventMulticaster multicaster,
VaadinSession session)
Primary constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onApplicationEvent(E event) |
protected abstract void |
onApplicationEventInternal(E event)
Handle a listener event.
|
protected void |
register(ApplicationEventMulticaster multicaster)
Register as a listener on the given event source.
|
protected void |
unregister(ApplicationEventMulticaster multicaster)
Register as a listener from the given event source.
|
getEventSource, getSession, handleEvent, isAsynchronous, register, setAsynchronous, unregisterpublic VaadinApplicationListener(ApplicationEventMulticaster multicaster)
VaadinApplicationListener(multicaster, VaadinUtil.getCurrentSession())
multicaster - the application event multicaster on which this listener will registerIllegalArgumentException - if multicaster is nullIllegalArgumentException - if there is no VaadinSession associated with the current threadpublic VaadinApplicationListener(ApplicationEventMulticaster multicaster, VaadinSession session)
multicaster - the application event multicaster on which this listener will registersession - the associated Vaadin applicationIllegalArgumentException - if either parameter is nullprotected void register(ApplicationEventMulticaster multicaster)
VaadinExternalListenerSubclass must implement this to perform the actual listener registration.
register in class VaadinExternalListener<ApplicationEventMulticaster>multicaster - event source, never null; will be same as provided to the constructorprotected void unregister(ApplicationEventMulticaster multicaster)
VaadinExternalListenerSubclass must implement this to perform the actual listener registration.
unregister in class VaadinExternalListener<ApplicationEventMulticaster>multicaster - event source, never null; will be same as provided to the constructorpublic final void onApplicationEvent(E event)
onApplicationEvent in interface ApplicationListener<E extends ApplicationEvent>protected abstract void onApplicationEventInternal(E event)
VaadinSession with which this listener is associated.event - event to handleVaadinUtil.invoke(com.vaadin.server.VaadinSession, java.lang.Runnable),
VaadinUtil.getCurrentSession()Copyright © 2017. All rights reserved.