} else if (sub instanceof BooleanField) {
BooleanField field = (BooleanField)sub;
value = unwrap(value);
field.setValue(value);
} else if (sub instanceof Output) {
Output field = (Output)sub;
value = unwrap(value);
field.setValue(value);
} else if (sub instanceof Repeater) {
Repeater repeater = (Repeater)sub;
if (value instanceof NativeArray) {
NativeArray arr = (NativeArray)value;
Object length = getProperty(arr, "length");
int len = ((Number)length).intValue();
for (int i = repeater.getSize(); i >= len; --i) {
repeater.removeRow(i);
}
for (int i = 0; i < len; i++) {
Object elemValue = getProperty(arr, i);
if (elemValue instanceof Scriptable) {
Scriptable s = (Scriptable)elemValue;
Object[] ids = s.getIds();
ScriptableWidget wid = wrap(repeater.getRow(i));
for (int j = 0; j < ids.length; j++) {
String idStr = ids[j].toString();
wid.put(idStr, wid, getProperty(s, idStr));
}
}
}
return;
}
} else if (sub instanceof MultiValueField) {
MultiValueField field = (MultiValueField)sub;
Object[] values = null;
if (value instanceof NativeArray) {
NativeArray arr = (NativeArray)value;
Object length = getProperty(arr, "length");
int len = ((Number)length).intValue();
values = new Object[len];
for (int i = 0; i < len; i++) {
Object elemValue = getProperty(arr, i);
values[i] = unwrap(elemValue);
}
} else if (value instanceof Object[]) {
values = (Object[])value;
}
field.setValues(values);
} else {
if (value instanceof Scriptable) {
Scriptable s = (Scriptable)value;
Object[] ids = s.getIds();
ScriptableWidget wid = wrap(sub);