/** * The constructor automatically subscribes to event bus events. * * @param view <em>View</em> * @param eventBus Vaadin even bus */ public Presenter(T view, EventBus eventBus) { Assert.notNull(view); Assert.notNull(eventBus); this.view = view; this.eventBus = eventBus; eventBus.subscribe(this); }
/** * @param scope the scope of the events that this event bus handles. * @param parentEventBus the parent event bus to use, may be {@code null}; */ public ScopedEventBus(EventScope scope, EventBus parentEventBus) { eventScope = scope; this.parentEventBus = parentEventBus; if (parentEventBus != null) { if (AopUtils.isJdkDynamicProxy(parentEventBus)) { logger.debug("Parent event bus [{}] is proxied, trying to get the real EventBus instance", parentEventBus); try { this.parentEventBus = (EventBus) ((Advised) parentEventBus).getTargetSource().getTarget(); } catch (Exception e) { logger.error("Could not get target EventBus from proxy", e); throw new RuntimeException("Could not get parent event bus", e); } } logger.debug("Using parent event bus [{}]", this.parentEventBus); this.parentEventBus.subscribe(parentListener); } }
/** * @param scope the scope of the events that this event bus handles. * @param parentEventBus the parent event bus to use, may be {@code null}; */ public ScopedEventBus(EventScope scope, EventBus parentEventBus) { eventScope = scope; this.parentEventBus = parentEventBus; if (parentEventBus != null) { if (AopUtils.isJdkDynamicProxy(parentEventBus)) { logger.debug("Parent event bus [{}] is proxied, trying to get the real EventBus instance", parentEventBus); try { this.parentEventBus = (EventBus) ((Advised) parentEventBus).getTargetSource().getTarget(); } catch (Exception e) { logger.error("Could not get target EventBus from proxy", e); throw new RuntimeException("Could not get parent event bus", e); } } logger.debug("Using parent event bus [{}]", this.parentEventBus); this.parentEventBus.subscribe(parentListener); } }
/** * @param scope the scope of the events that this event bus handles. * @param parentEventBus the parent event bus to use, may be {@code null}; */ public ScopedEventBus(EventScope scope, EventBus parentEventBus) { eventScope = scope; this.parentEventBus = parentEventBus; if (parentEventBus != null) { if (AopUtils.isJdkDynamicProxy(parentEventBus)) { logger.debug("Parent event bus [{}] is proxied, trying to get the real EventBus instance", parentEventBus); try { this.parentEventBus = (EventBus) ((Advised) parentEventBus).getTargetSource().getTarget(); } catch (Exception e) { logger.error("Could not get target EventBus from proxy", e); throw new RuntimeException("Could not get parent event bus", e); } } logger.debug("Using parent event bus [{}]", this.parentEventBus); this.parentEventBus.subscribe(parentListener); } }