use of com.servoy.j2db.persistence.ISupportTabSeq in project servoy-client by Servoy.
the class FormElementHelper method addFormComponentProperties.
private void addFormComponentProperties(Collection<PropertyDescription> formComponentProperties, IFormElement formElement, FlattenedSolution flattenedSolution, Map<TabSeqProperty, Integer> cachedTabSeq, List<TabSeqProperty> selected, List<TabSeqProperty> listFormComponentElements, boolean design, Set<String> recursionCheck) {
if (formComponentProperties != null && formComponentProperties.size() > 0) {
boolean isListFormComponent = isListFormComponent(formComponentProperties);
// avoid infinite cycle here
FormElement formComponentEl = FormElementHelper.INSTANCE.getFormElement(formElement, flattenedSolution, null, design);
for (PropertyDescription property : formComponentProperties) {
Object frmValue = formComponentEl.getPropertyValue(property.getName());
Form frm = FormComponentPropertyType.INSTANCE.getForm(frmValue, flattenedSolution);
if (frm == null)
continue;
if (!recursionCheck.add(frm.getName())) {
// $NON-NLS-1$
Debug.error("recursive reference found between (List)FormComponents: " + recursionCheck);
continue;
}
// do not use the formcomponentcache, we do not want formelement with wrong tabseq to be cached, must caclulate first the sequence
List<IFormElement> elements = generateFormComponentPersists(formComponentEl, property, (JSONObject) frmValue, frm, flattenedSolution);
for (IFormElement element : elements) {
if (element instanceof ISupportTabSeq) {
if (isListFormComponent && listFormComponentElements != null) {
listFormComponentElements.add(new TabSeqProperty(element, StaticContentSpecLoader.PROPERTY_TABSEQ.getPropertyName()));
} else if (((ISupportTabSeq) element).getTabSeq() >= 0) {
selected.add(new TabSeqProperty(element, StaticContentSpecLoader.PROPERTY_TABSEQ.getPropertyName(), CSSPositionUtils.getLocation(formElement)));
} else {
cachedTabSeq.put(new TabSeqProperty(element, StaticContentSpecLoader.PROPERTY_TABSEQ.getPropertyName()), Integer.valueOf(-2));
}
} else if (FormTemplateGenerator.isWebcomponentBean(element)) {
String nestedDomponentType = FormTemplateGenerator.getComponentTypeName(element);
WebObjectSpecification nestedSpecification = WebComponentSpecProvider.getSpecProviderState().getWebComponentSpecification(nestedDomponentType);
if (nestedSpecification != null) {
Collection<PropertyDescription> nestedProperties = nestedSpecification.getProperties(NGTabSeqPropertyType.NG_INSTANCE);
if (nestedProperties != null && nestedProperties.size() > 0) {
IBasicWebComponent webComponent = (IBasicWebComponent) element;
for (PropertyDescription tabSeqProperty : nestedProperties) {
int tabseq = Utils.getAsInteger(webComponent.getProperty(tabSeqProperty.getName()));
if (tabseq >= 0 && isListFormComponent && listFormComponentElements != null) {
// all elements will have the tabseq of the list
listFormComponentElements.add(new TabSeqProperty(element, tabSeqProperty.getName()));
} else if (tabseq >= 0) {
selected.add(new TabSeqProperty(element, tabSeqProperty.getName(), CSSPositionUtils.getLocation(formElement)));
} else {
cachedTabSeq.put(new TabSeqProperty(element, tabSeqProperty.getName()), Integer.valueOf(-2));
}
}
}
nestedProperties = nestedSpecification.getProperties(FormComponentPropertyType.INSTANCE);
addFormComponentProperties(nestedProperties, element, flattenedSolution, cachedTabSeq, selected, listFormComponentElements, design, recursionCheck);
}
}
}
recursionCheck.remove(frm.getName());
}
}
}
Aggregations