Package org.springframework.beans.propertyeditors

Examples of org.springframework.beans.propertyeditors.LocaleEditor


            qNameEditor.setAsText(tokens[FAULT_CODE_INDEX].trim());
            definition.setFaultCode((QName) qNameEditor.getValue());
            if (tokens.length > 1) {
                definition.setFaultStringOrReason(tokens[FAULT_STRING_INDEX].trim());
                if (tokens.length > 2) {
                    LocaleEditor localeEditor = new LocaleEditor();
                    localeEditor.setAsText(tokens[FAULT_STRING_LOCALE_INDEX].trim());
                    definition.setLocale((Locale) localeEditor.getValue());
                }
            }
            setValue(definition);
        }
    }
View Full Code Here


    if (newLocale != null) {
      LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
      if (localeResolver == null) {
        throw new IllegalStateException("No LocaleResolver found: not in a DispatcherServlet request?");
      }
      LocaleEditor localeEditor = new LocaleEditor();
      localeEditor.setAsText(newLocale);
      localeResolver.setLocale(request, response, (Locale) localeEditor.getValue());
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here

    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(InputSource.class, new InputSourceEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
View Full Code Here

    // The JDK does not contain a default editor for any of these target types.
    this.defaultEditors.put(Class.class, new ClassEditor());
    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
    this.defaultEditors.put(URL.class, new URLEditor());
View Full Code Here

    this.defaultEditors.put(Class.class, new ClassEditor());
    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
View Full Code Here

    if (newLocale != null) {
      LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
      if (localeResolver == null) {
        throw new IllegalStateException("No LocaleResolver found: not in a DispatcherServlet request?");
      }
      LocaleEditor localeEditor = new LocaleEditor();
      localeEditor.setAsText(newLocale);
      localeResolver.setLocale(request, response, (Locale) localeEditor.getValue());
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here

    // The JDK does not contain a default editor for any of these target types.
    this.defaultEditors.put(Class.class, new ClassEditor());
    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(URL.class, new URLEditor());

    // Register JDK-1.4-specific editors.
View Full Code Here

    this.defaultEditors.put(Charset.class, new CharsetEditor());
    this.defaultEditors.put(Class.class, new ClassEditor());
    this.defaultEditors.put(Class[].class, new ClassArrayEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
    this.defaultEditors.put(URL.class, new URLEditor());
View Full Code Here

    }

    public static Locale getLocale(HttpServletRequest webRequest) {
        if (webRequest.getParameter(SystemParameterNames.getLocale()) != null) {
            try {
                LocaleEditor localeEditor = new LocaleEditor();
                localeEditor.setAsText(webRequest.getParameter(SystemParameterNames.getLocale()));
                Locale locale = (Locale) localeEditor.getValue();
                if (isValidLocale(locale)) {
                    return locale;
                }
            } catch (Exception e) {
                return Locale.SIMPLIFIED_CHINESE;
View Full Code Here

            .getLocaleResolver(request);
        if (localeResolver == null) {
          throw new IllegalStateException(
              "No LocaleResolver found: not in a DispatcherServlet request?");
        }
        LocaleEditor localeEditor = new LocaleEditor();
        localeEditor.setAsText(newLocale);
        localeResolver.setLocale(request, response,
            (Locale) localeEditor.getValue());
      }
    }

    // Proceed in any case.
    return true;
View Full Code Here

TOP

Related Classes of org.springframework.beans.propertyeditors.LocaleEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.