use of com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent 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 UISharedComponentEvent || 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);
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent 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.ApplicationComponent 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.ApplicationComponent in project convertigo by convertigo.
the class NgxBuilder method appPwaChanged.
@Override
public void appPwaChanged(final IApplicationComponent appComponent) throws EngineException {
ApplicationComponent app = (ApplicationComponent) appComponent;
if (app != null && initDone) {
synchronized (app) {
// for worker
configurePwaApp(app);
// for prod mode
writeAppComponentTs(app);
// for worker
writeAppModuleTs(app);
moveFiles();
Engine.logEngine.trace("(MobileBuilder) Handled 'appPwaChanged'");
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent in project convertigo by convertigo.
the class NgxBuilder method appTsChanged.
@Override
public void appTsChanged(final IApplicationComponent appComponent, boolean forceTemp) throws EngineException {
ApplicationComponent app = (ApplicationComponent) appComponent;
if (app != null && initDone) {
synchronized (app) {
writeAppComponentTs(app);
moveFiles();
File tempTsFile = new File(appDir, "app.component.temp.ts");
if (forceTemp && tempTsFile.exists()) {
writeAppComponentTempTs(app);
}
Engine.logEngine.trace("(MobileBuilder) Handled 'appTsChanged'");
}
}
}
Aggregations