private static final String SCRIPT = "script";
private static final ResourceKey JQUERY = ResourceKey.create("jquery.js", "org.richfaces");
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
UIScripts validatorScript = (UIScripts) component;
ResponseWriter responseWriter = context.getResponseWriter();
// TODO - change behavior for AJAX requests.
Collection<Object> scripts = validatorScript.getScripts();
encodeDependentResources(context, component, scripts);
Collection<Object> pageReadyScripts = validatorScript.getPageReadyScripts();
if (!pageReadyScripts.isEmpty()) {
encodeResource(component, context, JQUERY);
encodeDependentResources(context, component, pageReadyScripts);
}
responseWriter.startElement(SCRIPT, null);