use of com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.Filter in project convertigo by convertigo.
the class MobilePickerComposite method setCurrentInput.
public void setCurrentInput(Object selected, String source) {
if (isUpdating)
return;
currentMC = null;
setWidgetsEnabled(true);
if (selected instanceof MobileComponentTreeObject) {
UIComponent uic = null;
if (selected instanceof MobilePageComponentTreeObject) {
currentMC = ((MobilePageComponentTreeObject) selected).getObject();
} else if (selected instanceof MobileUIComponentTreeObject) {
uic = ((MobileUIComponentTreeObject) selected).getObject();
// currentMC = uic.getPage() != null ? uic.getPage() : (uic.getMenu() != null ? uic.getMenu() : uic.getApplication());
currentMC = currentMC == null ? uic.getPage() : currentMC;
currentMC = currentMC == null ? uic.getMenu() : currentMC;
currentMC = currentMC == null ? uic.getSharedAction() : currentMC;
currentMC = currentMC == null ? uic.getSharedComponent() : currentMC;
currentMC = currentMC == null ? uic.getApplication() : currentMC;
}
if (currentMC == null) {
resetViewers();
} else {
if (!currentMC.equals(checkboxTreeViewer.getInput())) {
resetViewers();
checkboxTreeViewer.setInput(currentMC);
initTreeSelection(checkboxTreeViewer, null);
}
MobileSmartSource cs = MobileSmartSource.valueOf(source);
if (cs != null) {
MobilePickerContentProvider contentProvider = (MobilePickerContentProvider) checkboxTreeViewer.getContentProvider();
if (isParentDialog) {
// when dbo's property edition
contentProvider.setSelectedDbo(uic);
}
ToolItem buttonToSelect = btnSequence;
currentSource = source;
Filter filter = cs.getFilter();
if (Filter.Sequence.equals(filter)) {
buttonToSelect = btnSequence;
}
if (Filter.Database.equals(filter)) {
buttonToSelect = btnDatabase;
}
if (Filter.Action.equals(filter)) {
buttonToSelect = btnAction;
}
if (Filter.Shared.equals(filter)) {
buttonToSelect = btnShared;
}
if (Filter.Iteration.equals(filter)) {
buttonToSelect = btnIteration;
}
if (Filter.Form.equals(filter)) {
buttonToSelect = btnForm;
}
if (Filter.Global.equals(filter)) {
buttonToSelect = btnGlobal;
}
buttonToSelect.notifyListeners(SWT.Selection, null);
}
}
updateMessage();
} else {
resetViewers();
updateMessage();
}
}
use of com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.Filter in project convertigo by convertigo.
the class MobilePickerComposite method updateTexts.
// private void updateText() {
// boolean isDirective = btnIteration.getSelection();
// boolean isForm = btnForm.getSelection();
// boolean isGlobal = btnGlobal.getSelection();
// List<String> sourceData = getSourceList();
// int size = sourceData.size();
//
// StringBuffer buf = new StringBuffer();
// if ((isDirective || isForm || isGlobal) && size > 0) {
// String data = sourceData.get(0);
// if (!data.isEmpty()) {
// buf.append(data);
// }
// }
// else {
// for (String data : sourceData) {
// if (!data.isEmpty()) {
// buf.append(buf.length() > 0 ? ", ":"").append(data);
// }
// }
// }
//
// String path = getModelPath();
// String searchPath = "root";
// int index = path.indexOf(searchPath);
// if (index != -1) {
// path = path.substring(index + searchPath.length());
// }
//
// String computedText = buf.length() > 0 ? (isDirective || isForm || isGlobal ? buf + path : "listen(["+ buf +"])" + path):"";
// t_data.setText(computedText);
// }
// private void updateText(String s) {
// t_custom.setText(s);
// }
private void updateTexts() {
Filter filter = getFilter();
String path = getModelPath();
String searchPath = "root";
int index = path.indexOf(searchPath);
if (index != -1) {
path = path.substring(index + searchPath.length());
}
SourceModel model = MobileSmartSource.emptyModel(filter);
model.setSourceData(getModelData());
model.setPath(path);
t_data.setText(model.computeValue());
}
use of com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.Filter in project convertigo by convertigo.
the class MobilePickerComposite method getSmartSourceString.
public String getSmartSourceString() {
try {
Filter filter = getFilter();
String projectName = currentMC.getProject().getName();
MobileSmartSource cmss = MobileSmartSource.valueOf(currentSource);
String input = cmss == null ? "" : cmss.getInput();
String path = getModelPath();
String searchPath = "root";
int index = path.indexOf(searchPath);
if (index != -1) {
path = path.substring(index + searchPath.length());
}
SourceModel model = MobileSmartSource.emptyModel(filter);
model.setCustom(t_custom.getText());
model.setPrefix(t_prefix.getText());
model.setSuffix(t_suffix.getText());
model.setUseCustom(b_custom.getSelection());
model.setSourceData(getModelData());
model.setPath(path);
JSONObject jsonModel = model.toJson();
// System.out.println(jsonModel.toString(1));
MobileSmartSource nmss = new MobileSmartSource(filter, projectName, input, jsonModel);
// System.out.println(nmss.toJsonString(1));
return nmss.toJsonString();
} catch (Exception e) {
return "";
}
}
Aggregations