Tabnine Logo
GlobalConfig.getLocaleSelectVisible
Code IndexAdd Tabnine to your IDE (free)

How to use
getLocaleSelectVisible
method
in
com.haulmont.cuba.core.global.GlobalConfig

Best Java code snippets using com.haulmont.cuba.core.global.GlobalConfig.getLocaleSelectVisible (Showing top 8 results out of 315)

origin: com.haulmont.cuba/cuba-idp

@GetMapping(value = "/locales", produces = "application/json; charset=UTF-8")
@ResponseBody
public LocalesInfo getLocales() {
  LocalesInfo localesInfo = new LocalesInfo();
  localesInfo.setLocaleSelectVisible(globalConfig.getLocaleSelectVisible());
  Map<String, String> locales = new LinkedHashMap<>();
  for (Map.Entry<String, Locale> entry : globalConfig.getAvailableLocales().entrySet()) {
    locales.put(entry.getValue().toLanguageTag(), entry.getKey());
  }
  localesInfo.setLocales(locales);
  return localesInfo;
}
origin: com.haulmont.cuba/cuba-web

protected Locale resolveLocale(@Nullable Locale requestLocale) {
  Map<String, Locale> locales = globalConfig.getAvailableLocales();
  if (globalConfig.getLocaleSelectVisible()) {
    String lastLocale = getCookieValue(COOKIE_LOCALE);
    if (lastLocale != null) {
      for (Locale locale : locales.values()) {
        if (locale.toLanguageTag().equals(lastLocale)) {
          return locale;
        }
      }
    }
  }
  if (requestLocale != null) {
    Locale requestTrimmedLocale = messageTools.trimLocale(requestLocale);
    if (locales.containsValue(requestTrimmedLocale)) {
      return requestTrimmedLocale;
    }
    // if not found and application locale contains country, try to match by language only
    if (!StringUtils.isEmpty(requestLocale.getCountry())) {
      Locale appLocale = Locale.forLanguageTag(requestLocale.getLanguage());
      for (Locale locale : locales.values()) {
        if (Locale.forLanguageTag(locale.getLanguage()).equals(appLocale)) {
          return locale;
        }
      }
    }
  }
  // return default locale
  return messageTools.getDefaultLocale();
}
origin: com.haulmont.cuba/cuba-web

protected Locale resolveLocale(HttpServletRequest req, Messages messages, GlobalConfig globalConfig) {
  Map<String, Locale> locales = globalConfig.getAvailableLocales();
  if (globalConfig.getLocaleSelectVisible()) {
    String lastLocale = getLocaleFromCookie(req);
    if (lastLocale != null) {
      for (Locale locale : locales.values()) {
        if (locale.toLanguageTag().equals(lastLocale)) {
          return locale;
        }
      }
    }
  }
  Locale requestLocale = req.getLocale();
  if (requestLocale != null) {
    Locale requestTrimmedLocale = messages.getTools().trimLocale(requestLocale);
    if (locales.containsValue(requestTrimmedLocale)) {
      return requestTrimmedLocale;
    }
    // if not found and application locale contains country, try to match by language only
    if (!StringUtils.isEmpty(requestLocale.getCountry())) {
      Locale appLocale = Locale.forLanguageTag(requestLocale.getLanguage());
      for (Locale locale : locales.values()) {
        if (Locale.forLanguageTag(locale.getLanguage()).equals(appLocale)) {
          return locale;
        }
      }
    }
  }
  return messages.getTools().getDefaultLocale();
}
origin: com.haulmont.cuba/cuba-core

  @Deprecated
  protected void copyParamsToCredentials(Map<String, Object> params, AbstractClientCredentials credentials) {
    // for compatibility only
    Object clientType = params.get(ClientType.class.getName());
    if (clientType != null && credentials.getClientType() == null) {
      credentials.setClientType(ClientType.valueOf((String) clientType));
    }
    Object clientInfo = params.get(SessionParams.CLIENT_INFO.getId());
    if (clientInfo != null && credentials.getClientInfo() == null) {
      credentials.setClientInfo((String) clientInfo);
    }
    Object ipAddress = params.get(SessionParams.IP_ADDRESS.getId());
    if (ipAddress != null && credentials.getIpAddress() == null) {
      credentials.setIpAddress((String) ipAddress);
    }
    Object hostName = params.get(SessionParams.HOST_NAME.getId());
    if (hostName != null) {
      credentials.setHostName((String) hostName);
    }
    if (!globalConfig.getLocaleSelectVisible()) {
      credentials.setOverrideLocale(false);
    }
  }
}
origin: com.haulmont.cuba/cuba-idp

if (globalConfig.getLocaleSelectVisible() && auth.getLocale() != null) {
  Map<String, Locale> availableLocales = globalConfig.getAvailableLocales();
  Locale requestedLocale = Locale.forLanguageTag(auth.getLocale());
origin: com.haulmont.cuba/cuba-core

@Deprecated
protected void copyParamsToCredentials(Map<String, Object> params, AbstractClientCredentials credentials) {
  // for compatibility only
  Object clientType = params.get(ClientType.class.getName());
  if (clientType != null) {
    credentials.setClientType(ClientType.valueOf((String) clientType));
  }
  Object clientInfo = params.get(SessionParams.CLIENT_INFO.getId());
  if (clientInfo != null) {
    credentials.setClientInfo((String) clientInfo);
  }
  Object ipAddress = params.get(SessionParams.IP_ADDRESS.getId());
  if (ipAddress != null) {
    credentials.setIpAddress((String) ipAddress);
  }
  Object hostName = params.get(SessionParams.HOST_NAME.getId());
  if (hostName != null) {
    credentials.setHostName((String) hostName);
  }
  if (!globalConfig.getLocaleSelectVisible()) {
    credentials.setOverrideLocale(false);
  }
  RemoteClientInfo remoteClientInfo = RemoteClientInfo.get();
  if (remoteClientInfo != null) {
    String address = remoteClientInfo.getAddress();
    if (!trustedLoginHandler.checkAddress(address)) {
      credentials.setIpAddress(address);
    }
  }
}
origin: com.haulmont.cuba/cuba-web

Locale loggedInLocale = connection.getSession().getLocale();
if (globalConfig.getLocaleSelectVisible()) {
  app.addCookie(App.COOKIE_LOCALE, loggedInLocale.toLanguageTag());
origin: com.haulmont.cuba/cuba-web

protected void initLocales() {
  localesSelect.setOptionsMap(globalConfig.getAvailableLocales());
  localesSelect.setValue(app.getLocale());
  boolean localeSelectVisible = globalConfig.getLocaleSelectVisible();
  localesSelect.setVisible(localeSelectVisible);
  // if old layout is used
  Component localesSelectLabel = getComponent("localesSelectLabel");
  if (localesSelectLabel != null) {
    localesSelectLabel.setVisible(localeSelectVisible);
  }
  localesSelect.addValueChangeListener(e -> {
    Locale selectedLocale = (Locale) e.getValue();
    app.setLocale(selectedLocale);
    authInfoThreadLocal.set(new AuthInfo(loginField.getValue(), passwordField.getValue(),
        rememberMeCheckBox.getValue()));
    try {
      app.createTopLevelWindow();
    } finally {
      authInfoThreadLocal.set(null);
    }
  });
}
com.haulmont.cuba.core.globalGlobalConfiggetLocaleSelectVisible

Javadoc

Show locale select in LoginWindow.

Popular methods of GlobalConfig

  • getAvailableLocales
    Supported locales. List of locales is shown on user login.
  • getConfDir
  • getWebHostName
  • getWebPort
  • getWebAppUrl
  • getWebContextName
  • getTempDir
  • getAllowQueryFromSelected
  • getDataDir
  • getHealthCheckResponse
  • getNumberIdCacheSize
  • getRestRequiresSecurityToken
  • getNumberIdCacheSize,
  • getRestRequiresSecurityToken,
  • getTestMode,
  • getUserSessionLogEnabled,
  • getAnonymousSessionId,
  • getAppFolderEditWindowClassName,
  • getCubaClasspathDirectories,
  • getDeepCopyNonPersistentReferences,
  • getDisableEscapingLikeForDataStores

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Table (org.hibernate.mapping)
    A relational table
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now