@Override public <T> void addPossibleEventConsumer(T possibleEventConsumer) { getServiceManager().getEventRegistry().addPossibleEventConsumer(possibleEventConsumer, applicationContext); }
private void injectVaadinApplicationContext(final Component component, final VaadinApplicationContext vaadinApplicationContext) { if (component instanceof VaadinApplicationContextAware) { ((VaadinApplicationContextAware)component).setVaadinApplicationContext(vaadinApplicationContext); } }
private void injectEventProxy(final Component component, final EventProxy eventProxy) { if(component instanceof EventProxyAware){ ((EventProxyAware)component).setEventProxy(eventProxy); } }
@Override public Component getView(final VaadinApplicationContext vaadinApplicationContext, final WidgetContext widgetContext) { // Get the component by asking the blueprint container to instantiate a prototype bean final Component component = (Component)m_container.getComponentInstance(m_beanId); final BundleContext bundleContext = (BundleContext) m_container.getComponentInstance("blueprintBundleContext"); final EventProxy eventProxy = vaadinApplicationContext.getEventProxy(bundleContext); eventProxy.addPossibleEventConsumer(component); injectEventProxy(component, eventProxy); injectVaadinApplicationContext(component, vaadinApplicationContext); return component; }
/** * Fires an event and notifies all {@link EventListener} registered in the EventRegistry. * Be aware that only {@linkplain EventListener}s within session-scope and those listeners who * listens to events of type T gets notified. * * @see {@link EventListener} */ @Override public <T> void fireEvent(T eventObject) { if (eventObject == null) return; List<EventListener> eventListeners = getServiceManager().getServices(EventListener.class, applicationContext, EventListener.getProperties(eventObject.getClass())); for (EventListener eachListener : eventListeners) { eachListener.invoke(eventObject); } }
private String getUser() { return vaadinApplicationContext.getUsername(); } }
@Override public VaadinApplicationContext createApplicationContext(VaadinApplicationContextCreator creator) { VaadinApplicationContext newContext = creator.create(this); VaadinApplicationContext oldContext = getService(VaadinApplicationContext.class, newContext); if (oldContext != null) return oldContext; registerAsService(VaadinApplicationContext.class, newContext, newContext); return newContext; }
@Override public EventProxy getEventProxy(OnmsServiceManager serviceManager) { if (serviceManager == null) throw new IllegalArgumentException("OnmsServiceManager must not be null"); EventRegistry eventRegistry = serviceManager.getEventRegistry(); if (eventRegistry == null) throw new IllegalArgumentException("EventRegistry must not be null"); return eventRegistry.getScope(this); }
@Override public String getSessionId() { return applicationContext.getSessionId(); }
public EventProxy getScope(VaadinApplicationContext vaadinApplicationContext) { return new EventProxyImpl(bundleContext, vaadinApplicationContext); }
public OnmsVaadinUIFactory(Class<? extends UI> uiClass, BlueprintContainer blueprintContainer, String uiBeanId) { m_blueprintContainer = Objects.requireNonNull(blueprintContainer); m_uiClass = Objects.requireNonNull(uiClass); m_uiBeanId = Objects.requireNonNull(uiBeanId); validate(); }
@Override public Component getView(final VaadinApplicationContext vaadinApplicationContext, final WidgetContext widgetContext) { // Get the component by asking the blueprint container to instantiate a prototype bean final Component component = (Component)m_container.getComponentInstance(m_beanId); final BundleContext bundleContext = (BundleContext) m_container.getComponentInstance("blueprintBundleContext"); final EventProxy eventProxy = vaadinApplicationContext.getEventProxy(bundleContext); eventProxy.addPossibleEventConsumer(component); injectEventProxy(component, eventProxy); injectVaadinApplicationContext(component, vaadinApplicationContext); return component; }
private String getUser() { return vaadinApplicationContext.getUsername(); } }
private void injectVaadinApplicationContext(final Component component, final VaadinApplicationContext vaadinApplicationContext) { if (component instanceof VaadinApplicationContextAware) { ((VaadinApplicationContextAware)component).setVaadinApplicationContext(vaadinApplicationContext); } }
private void injectEventProxy(final Component component, final EventProxy eventProxy) { if(component instanceof EventProxyAware){ ((EventProxyAware)component).setEventProxy(eventProxy); } }
@Override public String getSessionId() { return applicationContext.getSessionId(); }
@Override public Component getView(final VaadinApplicationContext vaadinApplicationContext, final WidgetContext widgetContext) { // Get the component by asking the blueprint container to instantiate a prototype bean final Component component = (Component)m_container.getComponentInstance(m_beanId); final BundleContext bundleContext = (BundleContext) m_container.getComponentInstance("blueprintBundleContext"); final EventProxy eventProxy = vaadinApplicationContext.getEventProxy(bundleContext); eventProxy.addPossibleEventConsumer(component); injectEventProxy(component, eventProxy); injectVaadinApplicationContext(component, vaadinApplicationContext); return component; }
private void injectVaadinApplicationContext(final Component component, final VaadinApplicationContext vaadinApplicationContext) { if (component instanceof VaadinApplicationContextAware) { ((VaadinApplicationContextAware)component).setVaadinApplicationContext(vaadinApplicationContext); } }
private void injectEventProxy(final Component component, final EventProxy eventProxy) { if(component instanceof EventProxyAware){ ((EventProxyAware)component).setEventProxy(eventProxy); } }
@Override public void setApplicationContext(VaadinApplicationContext applicationContext) { this.applicationContext = applicationContext; setSessionId(applicationContext.getSessionId()); }