// TODO: Create the span with a bogus component where
// getClientId() returns the scriptId; this avoids
// the need to downcast - you just need to
// call addPartialTarget(). Or, come up with a better
// PPR api to make it simpler
PartialPageContextImpl ppImpl = (PartialPageContextImpl) ppContext;
if (ppImpl != null)
{
ppImpl.addRenderedPartialTarget(scriptId);
ppImpl.pushRenderedPartialTarget(scriptId);
}
ResponseWriter out = context.getResponseWriter();
out.startElement("script", null);
out.writeAttribute("id", scriptId, null);
XhtmlRenderer.renderScriptDeferAttribute(context, arc);
// And render each dialog launch that we need
if (hasDialog)
{
for (DialogRequest dialog : dialogList)
{
dialog.renderLaunchJavascript(context, arc);
}
}
if (hasScript)
{
for (String script : scriptList)
{
out.write(script);
}
}
out.endElement("script");
if (hasDialog)
dialogList.clear();
if (hasScript)
scriptList.clear();
if (ppImpl != null)
ppImpl.popRenderedPartialTarget();
}
}