Package java.util

Examples of java.util.Locale


      PopulateForm populateForm = new PopulateForm();
      // initialize the Activity form to have default blank values
      populateForm.resetForm(request, form);
      ActivityForm activityForm = (ActivityForm)form;
      // set up the date formatter default to the request locale.
      Locale locale = request.getLocale();
      activityForm.setLocale(locale);
      DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
      DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT, locale);

      int activityType = 1;
View Full Code Here


    {
      throw new ApplicationConfigurationException("test me");
    }

    HttpServletRequest request = injectionContext.getRequest();
    Locale locale = (Locale) request.getAttribute(Globals.LOCALE_KEY);

    return new MessageResourcesHelperImpl(locale, messageResources);

  }
View Full Code Here

        private Font supportedLanguageFont;
       
        @Override
        public Component getListCellRendererComponent(JList list,
            Object value, int index, boolean isSelected, boolean cellHasFocus) {
          Locale locale = (Locale)value;
          String displayedValue = locale.getDisplayLanguage(locale);
          if (FurnitureLibrary.DEFAULT_LANGUAGE.equals(displayedValue)) {
            displayedValue = preferences.getLocalizedString(FurnitureLanguageComboBox.class, "defaultLanguage");
          } else {
            displayedValue = Character.toUpperCase(displayedValue.charAt(0)) + displayedValue.substring(1);
            if (locale.getCountry().length() > 0) {
              displayedValue += " - " + locale.getDisplayCountry(locale);
            }
          }
          super.getListCellRendererComponent(list, displayedValue, index, isSelected,
              cellHasFocus);
          // Initialize fonts if not done
          if (this.defaultFont == null) {
            this.defaultFont = getFont();
            this.supportedLanguageFont =
                new Font(this.defaultFont.getFontName(), Font.BOLD, this.defaultFont.getSize());
           
          }
          setFont(library.getSupportedLanguages().contains(locale.toString())
              ? supportedLanguageFont : defaultFont);
          return this;
        }
      });
    final PropertyChangeListener furnitureLanguageChangeListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ev) {
          String furnitureLangauge = controller.getFurnitureLangauge();
          int underscoreIndex = furnitureLangauge.indexOf('_');
          if (underscoreIndex != -1) {
            setSelectedItem(new Locale(furnitureLangauge.substring(0, underscoreIndex),
                furnitureLangauge.substring(underscoreIndex + 1)));
          } else {
            setSelectedItem(new Locale(furnitureLangauge));
          }
        }
      };
    controller.addPropertyChangeListener(FurnitureLanguageController.Property.FURNITURE_LANGUAGE,
        furnitureLanguageChangeListener);
View Full Code Here

        ViewResolver viewResolver = (ViewResolver) bean;
        String viewName = modelAndView.getViewName();

        try
        {
          Locale locale = (Locale) request.getAttribute(Globals.LOCALE_KEY);
          view = viewResolver.resolveViewName(viewName, locale);
        }
        catch (Exception e)
        {
          throw new ApplicationRuntimeException("Exception thrown during resolution of view name " + viewName
View Full Code Here

  /**
   * ��ʾ���������
   * @return
   */
  public String today(){
    Locale locale = request.getLocale();
    String fmt = null;
    if(locale!=null && "zh".equalsIgnoreCase(locale.getLanguage()))
      fmt = "yyyy��M��d�� EEEEE";
    else
      fmt = "yyyy/MM/dd EEEEE";
    return new SimpleDateFormat(fmt, locale).format(Calendar.getInstance(locale).getTime());
  }
View Full Code Here

    DataVision dv = new DataVision();

    // Language
    if (g.hasOption('g') || g.hasOption('i'))
  I18N.setLanguage(new Locale(g.option('g', "").toLowerCase(),
            g.option('i', "").toUpperCase()));

    dv.layoutEngineChoiceFromOptions(g);
    dv.dataSourceFromOptions(g);
View Full Code Here

    String language = Settings.propLanguage.getString();
    String country = Settings.propCountry.getString();
    String variant = Settings.propVariant.getString();

    Locale loc = new Locale(language, country, variant);
    if (localesList.contains(loc)) {
      mLanguageCB.setSelectedItem(loc);
    }
    else {
      loc = new Locale(language, country);
      if (localesList.contains(loc)) {
        mLanguageCB.setSelectedItem(loc);
      }
      else {
        loc = new Locale(language);
        if (localesList.contains(loc)) {
          mLanguageCB.setSelectedItem(loc);
        }
      }
    }
View Full Code Here

  /**
   * Called by the host-application, if the user wants to save the settings.
   */
  public void saveSettings() {
    Locale loc = (Locale) mLanguageCB.getSelectedItem();

    Settings.propLanguage.setString(loc.getLanguage());
    Settings.propCountry.setString(loc.getCountry());
    Settings.propVariant.setString(loc.getVariant());

    try {
      Settings.propTimezone.setString((String) mTimezoneCB.getSelectedItem());
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      LocaleConfig ma = new LocaleConfigImpl();
      ma.setLocale("ma");
      assertEquals("ma", ma.getLocaleName());

      LocaleConfig ma1 = new LocaleConfigImpl();
      ma1.setLocale(new Locale("ma"));
      assertEquals("ma", ma1.getLocaleName());
   }
View Full Code Here

      assertLocaleConfig(en, "en", "Default configuration for english locale", "UTF-8", "UTF-8", Orientation.LT,
         Locale.ENGLISH);
      assertLocaleConfig(fr, "fr", "Default configuration for the french locale", "UTF-8", "UTF-8", Orientation.LT,
         Locale.FRENCH);
      assertLocaleConfig(ar, "ar", "Default configuration for the arabic locale", "UTF-8", "UTF-8", Orientation.RT,
         new Locale("ar"));
      assertLocaleConfig(vi, "vi", "Default configuration for the vietnam locale", "UTF-8", "UTF-8", Orientation.LT,
         new Locale("vi"));
   }
View Full Code Here

TOP

Related Classes of java.util.Locale

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.