/** * Localized display names for week days starting from sunday. Returned * array's length is always 7. * * @return Array of localized weekday names. */ protected String[] getDayNamesShort() { DateFormatSymbols s = new DateFormatSymbols(getLocale()); return Arrays.copyOfRange(s.getWeekdays(), 1, 8); }
/** * Localized display names for months starting from January. Returned * array's length is always 12. * * @return Array of localized month names. */ protected String[] getMonthNamesShort() { DateFormatSymbols s = new DateFormatSymbols(getLocale()); return Arrays.copyOf(s.getShortMonths(), 12); }
/** * Initialize the java calendar instance with the current locale and * timezone. */ private void initCalendarWithLocale() { if (timezone != null) { currentCalendar = java.util.Calendar.getInstance(timezone, getLocale()); } else { currentCalendar = java.util.Calendar.getInstance(getLocale()); } if (customFirstDayOfWeek != null) { currentCalendar.setFirstDayOfWeek(customFirstDayOfWeek); } }
/** * Gets currently active time format. Value is either TimeFormat.Format12H * or TimeFormat.Format24H. * * @return TimeFormat Format for the time. */ public TimeFormat getTimeFormat() { if (currentTimeFormat == null) { SimpleDateFormat f; if (getLocale() == null) { f = (SimpleDateFormat) SimpleDateFormat .getTimeInstance(SimpleDateFormat.SHORT); } else { f = (SimpleDateFormat) SimpleDateFormat .getTimeInstance(SimpleDateFormat.SHORT, getLocale()); } String p = f.toPattern(); if (p.indexOf("HH") != -1 || p.indexOf("H") != -1) { return TimeFormat.Format24H; } return TimeFormat.Format12H; } return currentTimeFormat; }
private void setActionsForEachHalfHour( Map<CalendarDateRange, Set<Action>> actionMap, Date start, Date end, Action.Handler actionHandler) { GregorianCalendar cal = new GregorianCalendar(getTimeZone(), getLocale()); cal.setTime(start); while (cal.getTime().before(end)) { Date s = cal.getTime(); cal.add(java.util.Calendar.MINUTE, 30); Date e = cal.getTime(); CalendarDateRange range = new CalendarDateRange(s, e, getTimeZone()); Action[] actions = actionHandler.getActions(range, this); if (actions != null) { Set<Action> actionSet = new LinkedHashSet<Action>( Arrays.asList(actions)); actionMap.put(range, actionSet); } } }
getLocale()); cal.clear(); cal.set(currentCalendar.get(java.util.Calendar.YEAR),