com.vaadin.util.CurrentInstance Java Examples
The following examples show how to use
com.vaadin.util.CurrentInstance.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SockJSPushHandler.java From vertx-vaadin with MIT License | 6 votes |
private void onConnect(SockJSSocket sockJSSocket) { RoutingContext routingContext = CurrentInstance.get(RoutingContext.class); String uuid = sockJSSocket.writeHandlerID(); connectedSocketsLocalMap.put(uuid, sockJSSocket); PushSocket socket = new PushSocketImpl(sockJSSocket); initSocket(sockJSSocket, routingContext, socket); // Send an ACK socket.send("ACK-CONN|" + uuid); sessionHandler.handle(new SockJSRoutingContext(routingContext, rc -> callWithUi(new PushEvent(socket, routingContext, null), establishCallback) )); }
Example #2
Source File: CustomSpringUIProvider.java From cia with Apache License 2.0 | 6 votes |
@Override public UI createInstance(final UICreateEvent event) { final Class<UIID> key = UIID.class; final UIID identifier = new UIID(event); CurrentInstance.set(key, identifier); try { logger.debug("Creating a new UI bean of class [{}] with identifier [{}]", event.getUIClass().getCanonicalName(), identifier); final UI ui = getWebApplicationContext().getBean(event.getUIClass()); getSpringViewDisplayRegistrationBean().setBeanClass(event.getUIClass()); configureNavigator(ui); return ui; } finally { CurrentInstance.set(key, null); } }
Example #3
Source File: VaadinScope.java From jdal with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public String getConversationId() { Integer uiId = null; UI ui = UI.getCurrent(); if (ui == null) { UIid id = CurrentInstance.get(UIid.class); if (id != null) { uiId = id.getUiId(); } } else if (ui != null) { if (!sessions.containsKey(ui)) { ui.addDetachListener(this); sessions.put(ui, VaadinSession.getCurrent().getSession().getId()); } uiId = ui.getUIId(); } return uiId != null ? getConversationId(uiId) : null; }
Example #4
Source File: SockJSPushHandler.java From vertx-vaadin with MIT License | 5 votes |
@Override public void handle(RoutingContext routingContext) { CurrentInstance.set(RoutingContext.class, routingContext); try { sockJSHandler.handle(routingContext); } finally { CurrentInstance.set(RoutingContext.class, null); } }
Example #5
Source File: SpringUIProvider.java From jdal with Apache License 2.0 | 5 votes |
@Override public UI createInstance(UICreateEvent event) { ApplicationContext ctx = VaadinUtils.getApplicationContext(); CurrentInstance.set(UIid.class, new UIid(event.getUiId())); UI ui = this.uiMapping.getUi(event.getRequest()); if (ui == null) ui = ctx.getBean(event.getUIClass()); CurrentInstance.set(UIid.class, null); return ui; }