public class ScheduleRenderer extends CoreRenderer implements PartialRenderer {
public void decode(FacesContext facesContext, UIComponent component) {
Schedule schedule = (Schedule) component;
ScheduleModel model = (ScheduleModel) schedule.getValue();
String clientId = schedule.getClientId(facesContext);
Map<String, String> params = facesContext.getExternalContext().getRequestParameterMap();
if(params.containsKey(schedule.getClientId(facesContext))) {
String selectedEventParam = clientId + "_selectedEventId";
String selectedDateParam = clientId + "_selectedDate";
String changedEventParam = clientId + "_changedEventId";
//Event select
if(params.containsKey(selectedEventParam)) {
String eventId = params.get(selectedEventParam);
ScheduleEvent selectedEvent = model.getEvent(eventId);
schedule.queueEvent(new ScheduleEntrySelectEvent(schedule, selectedEvent));
}
//Date Select
else if(params.containsKey(selectedDateParam)) {
String dateAsString = params.get(selectedDateParam);
schedule.queueEvent(new DateSelectEvent(component, new Date(Long.valueOf(dateAsString))));
}
//Event dragdrop or resize
else if(params.containsKey(changedEventParam)) {
String eventId = params.get(changedEventParam);
ScheduleEvent changedEvent = model.getEvent(eventId);
int dayDelta = Integer.valueOf(params.get(clientId + "_dayDelta"));
int minuteDelta = Integer.valueOf(params.get(clientId + "_minuteDelta"));
Calendar calendar = Calendar.getInstance();
boolean isResize = params.containsKey(clientId + "_resized");