Example #1
0
 /**
  * set / update the text of the displayLabels. these are the Week column headers above the days on
  * the Calendar part of the <code>CDateTime</code>.
  */
 private void updateDaysOfWeek() {
   if (dayPanel != null) {
     Calendar tmpcal = cdt.getCalendarInstance();
     tmpcal.set(Calendar.DAY_OF_WEEK, tmpcal.getFirstDayOfWeek());
     Locale locale = cdt.getLocale();
     boolean ltr =
         (ComponentOrientation.getOrientation(locale).isLeftToRight()
             && !locale.getLanguage().equals("zh")); // $NON-NLS-1$
     BreakIterator iterator = BreakIterator.getCharacterInstance(locale);
     for (int x = 0; x < dayLabels.length; x++) {
       String str = getFormattedDate("E", tmpcal.getTime()); // $NON-NLS-1$
       if (dayLabels[x].getData(CDT.Key.Compact, Boolean.class)) {
         iterator.setText(str);
         int start, end;
         if (ltr) {
           start = iterator.first();
           end = iterator.next();
         } else {
           end = iterator.last();
           start = iterator.previous();
         }
         dayLabels[x].setText(str.substring(start, end));
       } else {
         dayLabels[x].setText(str);
       }
       tmpcal.add(Calendar.DAY_OF_WEEK, 1);
     }
   }
 }
Example #2
0
 /**
  * set / update, or calls methods to set / update, all components affected by the <code>locale
  * </code>
  *
  * @see #updateHeader
  * @see #updateDayLabels
  * @see #updateDays
  * @see #updateFooter
  */
 private void updateLocale() {
   Locale locale = cdt.getLocale();
   if (monthPrev != null)
     monthPrev.setToolTipText(Resources.getString("nav_prev_month", locale)); // $NON-NLS-1$
   if (monthNext != null)
     monthNext.setToolTipText(Resources.getString("nav_next_month", locale)); // $NON-NLS-1$
   if (dateNow != null)
     dateNow.setToolTipText(Resources.getString("nav_current_day", locale)); // $NON-NLS-1$
   if (yearPrev != null)
     yearPrev.setToolTipText(Resources.getString("nav_prev_year", locale)); // $NON-NLS-1$
   if (yearNext != null)
     yearNext.setToolTipText(Resources.getString("nav_next_year", locale)); // $NON-NLS-1$
   if (today != null)
     today.setToolTipText(Resources.getString("nav_current_day", locale)); // $NON-NLS-1$
   if (todayMenuItem != null)
     todayMenuItem.setText(Resources.getString("nav_current_day", locale)); // $NON-NLS-1$
   if (showSelMenuItem != null)
     showSelMenuItem.setText(Resources.getString("show_selection", locale)); // $NON-NLS-1$
 }
Example #3
0
 /** set / update the text of the <code>footerButton</code>. */
 private void updateFooter() {
   if (footer != null) {
     Locale locale = cdt.getLocale();
     if (today != null) {
       if (cdt.builder.hasFooter(Footer.VERBOSE_TODAY)) {
         Calendar cal = cdt.getCalendarInstance(System.currentTimeMillis());
         Object[] margs = {
           cal.getTime(),
           Resources.getString("date_ordinal_" + cal.get(Calendar.DATE), locale) // $NON-NLS-1$
         };
         MessageFormat formatter =
             new MessageFormat(
                 Resources.getString("today_verbose.text", locale), locale); // $NON-NLS-1$
         today.setText(formatter.format(margs));
       } else {
         today.setText(Resources.getString("today.text", locale)); // $NON-NLS-1$
       }
     }
     if (clear != null) {
       clear.setText(Resources.getString("clear.text", locale)); // $NON-NLS-1$
     }
     footer.layout();
   }
 }