@Override
public void encodeEnd(FacesContext ctx,
UIComponent component) throws IOException {
ResponseWriter writer = ctx.getResponseWriter();
FormBuilderInternal formBuilder = (FormBuilderInternal) component;
HtmlForm form = getHtmlForm(formBuilder);
String paletteIds = "";
for (HtmlUnorderedList palette : formBuilder.getPalettes()) {
paletteIds += palette.getId() + ";";
}
paletteIds = paletteIds.substring(0, paletteIds.length() - 1);
writer.write("<script type=\"text/javascript\">"
+ "$(function(){"
+ "initFormBuilder(\"" + form.getClientId() + "\","
+ "\"" + paletteIds + "\","
+ "\"" + formBuilder.getFormContent().getId() + "\","
+ "\"" + getFormActionStringId(component) + "\","
+ "\"" + getFormContentStringId(component) + "\","
+ "\"" + getFormActiveTabStringId(component) + "\""