title: Primefaces Schedule is not displayed in Application
body: <p>I got a problem with the Primefaces <code>&lt;p:schedule&gt;</code>.</p>
  
  <p>It is not displayed in my Application which uses <code>&lt;ui:include&gt;</code> and <code>&lt;ui:composition&gt;</code> Tags.
  But if I place the Schedule in a Standalone Page without these Tag Combination, it works as expected.</p>
  
  <p>My <code>app.xhtml</code> Page includes a Layout which is defined by the <code>&lt;p:Layout&gt;</code> Component. I define a Menu at the left side with a <code>&lt;f:ajax&gt;</code> Tag, so that a contentPanel get updated on each click in the menu.</p>
  
  <p>One of these Pages which gets included, is the <code>hldyplanning.xhtml</code> - in this Page a <code>&lt;p:schedule&gt;</code> should be displayed. For testing I create a new site. The <code>test.xhtml</code>. I decide to implement the Primefaces ShowCase Example for testing it.</p>
  
  <p>I hope that I'm doing something wrong and it is not a Bug or something like that.</p>
  
  <p>Here's the <code>app.xhtml</code>:</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"&gt;
  
      &lt;f:view contentType="text/html"&gt;
          &lt;h:head&gt;
              &lt;f:facet name="first"&gt;
                  &lt;meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/&gt;
                  &lt;meta http-equiv="refresh" content="#{session.maxInactiveInterval};url=/LEAN" /&gt;
                  &lt;title&gt;Lean - Menü&lt;/title&gt; 
              &lt;/f:facet&gt;
          &lt;/h:head&gt;
  
          &lt;h:body style="background: white;"&gt;
  
              &lt;p:layout fullPage="true"&gt;
  
                  &lt;p:layoutUnit position="west" size="175" header="Menü" collapsible="true" style="background: wheat;"&gt;
                      &lt;h:form id="frm_menu"&gt;
                          &lt;f:ajax render=":contentPanel" execute="@this"&gt;
                              &lt;p:menu model="#{appController.menu}" style="font-size: 12px; width: 96%" /&gt;                                
                          &lt;/f:ajax&gt;
                      &lt;/h:form&gt;
                  &lt;/p:layoutUnit&gt;
  
                  &lt;p:layoutUnit position="center" style="background: wheat;"&gt;
                      &lt;h:panelGroup id="contentPanel"&gt;
                          &lt;ui:include src="#{appController.content}.xhtml" /&gt;
                      &lt;/h:panelGroup&gt;
                  &lt;/p:layoutUnit&gt;
  
              &lt;/p:layout&gt;
  
              &lt;p:growl autoUpdate="true" showDetail="true"/&gt;
  
          &lt;/h:body&gt;
  
      &lt;/f:view&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The <code>appController.java</code></p>
  
  <pre><code>package lean.controller.view;
  
  
  import java.util.Map;
  import javax.annotation.PostConstruct;
  import javax.el.ExpressionFactory;
  import javax.el.MethodExpression;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.RequestScoped;
  import javax.faces.context.FacesContext;
  import javax.servlet.http.HttpServletResponse;
  import org.primefaces.model.DefaultMenuModel;
  import org.primefaces.model.MenuModel;
  import org.primefaces.component.menuitem.MenuItem;  
  import org.primefaces.component.submenu.Submenu;  
  
  @ManagedBean
  @RequestScoped
  public class AppController {
  
      private String content = "/app/includes/dashboard";
  
      private MenuModel menu;
      private Submenu submenu;
      private MenuItem item;
  
      final private String[] submenu_urlb = { "Urlaubsübersicht", "/app/includes/urlaubsubersicht", 
                                              "Urlaubsplanung", "/app/includes/hldyplanning", 
                                              "Abteilungsübersicht", "/app/includes/abt_ubersicht", 
                                              "Persönliche Übersicht", "/app/includes/per_uberischt",
                                              "Urlaubsanträge", "/app/includes/urlaubsantrage"};
  
      FacesContext fc;
      ExpressionFactory exfactory;
      HttpServletResponse response;
      Map cookieMap;
      MethodExpression me;
  
      //&lt;editor-fold defaultstate="collapsed" desc="GETTER UND SETTER"&gt;
  
      public MenuModel getMenu(){
          return menu;
      }
  
      public MethodExpression getMe() {
          return me;
      }
  
      public void setMe(MethodExpression me) {
          this.me = me;
      }
  
      public ExpressionFactory getExfactory() {
          return exfactory;
      }
  
      public void setExfactory(ExpressionFactory exfactory) {
          this.exfactory = exfactory;
      }
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  
      public FacesContext getFc() {
          return fc;
      }
  
      public void setFc(FacesContext fc) {
          this.fc = fc;
      }
  
      public HttpServletResponse getResponse() {
          return response;
      }
  
      public void setResponse(HttpServletResponse response) {
          this.response = response;
      }
  
      public Map getCookieMap() {
          return cookieMap;
      }
  
      public void setCookieMap(Map cookieMap) {
          this.cookieMap = cookieMap;
      }
  
      //&lt;/editor-fold&gt;
  
  
  
      /**
       *
       */
      @PostConstruct
      public void init() {
  
          setFc(FacesContext.getCurrentInstance());
          setResponse((HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse());
          setCookieMap(FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap());
          setExfactory(FacesContext.getCurrentInstance().getApplication().getExpressionFactory());
  
  
          menu = new DefaultMenuModel();
  
          //erstes Submenu erzeugen
  
          submenu = new Submenu();
          submenu.setLabel("Urlaubsplanung");
  
          for(int i = 0; i &lt;= (submenu_urlb.length-1); i=i+2){
              item = new MenuItem();  
              item.setValue(submenu_urlb[i]);
              setMe(getExfactory().createMethodExpression( fc.getELContext(), "#{appController.doNav(\""+submenu_urlb[i+1]+"\")}", void.class, new Class[0]));
              item.setActionExpression(me);
              item.setUpdate(":contentPanel");
              submenu.getChildren().add(item);
          }
  
          menu.addSubmenu(submenu);
  
          //zweites Submenu erzeugen
          submenu = new Submenu();
          submenu.setLabel("Account");
  
          item = new MenuItem();  
          item.setValue("Dashboard");
          setMe(getExfactory().createMethodExpression( fc.getELContext(), "#{appController.doNav(\"/app/includes/dashboard\")}", void.class, new Class[0]));
          item.setActionExpression(me);
          item.setUpdate(":contentPanel");
          submenu.getChildren().add(item);
  
  
          item = new MenuItem();  
          item.setValue("Ausloggen");
          setMe(getExfactory().createMethodExpression( fc.getELContext(), "#{appController.menuitem_logout()}", void.class, new Class[0]));
          item.setActionExpression(me);
          item.setUpdate(":contentPanel");
          submenu.getChildren().add(item);
  
          menu.addSubmenu(submenu);
  
      }
  
      public String menuitem_logout(){
  
          FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
          return "backToStart";
  
      }
  
      public void doNav(String nav){
  
          setContent(nav);
  
      }
  }
  </code></pre>
  
  <p>The <code>hldyplanning.xhtml</code></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;ui:composition 
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"&gt;
  
      &lt;h:form id="frm_urlbubersicht"&gt;
  
          &lt;p:panelGrid style="width: 100%;"&gt;
              &lt;f:facet name="header"&gt;
                  &lt;p:row&gt;
                      &lt;p:column colspan="2" style="height:50px;"&gt;
                          Urlaubsplanung
                      &lt;/p:column&gt;
                  &lt;/p:row&gt;
              &lt;/f:facet&gt;
              &lt;p:row&gt;
                  &lt;p:column style="width: 420px;" colspan="1"&gt;
                      &lt;p:panel style="font-size: 12px; width: 420px; position: relative; border: 1px solid gray"&gt;
  
                          &lt;f:facet name="header"&gt;
                              Urlaubsantrag Formular
                          &lt;/f:facet&gt;
  
                      &lt;p:panelGrid id="pnl_userinfo" style="font-size: 12px; width: 400px; border: 1px solid gray"&gt;
  
                          &lt;f:facet name="header"&gt;  
                              &lt;p:row&gt;
                                  &lt;p:column colspan="2"&gt;Persönliche Informationen&lt;/p:column&gt;
                              &lt;/p:row&gt;
                          &lt;/f:facet&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;h:outputText value="Name:"/&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;h:outputText value="#{loginController.sessionData.user_name}" /&gt;
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;h:outputText value="Team:" /&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;h:outputText value="#{loginController.sessionData.teams_name}" /&gt;
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                      &lt;/p:panelGrid&gt;
                      &lt;br/&gt;
                      &lt;p:panelGrid id="pnl_time" style="font-size: 12px; width: 400px; border: 1px solid gray"&gt;
                          &lt;f:facet name="header"&gt;  
                              &lt;p:row&gt;
                                  &lt;p:column colspan="2"&gt;Zeitraum&lt;/p:column&gt;
                              &lt;/p:row&gt;
                          &lt;/f:facet&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;p:outputLabel for="cld_startdate" value="Startdatum:" /&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;p:calendar value="#{hldyPlanningController.startdate}" id="cld_startdate" showOn="button" pattern="dd.MM.yyyy" required="true" requiredMessage=""/&gt;
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;p:outputLabel for="cld_enddate" value="Enddatum:" /&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;p:calendar value="#{hldyPlanningController.enddate}" id="cld_enddate" showOn="button" pattern="dd.MM.yyyy" required="true" requiredMessage=""/&gt;
                              &lt;/p:column&gt;             
                          &lt;/p:row&gt;
                      &lt;/p:panelGrid&gt;
                      &lt;br/&gt;
                      &lt;p:panelGrid id="pnl_misc" style="font-size: 12px; width: 400px; border: 1px solid gray"&gt;
                          &lt;f:facet name="header"&gt;  
                              &lt;p:row&gt;
                                  &lt;p:column colspan="2"&gt;Weiteres&lt;/p:column&gt;
                              &lt;/p:row&gt;
                          &lt;/f:facet&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;p:outputLabel for="opt_hType" value="Typ:"/&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;p:selectOneButton value="#{hldyPlanningController.type}" id="opt_hType"&gt;  
                                      &lt;f:selectItem itemLabel="Urlaub" itemValue="U" /&gt;  
                                      &lt;f:selectItem itemLabel="Absetzen" itemValue="A" /&gt;  
                                  &lt;/p:selectOneButton&gt; 
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                          &lt;p:row&gt;
                              &lt;p:column style="width:120px"&gt;
                                  &lt;p:outputLabel for="txta_note" value="Bemerkung:"/&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;p:inputTextarea maxlength="45" rows="2" cols="30" value="#{hldyPlanningController.note}" id="txta_note"/&gt;  
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                      &lt;/p:panelGrid&gt;                    
                      &lt;br/&gt;
                      &lt;p:panelGrid id="pnl_actions" style="font-size: 12px; width: 400px; border: 1px solid gray"&gt;
                          &lt;f:facet name="header"&gt;  
                              &lt;p:row&gt;
                                  &lt;p:column colspan="2"&gt;Aktion&lt;/p:column&gt;
                              &lt;/p:row&gt;
                          &lt;/f:facet&gt;
                          &lt;p:row&gt;
                              &lt;p:column&gt;
                                  &lt;h:commandButton id="btn_plan" value="Planen" action="#{hldyPlanningController.sendAFL()}" style="width: 170px; height: 30px"/&gt;
                              &lt;/p:column&gt;
                              &lt;p:column&gt;
                                  &lt;h:commandButton id="btn_submit" value="Beantragen" action="#{hldyPlanningController.sendAFL()}" style="width: 170px; height: 30px" /&gt;
                              &lt;/p:column&gt;
                          &lt;/p:row&gt;
                      &lt;/p:panelGrid&gt;
                      &lt;/p:panel&gt;                    
                  &lt;/p:column&gt;
                  &lt;p:column colspan="1" style="vertical-align: top;"&gt;
                      &lt;p:panel style="font-size: 12px; border: 1px solid gray;"&gt;
                          &lt;f:facet name="header"&gt;
                              Mitarbeiter, die in diesem Zeitraum auch Urlaub geplant haben
                          &lt;/f:facet&gt;
  
                      &lt;/p:panel&gt;
  
                  &lt;/p:column&gt;
              &lt;/p:row&gt;     
          &lt;/p:panelGrid&gt;
  
          &lt;p:schedule value="#{calendarController.eventModel}" widgetVar="myschedule"&gt;  
  
          &lt;/p:schedule&gt;  
  
          &lt;p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip"&gt;  
              &lt;h:panelGrid id="eventDetails" columns="2"&gt;  
                  &lt;h:outputLabel for="title" value="Title:" /&gt;  
                  &lt;p:inputText id="title" value="#{calendarController.event.title}" required="true"/&gt;  
                  &lt;h:outputLabel for="from" value="From:" /&gt;  
                  &lt;p:inputMask id="from" value="#{calendarController.event.startDate}" mask="99/99/9999"&gt;  
                      &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
                  &lt;/p:inputMask&gt;  
                  &lt;h:outputLabel for="to" value="To:" /&gt;  
                  &lt;p:inputMask id="to" value="#{calendarController.event.endDate}" mask="99/99/9999"&gt;  
                      &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
                  &lt;/p:inputMask&gt;  
                  &lt;h:outputLabel for="allDay" value="All Day:" /&gt;  
                  &lt;h:selectBooleanCheckbox id="allDay" value="#{calendarController.event.allDay}" /&gt;  
                  &lt;p:commandButton type="reset" value="Reset" /&gt;  
                  &lt;p:commandButton value="Save" actionListener="#{calendarController.addEvent}" oncomplete="myschedule.update();eventDialog.hide();"/&gt;  
              &lt;/h:panelGrid&gt;  
          &lt;/p:dialog&gt;
  
      &lt;/h:form&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>The <code>test.xhtml</code></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui"&gt;
  
      &lt;f:view contentType="text/html"&gt;
          &lt;h:head&gt;
              &lt;f:facet name="first"&gt;
                  &lt;meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/&gt;
                  &lt;title&gt;TEST&lt;/title&gt; 
              &lt;/f:facet&gt;
          &lt;/h:head&gt;
          &lt;h:body&gt;
              &lt;h:form&gt;  
  
                  &lt;p:growl id="messages" showDetail="true" /&gt;  
  
                  &lt;p:schedule value="#{calendarController.eventModel}" widgetVar="myschedule"&gt;  
  
                      &lt;p:ajax event="dateSelect" listener="#{calendarController.onDateSelect}" update="eventDetails" oncomplete="eventDialog.show()" /&gt;  
                      &lt;p:ajax event="eventSelect" listener="#{calendarController.onEventSelect}" update="eventDetails" oncomplete="eventDialog.show()" /&gt;  
                      &lt;p:ajax event="eventMove" listener="#{calendarController.onEventMove}" update="messages" /&gt;  
                      &lt;p:ajax event="eventResize" listener="#{calendarController.onEventResize}" update="messages" /&gt;  
  
                  &lt;/p:schedule&gt;  
  
                  &lt;p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip"&gt;  
                      &lt;h:panelGrid id="eventDetails" columns="2"&gt;  
                          &lt;h:outputLabel for="title" value="Title:" /&gt;  
                          &lt;p:inputText id="title" value="#{calendarController.event.title}" required="true"/&gt;  
                          &lt;h:outputLabel for="from" value="From:" /&gt;  
                          &lt;p:inputMask id="from" value="#{calendarController.event.startDate}" mask="99/99/9999"&gt;  
                              &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
                          &lt;/p:inputMask&gt;  
                          &lt;h:outputLabel for="to" value="To:" /&gt;  
                          &lt;p:inputMask id="to" value="#{calendarController.event.endDate}" mask="99/99/9999"&gt;  
                              &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
                          &lt;/p:inputMask&gt;  
                          &lt;h:outputLabel for="allDay" value="All Day:" /&gt;  
                          &lt;h:selectBooleanCheckbox id="allDay" value="#{calendarController.event.allDay}" /&gt;  
                          &lt;p:commandButton type="reset" value="Reset" /&gt;  
                          &lt;p:commandButton value="Save" actionListener="#{calendarController.addEvent}" oncomplete="myschedule.update();eventDialog.hide();"/&gt;  
                      &lt;/h:panelGrid&gt;  
                  &lt;/p:dialog&gt;  
              &lt;/h:form&gt; 
          &lt;/h:body&gt;
      &lt;/f:view&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the <code>calendarController.java</code></p>
  
  <pre><code>package lean.controller.view;
  
  import java.io.Serializable;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.List;
  import javax.annotation.PostConstruct;
  
  import javax.faces.application.FacesMessage;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.context.FacesContext;
  import javax.faces.event.ActionEvent;
  import lean.dataobjects.HolidayDataObj;
  
  import org.primefaces.event.DateSelectEvent;
  import org.primefaces.event.ScheduleEntryMoveEvent;
  import org.primefaces.event.ScheduleEntryResizeEvent;
  import org.primefaces.event.ScheduleEntrySelectEvent;
  import org.primefaces.model.DefaultScheduleEvent;
  import org.primefaces.model.DefaultScheduleModel;
  import org.primefaces.model.LazyScheduleModel;
  import org.primefaces.model.ScheduleEvent;
  import org.primefaces.model.ScheduleModel;
  
  @ManagedBean(name = "calendarController")
  @SessionScoped
  public class CalendarController implements Serializable {
  
          private ScheduleModel eventModel;
          private List&lt;HolidayDataObj&gt; holidayData;
  
          private ScheduleModel lazyEventModel;
  
          private ScheduleEvent event = new DefaultScheduleEvent();
  
          @PostConstruct
          public void init() {
                  eventModel = new DefaultScheduleModel();
                  eventModel.addEvent(new DefaultScheduleEvent("Champions League Match", previousDay8Pm(), previousDay11Pm()));
                  eventModel.addEvent(new DefaultScheduleEvent("Birthday Party", today1Pm(), today6Pm()));
                  eventModel.addEvent(new DefaultScheduleEvent("Breakfast at Tiffanys", nextDay9Am(), nextDay11Am()));
                  eventModel.addEvent(new DefaultScheduleEvent("Plant the new garden stuff", theDayAfter3Pm(), fourDaysLater3pm()));
  
                  try {
                      holidayData = lean.sql.QueryMySQL.getHolidaysForAll();
  
                  for(int i=0; i&lt;=holidayData.size()-1; i++ ) {
                      eventModel.addEvent( new DefaultScheduleEvent(holidayData.get(i).getUser_name(),holidayData.get(i).getHldy_startdate(),holidayData.get(i).getHldy_enddate()));
                  }                    
  
  
                  }catch(Exception e){
                      FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "HolidayCollector ", e.getMessage()));
                  }
  
                  lazyEventModel = new LazyScheduleModel() {
  
                          @Override
                          public void loadEvents(Date start, Date end) {
                                  clear();
  
                                  Date random = getRandomDate(start);
                                  addEvent(new DefaultScheduleEvent("Lazy Event 1", random, random));
  
                                  random = getRandomDate(start);
                                  addEvent(new DefaultScheduleEvent("Lazy Event 2", random, random));
                          }       
                  };
          }
  
          public Date getRandomDate(Date base) {
                  Calendar date = Calendar.getInstance();
                  date.setTime(base);
                  date.add(Calendar.DATE, ((int) (Math.random()*30)) + 1);        //set random day of month
  
                  return date.getTime();
          }
  
          public Date getInitialDate() {
                  Calendar calendar = Calendar.getInstance();
                  calendar.set(calendar.get(Calendar.YEAR), Calendar.FEBRUARY, calendar.get(Calendar.DATE), 0, 0, 0);
  
                  return calendar.getTime();
          }
  
          public ScheduleModel getEventModel() {
                  return eventModel;
          }
  
          public ScheduleModel getLazyEventModel() {
                  return lazyEventModel;
          }
  
          private Calendar today() {
                  Calendar calendar = Calendar.getInstance();
                  calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), 0, 0, 0);
  
                  return calendar;
          }
  
          private Date previousDay8Pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.DATE, t.get(Calendar.DATE) - 1);
                  t.set(Calendar.HOUR, 8);
  
                  return t.getTime();
          }
  
          private Date previousDay11Pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.DATE, t.get(Calendar.DATE) - 1);
                  t.set(Calendar.HOUR, 11);
  
                  return t.getTime();
          }
  
          private Date today1Pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.HOUR, 1);
  
                  return t.getTime();
          }
  
          private Date theDayAfter3Pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.DATE, t.get(Calendar.DATE) + 2);         
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.HOUR, 3);
  
                  return t.getTime();
          }
  
          private Date today6Pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.HOUR, 6);
  
                  return t.getTime();
          }
  
          private Date nextDay9Am() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.AM);
                  t.set(Calendar.DATE, t.get(Calendar.DATE) + 1);
                  t.set(Calendar.HOUR, 9);
  
                  return t.getTime();
          }
  
          private Date nextDay11Am() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.AM);
                  t.set(Calendar.DATE, t.get(Calendar.DATE) + 1);
                  t.set(Calendar.HOUR, 11);
  
                  return t.getTime();
          }
  
          private Date fourDaysLater3pm() {
                  Calendar t = (Calendar) today().clone();
                  t.set(Calendar.AM_PM, Calendar.PM);
                  t.set(Calendar.DATE, t.get(Calendar.DATE) + 4);
                  t.set(Calendar.HOUR, 3);
  
                  return t.getTime();
          }
  
          public ScheduleEvent getEvent() {
              System.out.println("Getting event: " + event.getId() + " " + event.getTitle());
                  return event;
          }
  
          public void setEvent(ScheduleEvent event) {
              System.out.println("Setting event");
                  this.event = event;
          }
  
          public void addEvent(ActionEvent actionEvent) {
              System.out.println("Adding event");
                  if(event.getId() == null){
                          eventModel.addEvent(event);}
                  else{
                          eventModel.updateEvent(event);
                  }
                  event = new DefaultScheduleEvent();
                  System.out.println("");
          }
  
          public void onEventSelect(ScheduleEntrySelectEvent selectEvent) {
              System.out.println("Selected event");
                  event = selectEvent.getScheduleEvent();
          }
  
          public void onDateSelect(DateSelectEvent selectEvent) {
              System.out.println("Selected date");
                  event = new DefaultScheduleEvent("", selectEvent.getDate(), selectEvent.getDate());
          }
  
          public void onEventMove(ScheduleEntryMoveEvent event) {
              System.out.println("Moved event");
                  FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event moved", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
  
                  addMessage(message);
          }
  
          public void onEventResize(ScheduleEntryResizeEvent event) {
              System.out.println("Resized event");
                  FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event resized", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
  
                  addMessage(message);
          }
  
          private void addMessage(FacesMessage message) {
                  FacesContext.getCurrentInstance().addMessage(null, message);
          }
  }
  </code></pre>