Esempio n. 1
0
  public MainConfigBackingBean(EhourConfigStub config) {
    this.config = config;

    smtpAuthentication =
        StringUtils.isNotBlank(config.getSmtpUsername())
            && StringUtils.isNotBlank(config.getSmtpPassword());

    Calendar cal = new GregorianCalendar();
    DateUtil.dayOfWeekFix(cal);
    cal.set(Calendar.DAY_OF_WEEK, config.getFirstDayOfWeek());
    firstWeekStart = cal.getTime();
  }
Esempio n. 2
0
  public List<Locale> getAvailableLanguages() {
    Locale[] locales = Locale.getAvailableLocales();
    Map<String, Locale> localeMap = new HashMap<String, Locale>();

    // remove all variants
    for (Locale locale : locales) {
      if (isTranslationsOnly()
          && !ArrayUtils.contains(config.getAvailableTranslations(), locale.getLanguage())) {
        continue;
      }

      if (localeMap.containsKey(locale.getLanguage())
          && locale.getDisplayName().indexOf('(') != -1) {
        continue;
      }

      localeMap.put(locale.getLanguage(), locale);
    }

    SortedSet<Locale> localeSet =
        new TreeSet<Locale>(new LocaleComparator(LocaleComparator.CompareType.LANGUAGE));

    for (Locale locale : localeMap.values()) {
      localeSet.add(locale);
    }

    return new ArrayList<Locale>(localeSet);
  }
Esempio n. 3
0
  /** @param firstWeekStart the firstWeekStart to set */
  public void setFirstWeekStart(Date firstWeekStart) {
    this.firstWeekStart = firstWeekStart;

    Calendar cal = new GregorianCalendar();
    cal.setTime(firstWeekStart);
    config.setFirstDayOfWeek(cal.get(Calendar.DAY_OF_WEEK));
  }
Esempio n. 4
0
 public void setLocaleCountry(Locale localeCountry) {
   config.setLocaleFormatting(localeCountry);
 }
Esempio n. 5
0
 public Locale getLocaleCountry() {
   return config.getFormattingLocale();
 }
Esempio n. 6
0
 /** @param localeLanguage the localeLanguage to set */
 public void setLocaleLanguage(Locale localeLanguage) {
   config.setLocaleLanguage(localeLanguage);
 }
Esempio n. 7
0
 /** @return the localeLanguage */
 public Locale getLocaleLanguage() {
   return config.getLanguageLocale();
 }