Search in sources :

Example 6 with UIDynamicAction

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

the class NgxSharedComponentExtractAction method isAllowed.

private boolean isAllowed(TreeObject treeObject) {
    if (treeObject instanceof DatabaseObjectTreeObject) {
        DatabaseObjectTreeObject doto = (DatabaseObjectTreeObject) treeObject;
        if (doto.isEnabled() && !doto.hasAncestorDisabled()) {
            DatabaseObject dbo = doto.getObject();
            if (dbo instanceof UIElement) {
                UIElement uie = (UIElement) dbo;
                boolean isUIDynamicAction = uie instanceof UIDynamicAction;
                boolean isInForm = uie.getUIForm() != null && !uie.equals(uie.getUIForm());
                if (!isUIDynamicAction && !isInForm) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : UIElement(com.twinsoft.convertigo.beans.ngx.components.UIElement) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UIDynamicAction(com.twinsoft.convertigo.beans.ngx.components.UIDynamicAction) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 7 with UIDynamicAction

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

the class NgxPickerContentProvider method addLocals.

private void addLocals(TVObject tvi, Object object) {
    if (object != null) {
        Map<String, UIDynamicAction> locals = null;
        if (object instanceof ApplicationComponent) {
            locals = new HashMap<>();
            getLocalActions(object, locals);
        }
        if (locals != null) {
            try {
                JSONObject jsonInfos = new JSONObject();
                for (String key : locals.keySet()) {
                    jsonInfos.put(key, "");
                }
                SourceData sd = null;
                try {
                    sd = Filter.Local.toSourceData(new JSONObject());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                tvi.add(new TVObject("localObject", object, sd, jsonInfos));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : UIDynamicAction(com.twinsoft.convertigo.beans.ngx.components.UIDynamicAction) JSONObject(org.codehaus.jettison.json.JSONObject) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) JSONException(org.codehaus.jettison.json.JSONException) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData) JSONException(org.codehaus.jettison.json.JSONException)

Example 8 with UIDynamicAction

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

the class NgxPickerContentProvider method addGlobals.

private void addGlobals(TVObject tvi, Object object) {
    if (object != null) {
        Map<String, UIDynamicAction> globals = null;
        if (object instanceof ApplicationComponent) {
            globals = new HashMap<>();
            getGlobalActions(object, globals);
        }
        if (globals != null) {
            try {
                JSONObject jsonFSSA = new JSONObject().put("FullSyncSyncAction", new JSONObject().put("progress", new JSONObject().put("changed", "").put("continuous", "").put("finished", "").put("pull", "").put("current", "").put("total", "").put("status", "").put("taskInfo", "").put("raw", "")));
                JSONObject jsonInfos = new JSONObject();
                for (String key : globals.keySet()) {
                    if ("FullSyncSyncAction".equals(key)) {
                        jsonInfos.put(key, jsonFSSA.get(key));
                    } else {
                        jsonInfos.put(key, "");
                    }
                }
                SourceData sd = null;
                try {
                    sd = Filter.Global.toSourceData(new JSONObject());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                tvi.add(new TVObject("sharedObject", object, sd, jsonInfos));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : UIDynamicAction(com.twinsoft.convertigo.beans.ngx.components.UIDynamicAction) JSONObject(org.codehaus.jettison.json.JSONObject) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) JSONException(org.codehaus.jettison.json.JSONException) SourceData(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData) JSONException(org.codehaus.jettison.json.JSONException)

Example 9 with UIDynamicAction

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

the class NgxPickerComposite method lookupModelData.

private Map<String, Object> lookupModelData(TVObject tvObject) {
    Map<String, Object> data = new HashMap<String, Object>();
    Map<String, String> params = new HashMap<String, String>();
    DatabaseObject dbo = null;
    String searchPath = "";
    Object object = tvObject.getObject();
    JSONObject infos = tvObject.getInfos();
    if (object != null) {
        try {
            if (object instanceof RequestableObject) {
                dbo = (RequestableObject) object;
                searchPath = "";
            } else if (object instanceof DesignDocument) {
                dbo = (DesignDocument) object;
                DesignDocument dd = (DesignDocument) dbo;
                params.put("ddoc", dd.getName());
                params.put("view", tvObject.getParent().getName());
                params.put("include_docs", infos.has("include_docs") ? infos.getString("include_docs") : "false");
                searchPath = tvObject.getName().startsWith("get") ? ".rows.value" : "";
            } else if (object instanceof UIControlDirective) {
                dbo = (UIControlDirective) object;
                do {
                    UIControlDirective directive = (UIControlDirective) dbo;
                    String rootDboName = "";
                    if (directive.getPage() != null) {
                        rootDboName = directive.getPage().getName();
                    } else if (directive.getMenu() != null) {
                        rootDboName = directive.getMenu().getName();
                    }
                    MobileSmartSourceType msst = directive.getSourceSmartType();
                    MobileSmartSource mss = msst.getSmartSource();
                    if (mss != null) {
                        dbo = mss.getDatabaseObject(rootDboName);
                        params.putAll(mss.getParameters());
                        searchPath = mss.getModelPath().replaceAll("\\?\\.", ".") + searchPath;
                    } else {
                        dbo = null;
                    }
                } while (dbo != null && dbo instanceof UIControlDirective);
            } else if (object instanceof UIForm) {
                dbo = (UIForm) object;
                searchPath = "";
            } else if (object instanceof ApplicationComponent) {
                dbo = (ApplicationComponent) object;
                params.put("json", infos.toString());
                searchPath = "";
            } else if (object instanceof UIActionStack) {
                dbo = (UIActionStack) object;
                searchPath = "";
            } else if (object instanceof IAction) {
                if (object instanceof UIDynamicAction) {
                    dbo = (UIDynamicAction) object;
                    searchPath = "";
                } else if (object instanceof UICustomAction) {
                    dbo = (UICustomAction) object;
                    searchPath = "";
                }
            } else if (object instanceof UISharedComponent) {
                dbo = (UISharedComponent) object;
                searchPath = "";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    data.put("databaseObject", dbo);
    data.put("params", params);
    data.put("searchPath", searchPath);
    return data;
}
Also used : RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) IAction(com.twinsoft.convertigo.beans.ngx.components.IAction) HashMap(java.util.HashMap) MobileSmartSourceType(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) UIControlDirective(com.twinsoft.convertigo.beans.ngx.components.UIControlDirective) UIForm(com.twinsoft.convertigo.beans.ngx.components.UIForm) UISharedComponent(com.twinsoft.convertigo.beans.ngx.components.UISharedComponent) PartInitException(org.eclipse.ui.PartInitException) JSONException(org.codehaus.jettison.json.JSONException) UIActionStack(com.twinsoft.convertigo.beans.ngx.components.UIActionStack) MobileSmartSource(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource) UIDynamicAction(com.twinsoft.convertigo.beans.ngx.components.UIDynamicAction) JSONObject(org.codehaus.jettison.json.JSONObject) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) UICustomAction(com.twinsoft.convertigo.beans.ngx.components.UICustomAction) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) JSONObject(org.codehaus.jettison.json.JSONObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) TVObject(com.twinsoft.convertigo.eclipse.views.mobile.NgxPickerContentProvider.TVObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobileObject(com.twinsoft.convertigo.beans.core.MobileObject)

Aggregations

UIDynamicAction (com.twinsoft.convertigo.beans.ngx.components.UIDynamicAction)9 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)7 ApplicationComponent (com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent)5 UIActionStack (com.twinsoft.convertigo.beans.ngx.components.UIActionStack)5 UISharedComponent (com.twinsoft.convertigo.beans.ngx.components.UISharedComponent)5 UIUseShared (com.twinsoft.convertigo.beans.ngx.components.UIUseShared)4 IonBean (com.twinsoft.convertigo.beans.ngx.components.dynamic.IonBean)4 EngineException (com.twinsoft.convertigo.engine.EngineException)4 DesignDocument (com.twinsoft.convertigo.beans.couchdb.DesignDocument)3 MobileSmartSourceType (com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType)3 UICompVariable (com.twinsoft.convertigo.beans.ngx.components.UICompVariable)3 UIDynamicInvoke (com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke)3 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)3 JSONException (org.codehaus.jettison.json.JSONException)3 JSONObject (org.codehaus.jettison.json.JSONObject)3 Project (com.twinsoft.convertigo.beans.core.Project)2 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)2 Sequence (com.twinsoft.convertigo.beans.core.Sequence)2 IAction (com.twinsoft.convertigo.beans.ngx.components.IAction)2 MobileSmartSource (com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource)2