for (Iterator iterator = children.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
if (object instanceof UIDndParam) {
UIDndParam dndParam = (UIDndParam) object;
String type = dndParam.getType();
JSONObject dndParams = null;
if (DRAG.equals(type)) {
if (isDraggable) {
dndParams = (JSONObject) params.get(DRAG);
} else {
String messageString = MessageFormat.format(MESSAGE_CAST, new Object[] {
MessageUtil.getLabel(context, dndParam),
type,
MessageUtil.getLabel(context, component),
Draggable.class.getSimpleName()
});
FacesMessage message = new FacesMessage(messageString, messageString);
context.addMessage(component.getClientId(context), message);
}
} else if (DROP.equals(type)) {
if (isDropzone) {
dndParams = (JSONObject) params.get(DROP);
} else {
String messageString = MessageFormat.format(MESSAGE_CAST, new Object[] {
MessageUtil.getLabel(context, dndParam),
type,
MessageUtil.getLabel(context, component),
Dropzone.class.getSimpleName()
});
FacesMessage message = new FacesMessage(messageString, messageString);
context.addMessage(component.getClientId(context), message);
}
} else if (type == null || type.length() == 0 || DEFAULT.equals(type)) {
dndParams = (JSONObject) params.get(DEFAULT);
} else {
String messageString = MessageFormat.format(MESSAGE_UNK_TYPE, new Object[] {
MessageUtil.getLabel(context, dndParam),
type
});
throw new IllegalArgumentException(messageString);
}
if (dndParams != null) {
if (dndParam.isRendered()) {
ResponseWriter responseWriter = context.getResponseWriter();
StringWriter dumpWriter = new StringWriter();
try {
context.setResponseWriter(responseWriter.cloneWithWriter(dumpWriter));
if (dndParam.getChildCount() == 0) {
context.getResponseWriter().writeText(dndParam.getValue(), null);
} else {
List paramChildren = dndParam.getChildren();
for (Iterator paramIterator = paramChildren
.iterator(); paramIterator.hasNext();) {
UIComponent paramChild = (UIComponent) paramIterator.next();
renderChild(context, paramChild);
}
}
context.getResponseWriter().flush();
} finally {
context.setResponseWriter(responseWriter);
}
String childContent = dumpWriter.getBuffer().toString();
dndParams.put(dndParam.getName(), childContent);
}
}
}
}
}