use of com.servoy.j2db.server.ngclient.property.types.FormComponentPropertyType in project servoy-client by Servoy.
the class FormElement method convertDesignToFormElementValueAndPut.
/**
* Applies 'Conversion 1' (see {@link NGConversions}) to one property value - from design to FormElement value and then puts the value in the given formElementValues map.
*/
protected void convertDesignToFormElementValueAndPut(FlattenedSolution fs, PropertyDescription pd, Map<String, Object> formElementValues, String key, Object value, PropertyPath propertyPath) {
// is it a property
if (pd != null) {
propertyPath.add(key);
// value has the 'merged' value in hierarchy, except for the 'formcomponent' property; do the merge here
if ((pd.getType() instanceof FormComponentPropertyType) && value instanceof JSONObject && getPersistIfAvailable() instanceof ISupportExtendsID) {
// this is a json object, look for super persist for this property to get those values.
List<AbstractBase> hierarchy = PersistHelper.getOverrideHierarchy((ISupportExtendsID) getPersistIfAvailable());
if (hierarchy.size() > 1) {
// there is a super element (or more) so make a copy and copy everything in that.
JSONObject mergedValue = null;
for (int i = hierarchy.size(); --i >= 0; ) {
Object property = hierarchy.get(i).getProperty(key);
if (property instanceof JSONObject) {
if (mergedValue == null) {
mergedValue = new JSONObject();
}
ServoyJSONObject.mergeAndDeepCloneJSON((JSONObject) property, mergedValue);
} else if (property != null) {
mergedValue = null;
break;
}
}
if (mergedValue != null) {
value = mergedValue;
}
}
}
Object convertedValue = NGConversions.INSTANCE.convertDesignToFormElementValue(value, pd, fs, this, propertyPath);
formElementValues.put(key, convertedValue);
propertyPath.backOneLevel();
} else if (StaticContentSpecLoader.PROPERTY_NAME.getPropertyName().equals(key)) {
formElementValues.put(key, value);
}
}
Aggregations