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;
}
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();
}
}
}
}
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();
}
}
}
}
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;
}
Aggregations