hidden.setId(idPrefix + "Dimension");
attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
+ link.getClientId(facesContext) + "', '"
+ hidden.getClientId(facesContext) + "')");
UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
if (!popup.getActionIds().contains(link.getClientId(facesContext))) {
popup.getActionIds().add(link.getClientId(facesContext));
}
attributes = popup.getAttributes();
popup.setId(idPrefix + "popup");
attributes.put(ATTR_WIDTH, String.valueOf(
ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
Converter converter = getConverter(facesContext, dateInput);
String converterPattern = "yyyy-MM-dd"; // from calendar.js initCalendarParse
if (converter instanceof DateTimeConverter) {
converterPattern = DateFormatUtils.findPattern((DateTimeConverter) converter);
} else {
// LOG.warn("Converter for DateRenderer is not instance of DateTimeConverter. Using default Pattern "
// + converterPattern);
}
UICommand okButton = (UICommand) popup.findComponent("ok" + DatePickerController.CLOSE_POPUP);
attributes = okButton.getAttributes();
attributes.put(ATTR_ACTION_ONCLICK, "writeIntoField2(this); Tobago.closePickerPopup2(this)");
okButton.setActionListener(datePickerController);
UICommand cancelButton = (UICommand) popup.findComponent(DatePickerController.CLOSE_POPUP);
attributes = cancelButton.getAttributes();
attributes.put(ATTR_ACTION_ONCLICK, "Tobago.closePickerPopup2(this)");
cancelButton.setActionListener(datePickerController);
applyConverterPattern(popup, converterPattern);