}
@Override
public Widget cloneDisplay(Map<String, Object> formData) {
ListWidget lw = new ListWidget();
populate(lw);
Object value = getInputValue(formData);
if (value != null) {
if (value.getClass().isArray()) {
Object[] arr = (Object[]) value;
for (Object obj : arr) {
lw.addItem(String.valueOf(obj));
}
} else if (value instanceof Collection) {
Collection<?> coll = (Collection<?>) value;
for (Object obj : coll) {
lw.addItem(String.valueOf(obj));
}
} else if (value instanceof Map) {
Map<?,?> map = (Map<?,?>) value;
for (Object obj : map.values()) {
lw.addItem(String.valueOf(obj));
}
}
} else {
String locale = (String) formData.get(FormBuilderGlobals.BASE_LOCALE);
if (locale == null) {
for (String item : this.listWidget.getItems()) {
lw.addItem(item);
}
} else {
String i18nText = getI18n(locale);
if (i18nText != null && !"".equals(i18nText)) {
String[] items = i18nText.split(","); //TODO specify i18n items should be comma separated
if (items != null) {
for (String item : items) {
lw.addItem(item);
}
}
}
}
}
super.populateActions(lw.getElement());
return lw;
}