<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="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:a4j="http://richfaces.org/a4j"xmlns:rich="http://richfaces.org/rich"xmlns:c="http://java.sun.com/jsp/jstl/core"xmlns:schedule="http://richfaces.org/sandbox/schedule"><ui:compositiontemplate="/pages/template.xhtml"><ui:definename="body"><style type="text/css">.rich-schedule{width:600px;margin-left:20px;}.customFC{border:1pxsolidred;}.fc-headerspan{font-size:12px;}</style><script type="text/javascript">functionnotify(action,text,timeToStay){RichFaces.Notify({title:action,text:text,sticky:false,styleClass:'rf-ny-info',stayTime:timeToStay});}functionblockEvent(item,event,action){RichFaces.Notify({title:action,text:item.title,sticky:false,styleClass:'rf-ny-error'});}functionviewChanged(view){notify('View changed',view.name);}functiondaySelected(date,allDay,event,view){notify('Day select',toString(date)+' '+(allDay?'with all day slot':''));}functiondaySelectedComplete(date,allDay,event,view,data){notify('Day select complete',toString(date)+' '+(allDay?'with all day slot':'')+";data="+toString(data));}functionitemSelected(item,event,view){notify("Item selected","item:"+item.title+";event="+event.type+";view:"+view.name);}functionitemSelectedComplete(item,event,view,data){notify("Item selected complete","item:"+item.title+";event="+event.type+";view:"+view.name+";data="+toString(data));}functionitemResized(item,dayDelta,minuteDelta,event,ui,view){notify("Item resized","item:"+item.title+";dayDelta="+dayDelta+";minuteDelta="+minuteDelta+";event="+event.type+";ui="+ui+";view:"+view.name);}functionitemResizedComplete(item,dayDelta,minuteDelta,vetoed,event,ui,view,data){notify("Item resized complete","item:"+item.title+";dayDelta="+dayDelta+";minuteDelta="+minuteDelta+";vetoed="+vetoed+";event="+event.type+";ui="+ui+";view:"+view.name+";data="+toString(data));}functionitemDrop(item,dayDelta,minuteDelta,allDay,event,ui,view){notify("Item drop","item:"+item.title+";dayDelta="+dayDelta+";minuteDelta="+minuteDelta+";allDay="+allDay+";event="+event.type+";ui="+ui+";view:"+view.name);}functionitemDropComplete(item,dayDelta,minuteDelta,allDay,vetoed,event,ui,view,data){notify("Item drop complete","item:"+item.title+";dayDelta="+dayDelta+";minuteDelta="+minuteDelta+";allDay="+allDay+";vetoed="+vetoed+";event="+event.type+";ui="+ui+";view:"+view.name+";data="+toString(data));}functiondragStart(item,event,ui,view){notify("Item drag start","item:"+item.title+";event="+event.type+";ui="+ui+";view:"+view.name);}functiondragStop(item,event,ui,view){notify("Item drag stop","item:"+item.title+";event="+event.type+";ui="+ui+";view:"+view.name);}functionitemResizeStart(item,event,ui,view){notify("Item resize start","item:"+item.title+";event="+event.type+";ui="+ui+";view:"+view.name);}functionitemResizeStop(item,event,ui,view){notify("Item resize stop","item:"+item.title+";event="+event.type+";ui="+ui+";view:"+view.name);}functionitemMouseover(item){notify('Mouseover',item.title,1000);}functionitemMouseout(item){notify('Mouseout',item.title,1000);}functiondateRangeSelected(startDate,endDate,allDay,view){notify('Date range selected',toString(startDate)+" - "+toString(endDate)+"; "+(allDay?"all day":"not all day")+";view:"+view.name);}functiondateRangeSelectedComplete(startDate,endDate,allDay,view,data){notify('Date range selected complete',toString(startDate)+" - "+toString(endDate)+"; "+(allDay?"all day":"not all day")+";view:"+view.name+";data="+toString(data));}functiondateRangeChanged(startDate,endDate){notify('Date range changed',toString(startDate)+" - "+toString(endDate));}functiontoString(object){if(objectinstanceofDate){returnobject.getFullYear()+"/"+object.getMonth()+"/"+object.getDate()+" "+object.getHours()+":"+object.getMinutes();}if(typeofobject=="string"){returnobject;}varstr="[";for(iinobject){str+=i+"="+object[i]+";"}returnstr+"]";}</script><p> First schedule's JavaScript callbacks do not veto any event and just notify user (veto may be raised by server side listener).</p><p> Second schedule's JavaScript callbacks <b>veto</b> all events.</p><h:form><schedule:scheduleswitchType="ajax"value="#{myBean.lazyDataModel}"var="event"date="#{myBean.initialDate}"editable="true"selectable="true"headerCenter="title"headerLeft="prevYear,nextYear"headerRight="basicDay,basicWeek agendaDay,agendaWeek month today prev,next"itemResizeListener="#{myBean.taskResized}"itemMoveListener="#{myBean.taskMoved}"data="#{myBean.allDayText}"eventsQueue="schedule1"onbeforeitemselect="itemSelected(item,event,view)"onitemselect="itemSelectedComplete(item,event,view,data)"onbeforeitemresize="itemResized(item,dayDelta,minuteDelta,event,ui,view)"onitemresize="itemResizedComplete(item,dayDelta,minuteDelta,vetoed,event,ui,view,data)"onbeforeitemdrop="itemDrop(item,dayDelta,minuteDelta,allDay,event,ui,view)"onitemdrop="itemDropComplete(item,dayDelta,minuteDelta,allDay,vetoed,event,ui,view,data)"onitemdragstart="dragStart(item,event,ui,view)"onitemdragstop="dragStop(item,event,ui,view)"onitemresizestart="itemResizeStart(item,event,ui,view)"onitemresizestop="itemResizeStop(item,event,ui,view)"onviewchange="viewChanged(view)"onbeforedateselect="daySelected(date,allDay,event,view)"ondateselect="daySelectedComplete(date,allDay,event,view,data)"ondaterangeselect="dateRangeSelected(startDate,endDate,allDay,view)"ondaterangechange="dateRangeChanged(startDate,endDate)"onitemmouseover="itemMouseover(item)"onitemmouseout="itemMouseout(item)"styleClass="customFC"><schedule:scheduleItemeventId="#{event.id}"startDate="#{event.startDate}"title="#{event.title}"endDate="#{event.endDate}"allDay="#{event.allDay}"styleClass="#{event.id == 1 ? 'first' : null}"data="#{event.data}"/></schedule:schedule><schedule:scheduleswitchType="ajax"value="#{myBean.lazyDataModel}"var="event"date="#{myBean.initialDate}"editable="true"selectable="true"headerCenter="title"headerLeft="prevYear,nextYear"headerRight="basicDay,basicWeek agendaDay,agendaWeek month today prev,next"eventsQueue="schedule2"onbeforeitemselect="blockEvent(item,event,'select'); return false;"onitemselect="itemSelectedComplete(item,event,view,data)"onbeforeitemresize="blockEvent(item,event,'resized'); return false;"onitemresize="itemResizedComplete(item,dayDelta,minuteDelta,vetoed,event,ui,view,data)"onbeforeitemdrop="blockEvent(item,event,'drop'); return false;"onitemdrop="itemDropComplete(item,dayDelta,minuteDelta,allDay,vetoed,event,ui,view,data)"onitemdragstart="blockEvent(item,event,'dragStart'); return false;"onitemdragstop="blockEvent(item,event,'dragStop'); return false;"onitemresizestart="blockEvent(item,event,'resizeStart'); return false;"onitemresizestop="blockEvent(item,event,'resizeStop'); return false;"onviewchange="viewChanged(view); return false;"onbeforedateselect="daySelected(date,allDay);return false;"ondateselect="daySelectedComplete(date,allDay,event,view,data)"onbeforedaterangeselect="blockEvent(startDate,endDate,'dateRangeSelected'); return false;"ondaterangeselect="dateRangeSelected(startDate,endDate,allDay,view,data)"ondaterangechange="dateRangeChanged(startDate,endDate);return false;"><schedule:scheduleItemeventId="#{event.id}"startDate="#{event.startDate}"title="#{event.title}"endDate="#{event.endDate}"allDay="#{event.allDay}"styleClass="#{event.id == 1 ? 'first' : null}"data="#{event.data}"/></schedule:schedule></h:form><rich:insertsrc="/pages/sample_4.xhtml"highlight="xhtml"/></ui:define></ui:composition></html>