Search in sources :

Example 1 with FormElementGroup

use of com.servoy.j2db.persistence.FormElementGroup in project servoy-client by Servoy.

the class MobileFormLayout method getBodyElementsForRecordView.

public static List<ISupportBounds> getBodyElementsForRecordView(FlattenedSolution editingFlattenedSolution, Form flattenedForm) {
    List<ISupportBounds> elements = new ArrayList<ISupportBounds>();
    Set<String> groups = new HashSet<String>();
    for (IPersist persist : flattenedForm.getAllObjectsAsList()) {
        if (persist instanceof ISupportExtendsID && PersistHelper.isOverrideOrphanElement((ISupportExtendsID) persist)) {
            // skip orphaned overrides
            continue;
        }
        if (persist instanceof IFormElement && persist instanceof AbstractBase) {
            String groupID = ((IFormElement) persist).getGroupID();
            if (groupID == null) {
                if (persist instanceof Portal && ((Portal) persist).isMobileInsetList()) {
                    // inset list
                    elements.add(((Portal) persist));
                } else // tabpanel: list elements or navtab
                if (((AbstractBase) persist).getCustomMobileProperty(IMobileProperties.HEADER_ITEM.propertyName) == null && ((AbstractBase) persist).getCustomMobileProperty(IMobileProperties.FOOTER_ITEM.propertyName) == null) {
                    // regular item
                    elements.add((ISupportBounds) (persist instanceof IFlattenedPersistWrapper ? ((IFlattenedPersistWrapper<?>) persist).getWrappedPersist() : persist));
                }
            } else if (groups.add(groupID)) {
                elements.add(new FormElementGroup(groupID, editingFlattenedSolution, FlattenedForm.getWrappedForm(flattenedForm)));
            }
        }
    }
    // sort by y-position
    Collections.sort(elements, PositionComparator.YX_BOUNDS_COMPARATOR);
    return elements;
}
Also used : ISupportExtendsID(com.servoy.j2db.persistence.ISupportExtendsID) FormElementGroup(com.servoy.j2db.persistence.FormElementGroup) ArrayList(java.util.ArrayList) AbstractBase(com.servoy.j2db.persistence.AbstractBase) ISupportBounds(com.servoy.j2db.persistence.ISupportBounds) IFormElement(com.servoy.j2db.persistence.IFormElement) IFlattenedPersistWrapper(com.servoy.j2db.persistence.IFlattenedPersistWrapper) IPersist(com.servoy.j2db.persistence.IPersist) Portal(com.servoy.j2db.persistence.Portal) JSPortal(com.servoy.j2db.scripting.solutionmodel.JSPortal) HashSet(java.util.HashSet)

Aggregations

AbstractBase (com.servoy.j2db.persistence.AbstractBase)1 FormElementGroup (com.servoy.j2db.persistence.FormElementGroup)1 IFlattenedPersistWrapper (com.servoy.j2db.persistence.IFlattenedPersistWrapper)1 IFormElement (com.servoy.j2db.persistence.IFormElement)1 IPersist (com.servoy.j2db.persistence.IPersist)1 ISupportBounds (com.servoy.j2db.persistence.ISupportBounds)1 ISupportExtendsID (com.servoy.j2db.persistence.ISupportExtendsID)1 Portal (com.servoy.j2db.persistence.Portal)1 JSPortal (com.servoy.j2db.scripting.solutionmodel.JSPortal)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1