Search in sources :

Example 1 with BodyPortal

use of com.servoy.j2db.server.ngclient.BodyPortal in project servoy-client by Servoy.

the class FormWrapper method getBaseComponents.

public Collection<IFormElement> getBaseComponents() {
    if (this.baseComponents != null)
        return this.baseComponents;
    List<IFormElement> components = new ArrayList<>();
    Collection<BaseComponent> excludedComponents = null;
    if ((isListView && !design) || isTableView) {
        excludedComponents = getBodyComponents();
    }
    List<IFormElement> persists = form.getFlattenedObjects(Form.FORM_INDEX_COMPARATOR);
    for (IFormElement persist : persists) {
        if (isSecurityVisible(persist)) {
            if ((excludedComponents == null || !excludedComponents.contains(persist)))
                components.add(persist);
            checkFormComponents(components, FormElementHelper.INSTANCE.getFormElement(persist, context.getSolution(), null, design), new HashSet<String>());
        }
    }
    if ((isListView && !design) || isTableView) {
        components.add(new BodyPortal(form));
    }
    if (form.getNavigatorID() == Form.NAVIGATOR_DEFAULT) {
        components.add(DefaultNavigator.INSTANCE);
    }
    this.baseComponents = components;
    return components;
}
Also used : IFormElement(com.servoy.j2db.persistence.IFormElement) BaseComponent(com.servoy.j2db.persistence.BaseComponent) BodyPortal(com.servoy.j2db.server.ngclient.BodyPortal) ArrayList(java.util.ArrayList)

Example 2 with BodyPortal

use of com.servoy.j2db.server.ngclient.BodyPortal in project servoy-client by Servoy.

the class PartWrapper method getBaseComponents.

public static Collection<BaseComponent> getBaseComponents(Part part, Form context, IServoyDataConverterContext converterContext, boolean isDesign, boolean flatten) {
    if (!isDesign && part.getPartType() == Part.BODY) {
        switch(context.getView()) {
            case FormController.TABLE_VIEW:
            case FormController.LOCKED_TABLE_VIEW:
            case IForm.LIST_VIEW:
            case FormController.LOCKED_LIST_VIEW:
                return Arrays.asList(new BaseComponent[] { new BodyPortal(context) });
        }
    }
    List<BaseComponent> baseComponents = new ArrayList<>();
    int startPos = context.getPartStartYPos(part.getID());
    int endPos = part.getHeight();
    Comparator<? super IFormElement> comparator = null;
    if (context.isResponsiveLayout()) {
        comparator = PositionComparator.XY_PERSIST_COMPARATOR;
    } else {
        comparator = FlattenedForm.FORM_INDEX_WITH_HIERARCHY_COMPARATOR;
    }
    List<IFormElement> persists = null;
    if (flatten) {
        persists = context.getFlattenedObjects(comparator);
    } else {
        persists = new ArrayList(context.getAllObjectsAsList());
        Iterator<IFormElement> it = persists.iterator();
        while (it.hasNext()) {
            IPersist persist = it.next();
            if (!(persist instanceof BaseComponent)) {
                it.remove();
            }
        }
        Collections.sort(persists, comparator);
    }
    for (IFormElement persist : persists) {
        Point location = CSSPositionUtils.getLocation(persist);
        if (startPos <= location.y && endPos > location.y && persist instanceof BaseComponent) {
            if (isSecurityVisible(persist, converterContext.getSolution(), context))
                baseComponents.add((BaseComponent) persist);
        }
    }
    return baseComponents;
}
Also used : IFormElement(com.servoy.j2db.persistence.IFormElement) BaseComponent(com.servoy.j2db.persistence.BaseComponent) IPersist(com.servoy.j2db.persistence.IPersist) BodyPortal(com.servoy.j2db.server.ngclient.BodyPortal) ArrayList(java.util.ArrayList) Point(java.awt.Point) Point(java.awt.Point)

Aggregations

BaseComponent (com.servoy.j2db.persistence.BaseComponent)2 IFormElement (com.servoy.j2db.persistence.IFormElement)2 BodyPortal (com.servoy.j2db.server.ngclient.BodyPortal)2 ArrayList (java.util.ArrayList)2 IPersist (com.servoy.j2db.persistence.IPersist)1 Point (java.awt.Point)1