public static void setActiveWeek(int year, int month, int date) { activeWeek.set(year, month, date); GregorianCalendar endOfActiveWeek = (GregorianCalendar) activeWeek.clone(); endOfActiveWeek.add(GregorianCalendar.DATE, 7); Client.addAppointments(Appointment.getAppointments(user, activeWeek, endOfActiveWeek)); while ( /*activeWeek.get(GregorianCalendar.DAY_OF_MONTH) != 1 && */ activeWeek.get( GregorianCalendar.DAY_OF_WEEK) != /*activeWeek.getFirstDayOfWeek()*/ GregorianCalendar.MONDAY) { activeWeek.add(GregorianCalendar.DAY_OF_MONTH, -1); } System.out.println(Client.dateToString(activeWeek)); for (ActiveWeekListener listener : activeWeekListeners) { listener.setActiveWeek( activeWeek.get(GregorianCalendar.YEAR), activeWeek.get(GregorianCalendar.MONTH), activeWeek.get(GregorianCalendar.DATE)); } }
public static void setActiveWeek(GregorianCalendar g) { GregorianCalendar endG = (GregorianCalendar) g.clone(); endG.add(GregorianCalendar.DATE, 7); Client.addAppointments(Appointment.getAppointments(user, g, endG)); setActiveWeek( g.get(GregorianCalendar.YEAR), g.get(GregorianCalendar.MONTH), g.get(GregorianCalendar.DATE)); }