use of com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData in project convertigo by convertigo.
the class NgxPickerContentProvider method addSequences.
private void addSequences(Map<String, Set<String>> map, TVObject tvs, Object object, boolean isReferenced) {
if (object != null) {
if (object instanceof Project) {
Project project = (Project) object;
for (Sequence s : project.getSequencesList()) {
String label = isReferenced ? s.getQName() : s.getName();
SourceData sd = null;
try {
sd = Filter.Sequence.toSourceData(new JSONObject().put("sequence", s.getQName()));
} catch (JSONException e) {
e.printStackTrace();
}
tvs.add(new TVObject(label, s, sd));
Set<String> infos = map.get(s.getQName());
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
sd = Filter.Sequence.toSourceData(new JSONObject().put("sequence", s.getQName()).put("marker", marker));
tvs.add(new TVObject(label + "#" + marker, s, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData in project convertigo by convertigo.
the class NgxPickerComposite method getModelData.
// private List<String> getSourceList() {
// TVObject tvoSelected = null;
// Object selected = checkboxTreeViewer.getStructuredSelection().getFirstElement();
// if (selected != null && selected instanceof TVObject) {
// tvoSelected = (TVObject)selected;
// }
//
// List<String> sourceList = new ArrayList<String>();
// List<TVObject> tvoList = GenericUtils.cast(Arrays.asList(checkboxTreeViewer.getCheckedElements()));
// for (TVObject tvo : tvoList) {
// if (tvo.equals(tvoSelected)) {
// sourceList.add(0, tvo.getSource());
// }
// else {
// sourceList.add(tvo.getSource());
// }
// }
// return sourceList;
// }
private List<SourceData> getModelData() {
TVObject tvoSelected = null;
Object selected = checkboxTreeViewer.getStructuredSelection().getFirstElement();
if (selected != null && selected instanceof TVObject) {
tvoSelected = (TVObject) selected;
}
List<SourceData> sourceList = new ArrayList<SourceData>();
List<TVObject> tvoList = GenericUtils.cast(Arrays.asList(checkboxTreeViewer.getCheckedElements()));
for (TVObject tvo : tvoList) {
SourceData sd = tvo.getSourceData();
if (sd != null) {
if (tvo.equals(tvoSelected)) {
sourceList.add(0, sd);
} else {
sourceList.add(sd);
}
}
}
return sourceList;
}
use of com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData 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);
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData 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);
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.SourceData in project convertigo by convertigo.
the class NgxPickerContentProvider method addSharedComponents.
private void addSharedComponents(TVObject tvi, Object object) {
if (object != null) {
List<? extends UIComponent> list = null;
if (object instanceof ApplicationComponent) {
list = ((ApplicationComponent) object).getSharedComponentList();
} else if (object instanceof UISharedComponent) {
list = new ArrayList<>(Arrays.asList((UISharedComponent) object));
}
if (list != null) {
for (UIComponent uic : list) {
if (uic instanceof UISharedComponent) {
// 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) {
SourceData sd = null;
try {
sd = Filter.Shared.toSourceData(new JSONObject().put("priority", uic.priority));
} catch (JSONException e) {
e.printStackTrace();
}
tvi.add(new TVObject(uic.toString(), uic, sd));
}
}
}
}
}
}
Aggregations