Search in sources :

Example 1 with Portal

use of com.servoy.j2db.persistence.Portal 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)

Example 2 with Portal

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

the class ScrollResponseHeaderContainer method getOnDropMethodID.

private int getOnDropMethodID() {
    int onDropID = 0;
    if (cellview instanceof Portal) {
        Portal cellviewPortal = (Portal) cellview;
        onDropID = cellviewPortal.getOnDropMethodID();
    } else {
        onDropID = fc.getForm().getOnDropMethodID();
    }
    return onDropID;
}
Also used : Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) Point(java.awt.Point)

Example 3 with Portal

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

the class ScrollResponseHeaderContainer method onDrag.

public int onDrag(JSDNDEvent event) {
    int onDragID = 0;
    if (cellview instanceof Portal) {
        Portal cellviewPortal = (Portal) cellview;
        onDragID = cellviewPortal.getOnDragMethodID();
    } else {
        onDragID = fc.getForm().getOnDragMethodID();
    }
    if (onDragID > 0) {
        // $NON-NLS-1$
        Object dragReturn = fc.executeFunction(Integer.toString(onDragID), new Object[] { event }, false, null, false, "onDragMethodID");
        if (dragReturn instanceof Number)
            return ((Number) dragReturn).intValue();
    }
    return DRAGNDROP.NONE;
}
Also used : Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) Point(java.awt.Point)

Example 4 with Portal

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

the class ScrollResponseHeaderContainer method onDragOver.

public boolean onDragOver(JSDNDEvent event) {
    int onDragOverID = 0;
    if (cellview instanceof Portal) {
        Portal cellviewPortal = (Portal) cellview;
        onDragOverID = cellviewPortal.getOnDragOverMethodID();
    } else {
        onDragOverID = fc.getForm().getOnDragOverMethodID();
    }
    if (onDragOverID > 0) {
        // $NON-NLS-1$
        Object dragOverReturn = fc.executeFunction(Integer.toString(onDragOverID), new Object[] { event }, false, null, false, "onDragOverMethodID");
        if (dragOverReturn instanceof Boolean)
            return ((Boolean) dragOverReturn).booleanValue();
    }
    return getOnDropMethodID() > 0;
}
Also used : Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) Point(java.awt.Point)

Example 5 with Portal

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

the class ScrollResponseHeaderContainer method createComponents.

private void createComponents(final IApplication app, final Form form, final AbstractBase view, final IDataProviderLookup dataProviderLookup, final IScriptExecuter el, final int viewStartY, final int viewEndY, final ItemAdd output) {
    List<IPersist> elements = ComponentFactory.sortElementsOnPositionAndGroup(view.getAllObjectsAsList());
    int startX = 0;
    for (int i = 0; i < elements.size(); i++) {
        IPersist element = elements.get(i);
        if (element instanceof Field || element instanceof GraphicalComponent || element instanceof Bean) {
            if (!isListViewMode()) {
                if (element instanceof GraphicalComponent && ((GraphicalComponent) element).getLabelFor() != null) {
                    if (isInView(cellview, ((GraphicalComponent) element).getLabelFor())) {
                        labelsFor.put(((GraphicalComponent) element).getLabelFor(), element);
                    }
                    continue;
                }
            }
            Point l = ((IFormElement) element).getLocation();
            if (l == null) {
                // unknown where to add
                continue;
            }
            if (l.y >= viewStartY && l.y < viewEndY) {
                IComponent c = ComponentFactory.createComponent(app, form, element, dataProviderLookup, el, false);
                if (cellview instanceof Portal && c instanceof IScriptableProvider) {
                    IScriptable s = ((IScriptableProvider) c).getScriptObject();
                    if (s instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback) s).getRenderEventExecutor() != null)
                        ComponentFactoryHelper.addPortalOnRenderCallback((Portal) cellview, ((ISupportOnRenderCallback) s).getRenderEventExecutor(), element, fc != null ? fc.getScriptExecuter() : null);
                }
                initializeComponent((Component) c, view, element);
                output.add(element, (Component) c);
                if (!isListViewMode()) {
                    // reset location.x as defined in this order, elements are ordered by location.x which is modified in drag-n-drop
                    Point loc = c.getLocation();
                    if (loc != null) {
                        c.setLocation(new Point(startX, loc.y));
                    }
                    Dimension csize = c.getSize();
                    startX += (csize != null) ? csize.width : ((IFormElement) element).getSize().width;
                }
            }
        }
    }
}
Also used : IComponent(com.servoy.j2db.ui.IComponent) GraphicalComponent(com.servoy.j2db.persistence.GraphicalComponent) ISupportOnRenderCallback(com.servoy.j2db.ui.ISupportOnRenderCallback) Point(java.awt.Point) Dimension(java.awt.Dimension) Point(java.awt.Point) IScriptable(com.servoy.j2db.scripting.IScriptable) IServoyAwareBean(com.servoy.j2db.dataui.IServoyAwareBean) Bean(com.servoy.j2db.persistence.Bean) Field(com.servoy.j2db.persistence.Field) IFormElement(com.servoy.j2db.persistence.IFormElement) IPersist(com.servoy.j2db.persistence.IPersist) Portal(com.servoy.j2db.persistence.Portal) RuntimePortal(com.servoy.j2db.ui.scripting.RuntimePortal) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider)

Aggregations

Portal (com.servoy.j2db.persistence.Portal)25 Point (java.awt.Point)13 RuntimePortal (com.servoy.j2db.ui.scripting.RuntimePortal)10 Form (com.servoy.j2db.persistence.Form)6 IPersist (com.servoy.j2db.persistence.IPersist)6 GraphicalComponent (com.servoy.j2db.persistence.GraphicalComponent)5 Field (com.servoy.j2db.persistence.Field)4 IFormElement (com.servoy.j2db.persistence.IFormElement)4 IForm (com.servoy.j2db.IForm)3 IServoyAwareBean (com.servoy.j2db.dataui.IServoyAwareBean)3 AbstractBase (com.servoy.j2db.persistence.AbstractBase)3 BaseComponent (com.servoy.j2db.persistence.BaseComponent)3 Bean (com.servoy.j2db.persistence.Bean)3 Part (com.servoy.j2db.persistence.Part)3 RepositoryException (com.servoy.j2db.persistence.RepositoryException)3 WebForm (com.servoy.j2db.server.headlessclient.WebForm)3 IComponent (com.servoy.j2db.ui.IComponent)3 ISupportAnchors (com.servoy.j2db.persistence.ISupportAnchors)2 ISupportName (com.servoy.j2db.persistence.ISupportName)2 TabPanel (com.servoy.j2db.persistence.TabPanel)2