//
// Create the calendar row
//
UIComponent calendarRow = _createRow(isDesktop,
XhtmlConstants.H_ALIGN_END);
CoreChooseDate ccd = CalendarUtils.createChooseDate(context);
calendarRow.getChildren().add(ccd);
// Get a destination that points back to this dialog, including
// any viewIDs
String destination =
GenericEntry.getGenericEntryURL(context,
GenericEntry.CALENDAR_DIALOG_ENTRY);
ccd.getAttributes().put("destination", destination);
//
// Create a spacer
//
UIComponent spacerRow = _createRow(isDesktop, null);
CoreSpacer cos = new CoreSpacer();
spacerRow.getChildren().add(cos);
cos.setHeight("8");
//
// Create the button row
//
UIComponent buttonRow = _createRow(isDesktop, XhtmlConstants.H_ALIGN_END);
CoreGoButton cancelButton =
JspUtils.createGoButton(arc, _CANCEL_LABEL_KEY);
buttonRow.getChildren().add(cancelButton);
Object cap = arc.getAgent().getCapabilities().get(
TrinidadAgent.CAP_MULTIPLE_WINDOWS);
boolean multWindowsSupported = Boolean.TRUE.equals( cap );
if (multWindowsSupported )
{
cancelButton.setOnclick("return _doCancel()");
}
else
{
// create the destination of the cancel button
StringBuffer cancelDest = new StringBuffer();
EncoderUtils.appendURLArguments(cancelDest,
destination,
new String[]{
XhtmlConstants.EVENT_PARAM,
XhtmlConstants.CANCEL_EVENT
});
// Prepend a slash, because this destination already
// includes the context root
cancelButton.setDestination("/" + cancelDest.toString());
String value = __getParam(context, XhtmlConstants.VALUE_PARAM);
if (value != null)
{
long lg = Long.parseLong(value);
ccd.getAttributes().put("value", new Date(lg));
}
// get the scrolled value
String month = __getParam(context,XhtmlConstants.MONTH_PARAM);
String year = __getParam(context,XhtmlConstants.YEAR_PARAM);
// try to create scrolledValue
if ( month != null && year != null )
{
try
{
long scrolledValue = Long.parseLong(month) + Long.parseLong(year);
ccd.getAttributes().put("scrolledValue", new Date(scrolledValue));
}
catch ( NumberFormatException nfe){;}
}
}