Package org.opencustomer.webapp.module.calendar.util

Examples of org.opencustomer.webapp.module.calendar.util.CalendarView


            panel.removeAttribute("calendarView");
        }

        panel.setAttribute("calendar", calendar);

        CalendarView calendarView = (CalendarView) panel.getAttribute("calendarView");
        if (calendarView == null)
        {
            Date referenceDate = new Date();
            if (panel.getAttribute("reference_day") != null)
                referenceDate = (Date) panel.getAttribute("reference_day");

            calendarView = new CalendarView(calendar, referenceDate, CalendarView.Period.MONTH, activeUser);
            panel.setAttribute("calendarView", calendarView);
            update = false;
        }

        if (form.isDoLastMonth())
        {
            if (log.isDebugEnabled())
                log.debug("go to last month");

            java.util.Calendar cal = GregorianCalendar.getInstance();
            cal.setTime(calendarView.getReferenceDate());
            if (cal.get(java.util.Calendar.MONTH) == java.util.Calendar.JANUARY)
                cal.roll(java.util.Calendar.YEAR, -1);
            cal.roll(java.util.Calendar.MONTH, -1);
            calendarView.setReferenceDate(cal.getTime());

            panel.setAttribute("reference_day", cal.getTime());
        }
        else if (form.isDoNextMonth())
        {
            if (log.isDebugEnabled())
                log.debug("go to next month");

            java.util.Calendar cal = GregorianCalendar.getInstance();
            cal.setTime(calendarView.getReferenceDate());
            if (cal.get(java.util.Calendar.MONTH) == java.util.Calendar.DECEMBER)
                cal.roll(java.util.Calendar.YEAR, +1);
            cal.roll(java.util.Calendar.MONTH, +1);
            calendarView.setReferenceDate(cal.getTime());

            panel.setAttribute("reference_day", cal.getTime());
        }
        else if (update)
        {
            calendarView.update();
        }
       
        if(!errors.isEmpty())
            saveErrors(request, errors);
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.webapp.module.calendar.util.CalendarView

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.