Examples of CalendarTagHelper


Examples of com.agiletec.plugins.jpcalendar.aps.tags.helper.CalendarTagHelper

*/
public class CalendarTag extends TagSupport {

  public int doStartTag() throws JspException {
   
    CalendarTagHelper calendarTagHelper =
      (CalendarTagHelper) ApsWebApplicationUtils.getBean("jpcalendarCalendarTagHelper", pageContext);
   
    ServletRequest request = this.pageContext.getRequest();
    UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(
        SystemConstants.SESSIONPARAM_CURRENT_USER);
    try {
     
      Calendar cal = (Calendar)
        this.pageContext.getSession().getAttribute(CalendarConstants.LAST_REQUIRED_CALENDAR_SESSION_PARAM);
     
     
      String monthString = request.getParameter("month");
      String yearString = request.getParameter("year");
      String selectedDate = request.getParameter("selectedDate");
     
      Calendar requiredCalendar = calendarTagHelper.getRequiredCalendar(monthString, yearString, selectedDate , this.getDatePattern(), cal);
      this.pageContext.getSession().setAttribute(
          CalendarConstants.LAST_REQUIRED_CALENDAR_SESSION_PARAM, requiredCalendar);

      ICalendarManager calMan = (ICalendarManager) ApsWebApplicationUtils.getBean(CalendarConstants.CALENDAR_MANAGER, pageContext);

      int[] array = calMan.getEventsForMonth(requiredCalendar,
          currentUser);
//      for (int i = 0; i < array.length; i++) {
//        System.out.println(array[i]);
//      }
     
      ApsCalendar calendarioRichiesto = calendarTagHelper.getCalendarioDelMese(
          (Calendar) requiredCalendar.clone(), array, this.getDatePattern());
      this.pageContext.setAttribute(this.getNomeGruppo(),
          calendarioRichiesto);

      this.pageContext.setAttribute("selectedYear", String
          .valueOf(requiredCalendar.get(Calendar.YEAR)));
      this.pageContext.setAttribute("selectedMonth", String
          .valueOf(requiredCalendar.get(Calendar.MONTH)));

      Calendar prevCal = calendarTagHelper.getPrevMonth(requiredCalendar);
      this.pageContext.setAttribute("prevMonth", String.valueOf(prevCal
          .get(Calendar.MONTH)));
      this.pageContext.setAttribute("prevYear", String.valueOf(prevCal
          .get(Calendar.YEAR)));

      Calendar nextCal = calendarTagHelper.getNextMonth(requiredCalendar);
      this.pageContext.setAttribute("nextMonth", String.valueOf(nextCal
          .get(Calendar.MONTH)));
      this.pageContext.setAttribute("nextYear", String.valueOf(nextCal
          .get(Calendar.YEAR)));

      int firstYear = Math.min(prevCal.get(Calendar.YEAR), calMan
          .getFirstYear());

      Calendar today = Calendar.getInstance();
      int lastYear = Math.max(nextCal.get(Calendar.YEAR), today
          .get(Calendar.YEAR));

      this.pageContext.setAttribute("yearsForSelect", calendarTagHelper.getYears(
          firstYear, lastYear));

    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
      throw new JspException("Errore inizializzazione tag", t);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.