List of usage examples for com.vaadin.server VaadinRequest getLocale
public Locale getLocale();
From source file:com.cbnserver.gwtp4vaadin.example.MyVaadinApplication.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { setLocale(vaadinRequest.getLocale()); mvp.init(); }
From source file:com.hack23.cia.web.impl.ui.application.CitizenIntelligenceAgencyUI.java
License:Apache License
@Override protected void init(final VaadinRequest request) { VaadinSession.getCurrent().setErrorHandler(new UiInstanceErrorHandler(this)); setSizeFull();//ww w . ja va 2 s . com final DiscoveryNavigator navigator = new DiscoveryNavigator(this, this); navigator.addView("", mainView); setNavigator(navigator); final Page currentPage = Page.getCurrent(); final String requestUrl = currentPage.getLocation().toString(); final String language = request.getLocale().getLanguage(); final UserConfiguration userConfiguration = configurationManager.getUserConfiguration(requestUrl, language); currentPage.setTitle( userConfiguration.getAgency().getAgencyName() + ":" + userConfiguration.getPortal().getPortalName() + ":" + userConfiguration.getLanguage().getLanguageName()); if (getSession().getUIs().isEmpty()) { final WebBrowser webBrowser = currentPage.getWebBrowser(); final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest(); serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); final String ipInformation = WebBrowserUtil.getIpInformation(webBrowser); serviceRequest.setIpInformation(ipInformation); serviceRequest.setUserAgentInformation(webBrowser.getBrowserApplication()); serviceRequest.setLocale(webBrowser.getLocale().toString()); serviceRequest.setOperatingSystem(WebBrowserUtil.getOperatingSystem(webBrowser)); serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS); final ServiceResponse serviceResponse = applicationManager.service(serviceRequest); LOGGER.info(LOG_INFO_BROWSER_ADDRESS_APPLICATION_SESSION_ID_RESULT, requestUrl, language, ipInformation, webBrowser.getBrowserApplication(), serviceRequest.getSessionId(), serviceResponse.getResult().toString()); } }
From source file:com.haulmont.cuba.web.AppUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { log.trace("Initializing UI {}", this); try {// ww w .jav a 2 s . c o m this.testMode = globalConfig.getTestMode(); // init error handlers setErrorHandler(this); // do not grab focus setTabIndex(-1); initJsLibraries(); initInternalComponents(); externalUIComponentsSource.checkInitialized(); if (!App.isBound()) { App app = createApplication(); app.init(request.getLocale()); this.app = app; publishAppInitializedEvent(app); } else { this.app = App.getInstance(); } setupUI(); } catch (Exception e) { log.error("Unable to init ui", e); // unable to connect to middle ware showCriticalExceptionMessage(e); return; } processExternalLink(request); }
From source file:com.haulmont.cuba.web.DefaultApp.java
License:Apache License
@Override public void connectionStateChanged(StateChangeEvent event) { Connection connection = event.getSource(); log.debug("connectionStateChanged connected: {}, authenticated: {}", connection.isConnected(), connection.isAuthenticated()); cleanupBackgroundTasks();/*w w w .j a v a 2s . c o m*/ closeAllWindows(); clearSettingsCache(); if (connection.isConnected()) { UserSession userSession = connection.getSessionNN(); setLocale(userSession.getLocale()); // substitution listeners are cleared by connection on logout connection.addUserSubstitutionListener(this); preventSessionFixation(connection, userSession); initExceptionHandlers(true); initializeUi(); if (linkHandler != null && linkHandler.canHandleLink()) { linkHandler.handle(); linkHandler = null; } afterLoggedIn(); publishAppLoggedInEvent(); } else { initExceptionHandlers(false); VaadinRequest currentRequest = VaadinService.getCurrentRequest(); if (currentRequest != null) { Locale requestLocale = currentRequest.getLocale(); setLocale(resolveLocale(requestLocale)); } try { connection.login(new AnonymousUserCredentials(getLocale())); } catch (LoginException e) { throw new RuntimeException("Unable to login as anonymous!"); } publishAppLoggedOutEvent(event.getPreviousSession()); } }
From source file:com.hybridbpm.ui.HybridbpmUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Responsive.makeResponsive(this); setLocale(request.getLocale()); dashboardListenerId = HazelcastServer.getDashboardEventTopic() .addMessageListener(new DashBoardMessageListener(this)); addStyleName(ValoTheme.UI_WITH_MENU); mainLayout.setExpandRatio(viewContent, 1f); mainLayout.setSizeFull();//from w w w . j a v a2 s . c o m mainLayout.addStyleName("mainview"); viewContent.setSizeFull(); viewContent.addStyleName("view-content"); rootLayout.setSizeFull(); updateContent(); }
From source file:com.mcparland.john.vaadin_mvn_arch.MyUI.java
License:Apache License
@SuppressWarnings("serial") @Override//from www . j a v a 2 s.c om protected void init(VaadinRequest vaadinRequest) { Responsive.makeResponsive(this); setLocale(vaadinRequest.getLocale()); getPage().setTitle("My"); if (!accessControl.isUserSignedIn()) { setContent(new LoginScreen(accessControl, new LoginListener() { @Override public void loginSuccessful() { showMainView(); } })); } else { showMainView(); } }
From source file:de.kaiserpfalzEdv.vaadin.PiraccUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { Responsive.makeResponsive(this); setLocale(vaadinRequest.getLocale()); i18n.setLocale(vaadinRequest.getLocale()); getPage().setTitle(translate("application.name")); if (userStore.getCurrentUser() == null) { LOG.info("Starting log-in for session: {}", vaadinRequest.getWrappedSession().getId()); setContent(new LoginScreen(accessControl, this::showMainView, i18n, bus)); } else {//from w ww .j ava 2s .com LOG.info("New Request in session: {}", vaadinRequest.getWrappedSession().getId()); showMainView(); } }
From source file:de.symeda.sormas.ui.login.LoginUI.java
License:Open Source License
@Override public void init(VaadinRequest vaadinRequest) { setErrorHandler(SormasErrorHandler.get()); setLocale(vaadinRequest.getLocale()); Responsive.makeResponsive(this); VaadinSession.getCurrent().setConverterFactory(new SormasDefaultConverterFactory()); getPage().setTitle("SORMAS"); setContent(new LoginScreen(new LoginListener() { @Override//from www . ja va 2 s .com public void loginSuccessful() { UI.getCurrent().getPage() .setLocation(VaadinServletService.getCurrentServletRequest().getContextPath() + "#" + DataHelper.toStringNullable(UI.getCurrent().getPage().getUriFragment())); } })); }
From source file:de.symeda.sormas.ui.SormasUI.java
License:Open Source License
@Override public void init(VaadinRequest vaadinRequest) { setErrorHandler(SormasErrorHandler.get()); setLocale(vaadinRequest.getLocale()); Responsive.makeResponsive(this); VaadinSession.getCurrent().setConverterFactory(new SormasDefaultConverterFactory()); getPage().setTitle("SORMAS"); initMainScreen();//www . j a v a 2 s . c om }
From source file:ed.cracken.pos.ui.ApplicationUI.java
@Override protected void init(VaadinRequest vaadinRequest) { Responsive.makeResponsive(this); setLocale(vaadinRequest.getLocale()); getPage().setTitle("POS"); if (!accessControl.isUserSignedIn()) { setContent(new LoginScreen(accessControl, new LoginListener() { @Override/*from w ww. j a va 2 s . co m*/ public void loginSuccessful() { showMainView(); } })); } else { showMainView(); } }