/** * Constructor for testing. * @param clock the clock to use for the current time. */ public CalendarUtil(Clock clock, ResourceLoader rb) { this.clock = clock; this.rb = rb; m_calendar = getCalendarInstance(); initDates(); }
/** * Set the calendar to the next day, and return this. * @return the next day. */ public String getNextDate() { m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1); return getTodayDate (); } // getNextDate
/** * Set the calendar to the first day of this month, and return this day of week. * @param month The month. * @return The calendar's day of week once set to this month. */ public int getFirstDayOfMonth(int month) { m_calendar.set(Calendar.MONTH,month); m_calendar.set(Calendar.DAY_OF_MONTH,1); return (getDay_Of_Week(true) - 1); } // getFirstDayOfMonth
/** * Set the calendar to the next year */ public void setNextYear() { m_calendar.set(Calendar.YEAR,getYear()+1); setDay(getYear(),getMonthInteger(),1); } // setNextYear
void initDates() { Calendar calendarSunday = getCalendarInstance(); Calendar calendarMonday = getCalendarInstance(); Calendar calendarTuesday = getCalendarInstance(); Calendar calendarWednesday = getCalendarInstance(); Calendar calendarThursday = getCalendarInstance(); Calendar calendarFriday = getCalendarInstance(); Calendar calendarSaturday = getCalendarInstance(); YearMonth dec = currentYearMonth.with(Month.DECEMBER); dateJanuary = getDateFromYearMonth(jan); dateFebruary = getDateFromYearMonth(feb); dateMarch = getDateFromYearMonth(mar); dateApril = getDateFromYearMonth(apr); dateMay = getDateFromYearMonth(may); dateJune = getDateFromYearMonth(jun); dateJuly = getDateFromYearMonth(jul); dateAugust = getDateFromYearMonth(aug); dateSeptember = getDateFromYearMonth(sep); dateOctober = getDateFromYearMonth(oct); dateNovember = getDateFromYearMonth(nov); dateDecember = getDateFromYearMonth(dec);
/** * Set the calendar to the prev month, and return this. * @return the prev month. */ public int getPrevMonth() { m_calendar.set(Calendar.MONTH, getMonthInteger()-2); return (getMonthInteger()-1); } // getPrevMonth
public void nextDate() { m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1); }
/** * Get the string representing PM in the users Locale * @return A String representing the afternoon for the current user. */ public static String getLocalPMString() { return getLocalPMString(new DateTime()); }
/** * Get the String representing AM in the users Locale * @return A String representing the morning for the current user. */ public static String getLocalAMString() { return getLocalAMString(new DateTime()); }
public Map<String, String> getLocalizedEventTypesAndIcons() { Map<String, String> icons = CalendarEventType.getIcons(); Map<String, String> localizedEventTypesAndIcons = new TreeMap<>(); for (String eventType: icons.keySet()) { // Localized event types put first so that they can be sorted in the code below. localizedEventTypesAndIcons.put(getLocalizedEventType(eventType), icons.get(eventType)); } return localizedEventTypesAndIcons; }
int firstDayOfWeek = getFirstDayOfWeek();
/** * Set the calendar to the next year */ public void setNextYear() { m_calendar.set(Calendar.YEAR,getYear()+1); setDay(getYear(),getMonthInteger(),1); } // setNextYear
void initDates() { Calendar calendarSunday = getCalendarInstance(); Calendar calendarMonday = getCalendarInstance(); Calendar calendarTuesday = getCalendarInstance(); Calendar calendarWednesday = getCalendarInstance(); Calendar calendarThursday = getCalendarInstance(); Calendar calendarFriday = getCalendarInstance(); Calendar calendarSaturday = getCalendarInstance(); YearMonth dec = currentYearMonth.with(Month.DECEMBER); dateJanuary = getDateFromYearMonth(jan); dateFebruary = getDateFromYearMonth(feb); dateMarch = getDateFromYearMonth(mar); dateApril = getDateFromYearMonth(apr); dateMay = getDateFromYearMonth(may); dateJune = getDateFromYearMonth(jun); dateJuly = getDateFromYearMonth(jul); dateAugust = getDateFromYearMonth(aug); dateSeptember = getDateFromYearMonth(sep); dateOctober = getDateFromYearMonth(oct); dateNovember = getDateFromYearMonth(nov); dateDecember = getDateFromYearMonth(dec);
/** * Set the calendar to the prev month, and return this. * @return the prev month. */ public int getPrevMonth() { m_calendar.set(Calendar.MONTH, getMonthInteger()-2); return (getMonthInteger()-1); } // getPrevMonth
public void setPrevDate(int days) { m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - days); }
/** * Get the string representing PM in the users Locale * @return A String representing the afternoon for the current user. */ public static String getLocalPMString() { return getLocalPMString(new DateTime()); }
/** * Get the String representing AM in the users Locale * @return A String representing the morning for the current user. */ public static String getLocalAMString() { return getLocalAMString(new DateTime()); }
public Map<String, String> getLocalizedEventTypesAndIcons() { Map<String, String> icons = CalendarEventType.getIcons(); Map<String, String> localizedEventTypesAndIcons = new TreeMap<>(); for (String eventType: icons.keySet()) { // Localized event types put first so that they can be sorted in the code below. localizedEventTypesAndIcons.put(getLocalizedEventType(eventType), icons.get(eventType)); } return localizedEventTypesAndIcons; }
int firstDayOfWeek = getFirstDayOfWeek();
/** * Set the calendar to the prev day, and return this. * @return the prev day. */ public String getPrevDate() { m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() -1); return getTodayDate(); } // getPrevDate