public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
if (AjaxUtil.getSkipExtraRenderingOnPortletsAjax(context))
return;
DateChooser dateChooser = (DateChooser) component;
DateChooserPopup popup
= (DateChooserPopup) context.getApplication().createComponent(DateChooserPopup.COMPONENT_TYPE);
List<UIComponent> children = dateChooser.getChildren();
popup.setParent(dateChooser); // todo: it's not correct according to setParent's JavaDoc to use this method from applications, the proper way is to use parent.getChildren().add
popup.setId(component.getId() + POPUP_SUFFIX);
Calendar c = (Calendar) context.getApplication().createComponent(Calendar.COMPONENT_TYPE);
c.getAttributes().put(CalendarRenderer.HIDE_DEFAULT_FOCUS_KEY, Boolean.TRUE);
if (dateChooser.isValid()) {
c.setValue(dateChooser.getValue());
}
c.setTimeZone(dateChooser.getTimeZone());
c.setStyle(dateChooser.getCalendarStyle());
c.setDayStyle(dateChooser.getDayStyle());
c.setRolloverDayStyle(dateChooser.getRolloverDayStyle());
c.setInactiveMonthDayStyle(dateChooser.getInactiveMonthDayStyle());
c.setRolloverInactiveMonthDayStyle(dateChooser.getRolloverInactiveMonthDayStyle());
c.setSelectedDayStyle(dateChooser.getSelectedDayStyle());
c.setRolloverSelectedDayStyle(dateChooser.getRolloverSelectedDayStyle());
c.setTodayStyle(dateChooser.getTodayStyle());
c.setRolloverTodayStyle(dateChooser.getRolloverTodayStyle());
c.setDisabledDayStyle(dateChooser.getDisabledDayStyle());
c.setRolloverDisabledDayStyle(dateChooser.getRolloverDisabledDayStyle());
c.setWeekendDayStyle(dateChooser.getWeekendDayStyle());
c.setRolloverWeekendDayStyle(dateChooser.getRolloverWeekendDayStyle());
c.setDaysHeaderStyle(dateChooser.getDaysHeaderStyle());
c.setHeaderStyle(dateChooser.getHeaderStyle());
c.setFooterStyle(dateChooser.getFooterStyle());
c.setStyleClass(dateChooser.getCalendarClass());
c.setDayClass(dateChooser.getDayClass());
c.setRolloverDayClass(dateChooser.getRolloverDayClass());
c.setInactiveMonthDayClass(dateChooser.getInactiveMonthDayClass());
c.setRolloverInactiveMonthDayClass(dateChooser.getRolloverInactiveMonthDayClass());
c.setSelectedDayClass(dateChooser.getSelectedDayClass());
c.setRolloverSelectedDayClass(dateChooser.getRolloverSelectedDayClass());
c.setTodayClass(dateChooser.getTodayClass());
c.setRolloverTodayClass(dateChooser.getRolloverTodayClass());
c.setDisabledDayClass(dateChooser.getDisabledDayClass());
c.setRolloverDisabledDayClass(dateChooser.getRolloverDisabledDayClass());
c.setWeekendDayClass(dateChooser.getWeekendDayClass());
c.setRolloverWeekendDayClass(dateChooser.getRolloverWeekendDayClass());
c.setDaysHeaderClass(dateChooser.getDaysHeaderClass());
c.setHeaderClass(dateChooser.getHeaderClass());
c.setFooterClass(dateChooser.getFooterClass());
c.setFirstDayOfWeek(dateChooser.getFirstDayOfWeek());
c.setShowFooter(dateChooser.isShowFooter());
c.setFocusedStyle(dateChooser.getCalendarStyle());
c.setFocusedClass(dateChooser.getCalendarClass());
c.setFocusable(true);
Locale locale = dateChooser.getLocale();
if (locale == null) {
Object requestObj = context.getExternalContext().getRequest();
RequestFacade requestFacade = RequestFacade.getInstance(requestObj);
locale = requestFacade.getLocale();
}
c.setLocale(locale);
c.setTodayText(dateChooser.getTodayText());
c.setNoneText(dateChooser.getNoneText());
for (UIComponent child : children) {
if (child instanceof DateRanges) {
c.getChildren().add(child);
}
}
popup.setCalendar(c);
popup.encodeAll(context);
Rendering.encodeClientActions(context, component);
}