writer.write("]}");
}
protected void encodeScript(FacesContext context, Schedule schedule) throws IOException {
String clientId = schedule.getClientId(context);
WidgetBuilder wb = getWidgetBuilder(context);
wb.initWithDomReady("Schedule", schedule.resolveWidgetVar(), clientId, "schedule")
.attr("defaultView", schedule.getView())
.attr("locale", schedule.calculateLocale(context).toString())
.attr("offset", schedule.calculateTimeZone().getRawOffset())
.attr("tooltip", schedule.isTooltip(), false);
if(schedule.getInitialDate() != null) {
Calendar c = Calendar.getInstance();
c.setTime((Date) schedule.getInitialDate());
wb.attr("year", c.get(Calendar.YEAR)).attr("month", c.get(Calendar.MONTH)).attr("date", c.get(Calendar.DATE));
}
if(schedule.isShowHeader()) {
wb.append(",header:{left:'")
.append(schedule.getLeftHeaderTemplate()).append("'")
.attr("center", schedule.getCenterHeaderTemplate())
.attr("right", schedule.getRightHeaderTemplate())
.append("}");
}
else {
wb.attr("header", false);
}
wb.attr("allDaySlot", schedule.isAllDaySlot(), true)
.attr("slotMinutes", schedule.getSlotMinutes(), 30)
.attr("firstHour", schedule.getFirstHour(), 6)
.attr("minTime", schedule.getMinTime(), null)
.attr("maxTime", schedule.getMaxTime(), null)
.attr("aspectRatio", schedule.getAspectRatio(), Double.MIN_VALUE)
.attr("weekends", schedule.isShowWeekends(), true)
.attr("disableDragging", !schedule.isDraggable(), false)
.attr("disableResizing", !schedule.isResizable(), false)
.attr("axisFormat", schedule.getAxisFormat(), null)
.attr("timeFormat", schedule.getTimeFormat(), null)
.attr("ignoreTimezone", schedule.isIgnoreTimezone(), true);
String columnFormat = schedule.getColumnFormat();
if(columnFormat != null) {
wb.nativeAttr("columnFormat", "{" + columnFormat + "}");
}
encodeClientBehaviors(context, schedule);
wb.finish();
}