Package java.text

Examples of java.text.DateFormatSymbols


        encodeInputField(uiComponent, writer, clientId + ID_SECONDS_POSTFIX, userData.getSeconds(), 2, disabled, readonly);
    }
   
    protected void encodePopupCalendarButton(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId, Locale currentLocale) throws IOException{

        DateFormatSymbols symbols = new DateFormatSymbols(currentLocale);

        HtmlCalendarRenderer.addScriptAndCSSResources(facesContext, symbols,
                HtmlCalendarRenderer.mapMonths(symbols), Calendar.getInstance(currentLocale).getFirstDayOfWeek(),
                uiComponent);
View Full Code Here


                    this,
                    null,
                    null);

            Locale locale = getPage().getLocale();
            DateFormatSymbols dfs = new DateFormatSymbols(locale);
            Calendar cal = Calendar.getInstance(locale);

            Date value = getValue();

            Map symbols = new HashMap();

            symbols.put(SYM_NAME, name);
            symbols.put(SYM_FORMAT, format);
            symbols.put(SYM_INCL_WEEK, getIncludeWeek() ? Boolean.TRUE : Boolean.FALSE);

            symbols.put(SYM_MONTHNAMES, makeStringList(dfs.getMonths(), 0, 12));
            symbols.put(SYM_SHORT_MONTHNAMES, makeStringList(dfs.getShortMonths(), 0, 12));
            symbols.put(SYM_WEEKDAYNAMES, makeStringList(dfs.getWeekdays(), 1, 8));
            symbols.put(SYM_SHORT_WEEKDAYNAMES, makeStringList(dfs.getShortWeekdays(), 1, 8));
            symbols.put(SYM_FIRSTDAYINWEEK, new Integer(cal.getFirstDayOfWeek() - 1));
            symbols.put(SYM_MINDAYSINFIRSTWEEK, new Integer(cal.getMinimalDaysInFirstWeek()));
            symbols.put(SYM_FORMNAME, form.getName());
            symbols.put(SYM_VALUE, value);
View Full Code Here

      try
      {
        ResourceBundle oraElementsData =
          ResourceBundle.getBundle(_ORA_LOCALE_ELEMENTS_BASE, locale);

        DateFormatSymbols syms = new DateFormatSymbols(locale);

        String[] res = oraElementsData.getStringArray("AmPmMarkers");
        if (res != null)
          syms.setAmPmStrings(res);
        res = oraElementsData.getStringArray("Eras");
        if (res != null)
          syms.setEras(res);
        res = oraElementsData.getStringArray("MonthNames");
        if (res != null)
          syms.setMonths(res);
        res = oraElementsData.getStringArray("MonthAbbreviations");
        if (res != null)
          syms.setShortMonths(res);
        res = oraElementsData.getStringArray("DayAbbreviations");
        if (res != null)
          syms.setShortWeekdays(res);
        res = oraElementsData.getStringArray("DayNames");
        if (res != null)
          syms.setWeekdays(res);
        sdf = new SimpleDateFormat(pattern, syms);
      }
      catch (MissingResourceException e)
      {
        // the Oracle resource bundle must be screwed up, just use the default
View Full Code Here

    // last days of the month
    long firstDOMTime = displayedTime + (firstDOM - dom) * _MILLIS_IN_DAY;
    long lastDOMTime = displayedTime +
                       ((long)(lastDOM + 1 - dom)) * _MILLIS_IN_DAY - 1;

    DateFormatSymbols dateSymbols = _getDateFormatSymbols(arc);

    int firstDOW = displayedCalendar.getMinimum(Calendar.DAY_OF_WEEK);
    int lastDOW = displayedCalendar.getMaximum(Calendar.DAY_OF_WEEK);
    int dowCount = lastDOW - firstDOW + 1;

    //
    // Write the month and year drop downs
    //
    // If we're running in inline mode, make sure we have
    // access to the necessary scripts
    if (isInline)
      XhtmlUtils.addLib(context, arc, "_calsd()");


    // make sure that the js lib is added
    XhtmlUtils.addLib(context, arc, "_updateCal()");

    String baseNavURL = _createNavURL(arc,
                                      destString,
                                      minTime,
                                      maxTime,
                                      selectedTime,
                                      id);

    writer.startElement("tr", null);

    // render the previous button
    _renderNextPrev(context,
                    arc,
                    component,
                    bean,
                    true,
                    minTime,
                    firstDOMTime,
                    baseNavURL,
                    isInline);

    writer.startElement("td", null);
    writer.writeAttribute("colspan", IntegerUtils.getString(dowCount - 2), null);
    renderStyleClass(context, arc, styles.TITLE_STYLE);

    // don't wrap the month and year controls
    writer.writeAttribute("nowrap", Boolean.TRUE, null);

    _renderMonthAndYear(context,
                        arc,
                        minTime,
                        maxTime,
                        displayedCalendar,
                        dateSymbols,
                        baseNavURL,
                        id,
                        isInline);

    writer.endElement("td");

    // render the next button
    _renderNextPrev(context,
                    arc,
                    component,
                    bean,
                    false,
                    maxTime,
                    lastDOMTime,
                    baseNavURL,
                    isInline);

    writer.endElement("tr");

    // Place the rest of the calendar content within its own
    // table, so that we can style the calendar's border
    writer.startElement("tr", null);
    writer.startElement("td", null);
    writer.writeAttribute("colspan", IntegerUtils.getString(dowCount), null);

    writer.startElement("table", null);
    //fix for bug 4410632: added summary attribute
    OutputUtils.renderLayoutTableAttributes(context,
                                            arc,
                                            "0", "0", "0", "100%",
                        arc.getTranslatedString("af_chooseDate.SUMMARY"));
    renderStyleClass(context, arc, styles.CONTENT_STYLE);

    //
    // Write the day of the week headers
    //
    writer.startElement("tr", null);
    renderStyleClass(context, arc, styles.HEADER_STYLE);

    String[] shortWeekdays;
    // Bug 2388968:  Java's "short" weekdays in Arabic are single
    // letters, which we're told are inadequate.  Output entire
    // names instead.
    if ("ar".equals(arc.getLocaleContext().getFormattingLocale().getLanguage()))
      shortWeekdays = dateSymbols.getWeekdays();
    else
      shortWeekdays = dateSymbols.getShortWeekdays();

    for (int i = firstDOW; i <= lastDOW; i++)
    {
      writer.startElement("th", null);
      writer.writeAttribute("scope", "col", null);
View Full Code Here

  private static DateFormatSymbols _getDateFormatSymbols(
    RenderingContext arc
    )
  {
    DateFormatSymbols symbols = (DateFormatSymbols)
                           arc.getProperties().get(_DATE_SYMBOLS_KEY);

    if (symbols == null)
    {
      symbols = new DateFormatSymbols(arc.getLocaleContext().getFormattingLocale());

      arc.getProperties().put(_DATE_SYMBOLS_KEY, symbols);
    }

    return symbols;
View Full Code Here

        word = word.substring(0, 3);
    } else {
        abbrev = false;
    }

    DateFormatSymbols symbols = new DateFormatSymbols(Locale.US);
    if (abbrev) {
        names = symbols.getShortMonths();
    } else {
        names = symbols.getMonths();
    }
    for (ix = 0; ix < names.length; ix++) {
        if (word.equalsIgnoreCase(names[ix])) {
      return new ClockToken(ClockToken.MONTH, ix);
  }
    }
    if (abbrev) {
        names = symbols.getShortWeekdays();
    } else {
        names = symbols.getWeekdays();
    }
    for (ix = 0; ix < names.length; ix++) {
        if (word.equalsIgnoreCase(names[ix])) {
      return new ClockToken(ClockToken.DAY, ix);
  }
    }

    // Drop out any periods and try the timezone table.

    StringBuffer withoutDotsBuf = new StringBuffer(word.length());
    for (ix = 0; ix < word.length(); ix++) {
        if (word.charAt(ix) != '.') {
      withoutDotsBuf.append(word.charAt(ix));
  }
    }

    String withoutDots = new String(withoutDotsBuf);
    zones = symbols.getZoneStrings();

    for (ix = 0; ix < zones.length; ix++) {
        if (withoutDots.equalsIgnoreCase(zones[ix][2]) ||
      withoutDots.equalsIgnoreCase(zones[ix][4])) {
       TimeZone zone = TimeZone.getTimeZone(zones[ix][0]);
View Full Code Here

    if (response.wasRendered(key))
    {
      return;
    }

    DateFormatSymbols dfSymbols = null;
    if (GETINSTANCEMETHOD != null)
    {
      // try to use JDK 6 DateFormatSymbols.getInstance(Locale)
      try
      {
        dfSymbols = (DateFormatSymbols)GETINSTANCEMETHOD.invoke(null, locale);
      }
      catch (Exception e)
      {
        // ignore
      }
    }
    if (dfSymbols == null)
    {
      dfSymbols = new DateFormatSymbols(locale);
    }

    Map<String, Object> i18nVariables = new LinkedHashMap<String, Object>();
    setWidgetProperty(i18nVariables, "MONTHS_SHORT", filterEmpty(dfSymbols.getShortMonths()));
    setWidgetProperty(i18nVariables, "MONTHS_LONG", filterEmpty(dfSymbols.getMonths()));
    setWidgetProperty(i18nVariables, "WEEKDAYS_MEDIUM",
      filterEmpty(dfSymbols.getShortWeekdays()));
    setWidgetProperty(i18nVariables, "WEEKDAYS_LONG", filterEmpty(dfSymbols.getWeekdays()));

    i18nVariables.put("START_WEEKDAY", Calendar.getInstance(locale).getFirstDayOfWeek() - 1);

    if (Locale.SIMPLIFIED_CHINESE.equals(locale) || Locale.TRADITIONAL_CHINESE.equals(locale))
    {
      setWidgetProperty(i18nVariables, "WEEKDAYS_1CHAR",
        filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
      i18nVariables.put("WEEKDAYS_SHORT",
        filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
    }
    else
    {
      setWidgetProperty(i18nVariables, "WEEKDAYS_1CHAR",
        filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 1)));
      setWidgetProperty(i18nVariables, "WEEKDAYS_SHORT",
        filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 2)));
    }

    StringBuilder i18n = new StringBuilder(key);
    i18n.append('=');
    appendMapping(i18nVariables, i18n);
View Full Code Here

   String[] shortMonths;

   public DateTimeDateFormat()
   {
      super();
      shortMonths = new DateFormatSymbols().getShortMonths();
   }
View Full Code Here

         setDatePattern_(getDatePattern_().replaceAll("a", ""));
      }

      dateFormat_ = new SimpleDateFormat(getDatePattern_());

      DateFormatSymbols symbols = new DateFormatSymbols(locale);
      months_ = symbols.getMonths();
   }
View Full Code Here

    int minimum = cal.getActualMinimum(Calendar.DAY_OF_WEEK);

    int monthMax = cal.getActualMaximum(Calendar.MONTH);
    int monthMin = cal.getActualMinimum(Calendar.MONTH);

    DateFormatSymbols symbols = new DateFormatSymbols(locale);
    String[] weekDayLabels = ComponentUtil.asArray(calendar
        .getWeekDayLabels());
    if (weekDayLabels == null) {
      weekDayLabels = symbols.getWeekdays();
      weekDayLabels = shiftDates(minimum, maximum, weekDayLabels);
    }

    String[] weekDayLabelsShort = ComponentUtil.asArray(calendar
        .getWeekDayLabelsShort());
    if (weekDayLabelsShort == null) {
      weekDayLabelsShort = symbols.getShortWeekdays();
      weekDayLabelsShort = shiftDates(minimum, maximum,
          weekDayLabelsShort);
    }

    String[] monthLabels = ComponentUtil.asArray(calendar.getMonthLabels());
    if (monthLabels == null) {
      monthLabels = symbols.getMonths();
      monthLabels = shiftDates(monthMin, monthMax, monthLabels);
    }

    String[] monthLabelsShort = ComponentUtil.asArray(calendar
        .getMonthLabelsShort());
    if (monthLabelsShort == null) {
      monthLabelsShort = symbols.getShortMonths();
      monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
    }

    map.put(WEEK_DAY_LABELS, weekDayLabels);
    map.put(WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
View Full Code Here

TOP

Related Classes of java.text.DateFormatSymbols

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.