@Override
public void renderHead(IHeaderResponse response)
{
super.renderHead(response);
response.renderJavascriptReference(new JavascriptResourceReference(Animator.class,
"animator.js"));
Map<String, String> variables = new HashMap<String, String>();
variables.put("animatorId", animatorId);
StringBuffer optBuffer = new StringBuffer();
optBuffer.append("{ ");
for (String key : options.keySet())
{
optBuffer.append(key);
optBuffer.append(": ");
optBuffer.append(options.get(key));
optBuffer.append(", ");
}
optBuffer.append(" }");
variables.put("options", optBuffer.toString());
StringBuffer init = new StringBuffer();
for (int i = 0; i < subjects.size(); i++)
{
init.append(".addSubject(");
init.append(((IAnimatorSubject)subjects.get(i)).getJavaScript());
init.append(")");
}
variables.put("addSubjects", init.toString());
TextTemplateHeaderContributor.forJavaScript(Animator.class, "wicket-animator.js",
Model.valueOf(variables)).renderHead(response);
response.renderOnLoadJavascript("init" + animatorId + "();");
response.renderJavascriptReference(new JavascriptResourceReference(
AbstractDefaultAjaxBehavior.class, "wicket-ajax.js"));
}