public void encodeEnd(FacesContext context, UIComponent component)
throws IOException {
super.encodeEnd(context, component);
RendererContributor contributor = DropzoneRendererContributor.getInstance();
StringBuffer buffer = new StringBuffer();
JSFunction function = new JSFunction("new DnD.SimpleDropZone");
function.addParameter(component.getParent().getClientId(context));
ScriptOptions dropOptions = contributor.buildOptions(context, component);
DnDParametersEncoder parametersEncoder = DnDParametersEncoder.getInstance();
dropOptions.addOption("dndParams", parametersEncoder.doEncodeAsString(context, component));
function.addParameter(dropOptions);
function.appendScript(buffer);
String scriptContribution = contributor.getScriptContribution(context, component);
if (scriptContribution != null && scriptContribution.length() != 0) {
buffer.append(scriptContribution);
}
ResponseWriter writer = context.getResponseWriter();