List of usage examples for com.vaadin.server UIProvider UIProvider
UIProvider
From source file:org.vaadin.webinars.springandvaadin.i18n.ui.createTask.CreateTaskServlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { final ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); getService().addSessionInitListener(new SessionInitListener() { @Override//from w w w. ja v a 2 s . c o m public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { sessionInitEvent.getSession().addUIProvider(new UIProvider() { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent uiClassSelectionEvent) { return CreateTaskUi.class; } @Override public UI createInstance(UICreateEvent event) { return context.getBean(event.getUIClass()); } }); } }); }
From source file:org.vaadin.webinars.springandvaadin.i18n.ui.Servlet.java
License:Apache License
@Override protected void servletInitialized() throws ServletException { final ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); try {// w w w. ja va2 s . c o m localeResolver = context.getBean(DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, LocaleResolver.class); } catch (NoSuchBeanDefinitionException e) { localeResolver = new SessionLocaleResolver(); } getService().addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException { sessionInitEvent.getSession().addUIProvider(new UIProvider() { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent uiClassSelectionEvent) { return I18nUI.class; } @Override public UI createInstance(UICreateEvent event) { return context.getBean(event.getUIClass()); } }); } }); }