Search in sources :

Example 26 with PageComponent

use of com.twinsoft.convertigo.beans.ngx.components.PageComponent in project convertigo by convertigo.

the class NgxBuilder method pageAdded.

@Override
public synchronized void pageAdded(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && page.isEnabled() && page.bNew && initDone) {
        addPage(page);
        moveFiles();
        Engine.logEngine.trace("(MobileBuilder) Handled 'pageAdded'");
    }
}
Also used : IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent)

Example 27 with PageComponent

use of com.twinsoft.convertigo.beans.ngx.components.PageComponent in project convertigo by convertigo.

the class NgxBuilder method pageEnabled.

@Override
public synchronized void pageEnabled(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && page.isEnabled() && initDone) {
        addPage(page);
        moveFiles();
        Engine.logEngine.trace("(MobileBuilder) Handled 'pageEnabled'");
    }
}
Also used : IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent)

Example 28 with PageComponent

use of com.twinsoft.convertigo.beans.ngx.components.PageComponent in project convertigo by convertigo.

the class NgxPickerContentProvider method addIterations.

private void addIterations(TVObject tvi, Object object) {
    if (object != null) {
        List<UIComponent> list = null;
        if (object instanceof PageComponent) {
            list = ((PageComponent) object).getUIComponentList();
        } else if (object instanceof UIComponent) {
            list = ((UIComponent) object).getUIComponentList();
        }
        if (list != null) {
            for (UIComponent uic : list) {
                if (uic instanceof UIControlDirective) {
                    // do not add to prevent selection on itself or children
                    if (uic.equals(selected)) {
                        return;
                    }
                    // do not add if not parent of selected (popped picker only)
                    boolean showInPicker = true;
                    if (selected != null && selected instanceof UIComponent) {
                        String selectedQName = ((UIComponent) selected).getQName();
                        String uicQName = uic.getQName() + ".";
                        if (!selectedQName.startsWith(uicQName)) {
                            showInPicker = false;
                        }
                    }
                    UIControlDirective uicd = (UIControlDirective) uic;
                    if (showInPicker && AttrDirective.ForEach.equals(AttrDirective.getDirective(uicd.getDirectiveName()))) {
                        SourceData sd = null;
                        try {
                            sd = Filter.Iteration.toSourceData(new JSONObject().put("priority", uic.priority));
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        TVObject tuic = tvi.add(new TVObject(uic.toString(), uic, sd));
                        addIterations(tuic, uic);
                    } else {
                        addIterations(tvi, uic);
                    }
                } else {
                    addIterations(tvi, uic);
                }
            }
        }
    }
}
Also used : JSONObject(org.codehaus.jettison.json.JSONObject) UIComponent(com.twinsoft.convertigo.beans.ngx.components.UIComponent) UIControlDirective(com.twinsoft.convertigo.beans.ngx.components.UIControlDirective) JSONException(org.codehaus.jettison.json.JSONException) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData)

Example 29 with PageComponent

use of com.twinsoft.convertigo.beans.ngx.components.PageComponent in project convertigo by convertigo.

the class NgxPickerContentProvider method addActions.

private void addActions(TVObject tvi, Object object) {
    if (object != null) {
        List<? extends UIComponent> list = null;
        if (object instanceof ApplicationComponent) {
            ApplicationComponent app = (ApplicationComponent) object;
            list = app.getUIAppEventList();
            list.addAll(GenericUtils.cast(app.getUIEventSubscriberList()));
            list.addAll(GenericUtils.cast(app.getSharedActionList()));
        } else if (object instanceof UIActionStack) {
            if (tvi != null && "actions".equals(tvi.getName())) {
                list = new ArrayList<>(Arrays.asList((UIActionStack) object));
            } else {
                list = ((UIActionStack) object).getUIComponentList();
            }
        } else if (object instanceof UISharedComponent) {
            list = ((UISharedComponent) object).getUIComponentList();
        } else if (object instanceof PageComponent) {
            list = ((PageComponent) object).getUIComponentList();
        } else if (object instanceof UIComponent) {
            list = ((UIComponent) object).getUIComponentList();
        }
        if (list != null) {
            TVObject tvEvents = null, tvControls = null;
            if (tvi != null && "actions".equals(tvi.getName())) {
                tvEvents = tvi.children.get(0);
                tvControls = tvi.children.get(1);
            }
            for (UIComponent uic : list) {
                // do not add to prevent selection on itself or children
                if (uic.equals(selected)) {
                    return;
                }
                // do not add if not parent of selected (popped picker only)
                boolean showInPicker = true;
                if (selected != null && selected instanceof UIComponent) {
                    String selectedQName = ((UIComponent) selected).getQName();
                    String uicQName = uic.getQName() + ".";
                    if (!selectedQName.startsWith(uicQName)) {
                        showInPicker = false;
                    }
                }
                if (showInPicker) {
                    if (uic instanceof UIAppEvent || uic instanceof UIPageEvent || uic instanceof UIEventSubscriber) {
                        TVObject tve = tvEvents == null ? tvi.add(new TVObject(uic.toString(), uic, null)) : tvEvents.add(new TVObject(uic.toString(), uic, null));
                        addActions(tve, uic);
                    } else if (uic instanceof UIActionEvent || uic instanceof UIControlEvent) {
                        TVObject tve = tvControls == null ? tvi.add(new TVObject(uic.toString(), uic, null)) : tvControls.add(new TVObject(uic.toString(), uic, null));
                        addActions(tve, uic);
                    } else if (uic instanceof IAction || uic instanceof UIActionStack) {
                        SourceData sd = null;
                        try {
                            sd = Filter.Action.toSourceData(new JSONObject().put("priority", uic.priority));
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        TVObject tuic = tvi.add(new TVObject(uic.toString(), uic, sd));
                        addActions(tuic, uic);
                    } else {
                        addActions(tvi, uic);
                    }
                // } else {
                // addActions(tvi, uic);
                }
            }
        }
    }
}
Also used : UIAppEvent(com.twinsoft.convertigo.beans.ngx.components.UIAppEvent) UIPageEvent(com.twinsoft.convertigo.beans.ngx.components.UIPageEvent) IAction(com.twinsoft.convertigo.beans.ngx.components.IAction) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) ArrayList(java.util.ArrayList) UIComponent(com.twinsoft.convertigo.beans.ngx.components.UIComponent) JSONException(org.codehaus.jettison.json.JSONException) UIEventSubscriber(com.twinsoft.convertigo.beans.ngx.components.UIEventSubscriber) UISharedComponent(com.twinsoft.convertigo.beans.ngx.components.UISharedComponent) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData) UIActionStack(com.twinsoft.convertigo.beans.ngx.components.UIActionStack) UIControlEvent(com.twinsoft.convertigo.beans.ngx.components.UIControlEvent) JSONObject(org.codehaus.jettison.json.JSONObject) UIActionEvent(com.twinsoft.convertigo.beans.ngx.components.UIActionEvent)

Example 30 with PageComponent

use of com.twinsoft.convertigo.beans.ngx.components.PageComponent in project convertigo by convertigo.

the class NgxPickerContentProvider method addForms.

private void addForms(TVObject tvi, Object object) {
    if (object != null) {
        List<UIComponent> list = null;
        if (object instanceof PageComponent) {
            list = ((PageComponent) object).getUIComponentList();
        } else if (object instanceof UIComponent) {
            list = ((UIComponent) object).getUIComponentList();
        }
        if (list != null) {
            for (UIComponent uic : list) {
                if (uic instanceof UIForm) {
                    // do not add to prevent selection on itself or children
                    if (uic.equals(selected)) {
                        return;
                    }
                    SourceData sd = null;
                    try {
                        sd = Filter.Form.toSourceData(new JSONObject().put("priority", uic.priority).put("identifier", ((UIForm) uic).getIdentifier()));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    TVObject tuic = tvi.add(new TVObject(uic.toString(), uic, sd));
                    addForms(tuic, uic);
                } else {
                    addForms(tvi, uic);
                }
            }
        }
    }
}
Also used : JSONObject(org.codehaus.jettison.json.JSONObject) UIComponent(com.twinsoft.convertigo.beans.ngx.components.UIComponent) JSONException(org.codehaus.jettison.json.JSONException) UIForm(com.twinsoft.convertigo.beans.ngx.components.UIForm) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData)

Aggregations

PageComponent (com.twinsoft.convertigo.beans.ngx.components.PageComponent)36 IPageComponent (com.twinsoft.convertigo.beans.core.IPageComponent)21 EngineException (com.twinsoft.convertigo.engine.EngineException)14 File (java.io.File)13 ApplicationComponent (com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent)11 IOException (java.io.IOException)10 UIComponent (com.twinsoft.convertigo.beans.ngx.components.UIComponent)7 IApplicationComponent (com.twinsoft.convertigo.beans.core.IApplicationComponent)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)5 UIActionStack (com.twinsoft.convertigo.beans.ngx.components.UIActionStack)5 UISharedComponent (com.twinsoft.convertigo.beans.ngx.components.UISharedComponent)5 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)5 ArrayList (java.util.ArrayList)5 Cursor (org.eclipse.swt.graphics.Cursor)5 Display (org.eclipse.swt.widgets.Display)5 Shell (org.eclipse.swt.widgets.Shell)5 MobileApplication (com.twinsoft.convertigo.beans.core.MobileApplication)4 Contributor (com.twinsoft.convertigo.beans.ngx.components.Contributor)4 UIUseShared (com.twinsoft.convertigo.beans.ngx.components.UIUseShared)4 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)4