Search in sources :

Example 1 with UiEventListenerMethodAdapter

use of com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter in project cuba by cuba-platform.

the class ControllerDependencyInjector method injectEventListeners.

protected void injectEventListeners(Frame frame) {
    Class<? extends Frame> clazz = frame.getClass();
    List<Method> eventListenerMethods = getAnnotatedListenerMethods(clazz);
    if (!eventListenerMethods.isEmpty()) {
        Events events = (Events) applicationContext.getBean(Events.NAME);
        List<ApplicationListener> listeners = eventListenerMethods.stream().map(m -> new UiEventListenerMethodAdapter(frame, clazz, m, events)).collect(Collectors.toList());
        ((AbstractFrame) frame).setUiEventListeners(listeners);
    }
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) java.util(java.util) LoadingCache(com.google.common.cache.LoadingCache) Datasource(com.haulmont.cuba.gui.data.Datasource) ClassUtils(org.apache.commons.lang.ClassUtils) Config(com.haulmont.cuba.core.config.Config) LoggerFactory(org.slf4j.LoggerFactory) Scope(org.springframework.context.annotation.Scope) Inject(javax.inject.Inject) ImmutableList(com.google.common.collect.ImmutableList) Configuration(com.haulmont.cuba.core.global.Configuration) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Named(javax.inject.Named) Nonnull(javax.annotation.Nonnull) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) DsContext(com.haulmont.cuba.gui.data.DsContext) java.lang.reflect(java.lang.reflect) Logger(org.slf4j.Logger) ClientConfiguration(com.haulmont.cuba.client.ClientConfiguration) ExportDisplay(com.haulmont.cuba.gui.export.ExportDisplay) Resource(javax.annotation.Resource) ThemeConstantsManager(com.haulmont.cuba.gui.theme.ThemeConstantsManager) EventListener(org.springframework.context.event.EventListener) BeansException(org.springframework.beans.BeansException) ApplicationListener(org.springframework.context.ApplicationListener) Field(java.lang.reflect.Field) ApplicationContext(org.springframework.context.ApplicationContext) Collectors(java.util.stream.Collectors) CacheLoader(com.google.common.cache.CacheLoader) Events(com.haulmont.cuba.core.global.Events) UiEventListenerMethodAdapter(com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter) ReflectionUtils(org.springframework.util.ReflectionUtils) ThemeConstants(com.haulmont.cuba.gui.theme.ThemeConstants) CacheBuilder(com.google.common.cache.CacheBuilder) DataSupplier(com.haulmont.cuba.gui.data.DataSupplier) ApplicationContextAware(org.springframework.context.ApplicationContextAware) UiEventListenerMethodAdapter(com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter) Events(com.haulmont.cuba.core.global.Events) ApplicationListener(org.springframework.context.ApplicationListener)

Aggregations

CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 ImmutableList (com.google.common.collect.ImmutableList)1 ClientConfiguration (com.haulmont.cuba.client.ClientConfiguration)1 Config (com.haulmont.cuba.core.config.Config)1 Configuration (com.haulmont.cuba.core.global.Configuration)1 Events (com.haulmont.cuba.core.global.Events)1 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)1 DataSupplier (com.haulmont.cuba.gui.data.DataSupplier)1 Datasource (com.haulmont.cuba.gui.data.Datasource)1 DsContext (com.haulmont.cuba.gui.data.DsContext)1 UiEventListenerMethodAdapter (com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter)1 ExportDisplay (com.haulmont.cuba.gui.export.ExportDisplay)1 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)1 ThemeConstantsManager (com.haulmont.cuba.gui.theme.ThemeConstantsManager)1 java.lang.reflect (java.lang.reflect)1 Field (java.lang.reflect.Field)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1