UIComponent component) throws IOException
{
if (!supportsNavigation(arc))
return;
FormData fData = arc.getFormData();
if (fData == null)
{
_LOG.warning("showDetail is not in a form, and " +
"will not function correctly");
return;
}
String valueValue = getValueParameter(component);
ResponseWriter rw = context.getResponseWriter();
boolean partial = PartialPageUtils.isPPRActive(context);
// the first time, render the necessary Javascript
if (arc.getProperties().get(_SHOW_DETAIL_SUBMIT_JS_RENDERED) == null)
{
arc.getProperties().put(_SHOW_DETAIL_SUBMIT_JS_RENDERED,
Boolean.TRUE);
// write the submit function
String js;
// Javascript function, optimized to reduce size. Parameters are:
// a: form name
// v: validate?
// b: event name
// c: source parameter (id)
// l: ID of link (for focusing)
// d: value parameter (for use in table)
// =-=AEW Why bother including "document" and "window" in
// _setRequestedFocusNode() call? It could derive them itself.
if (partial)
{
js =
"function _submitHideShow(a,v,b,c,l,d) {" +
"var o = {"+
XhtmlConstants.EVENT_PARAM + ":b," +
XhtmlConstants.SOURCE_PARAM + ":c};" +
"if (d!=(void 0)) o." +
XhtmlConstants.VALUE_PARAM + "=d;" +
"_setRequestedFocusNode(document,l,false,window);" +
"_submitPartialChange(a,v,o);" +
"return false;}";
}
else
{
js =
"function _submitHideShow(a,v,b,c,l,d) {" +
"var o={"+
XhtmlConstants.EVENT_PARAM + ":b," +
XhtmlConstants.SOURCE_PARAM + ":c};" +
"if (d!=(void 0)) o." +
XhtmlConstants.VALUE_PARAM + "=d;" +
"submitForm(a,v,o);" +
"return false;}";
}
// write the submit function
rw.startElement("script", null);
renderScriptDeferAttribute(context, arc);
renderScriptTypeAttribute(context, arc);
rw.writeText(js, null);
rw.endElement("script");
// Add these needed values at most once per page
fData.addNeededValue(XhtmlConstants.EVENT_PARAM);
fData.addNeededValue(XhtmlConstants.SOURCE_PARAM);
if (partial)
fData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
}
// And add this needed value if it ever comes up
if (valueValue != null)
fData.addNeededValue(XhtmlConstants.VALUE_PARAM);
}