use of com.twinsoft.convertigo.beans.ngx.components.UISharedRegularComponent in project convertigo by convertigo.
the class SharedComponentWizard method doFinish.
private void doFinish(IProgressMonitor monitor) throws CoreException {
UISharedRegularComponent uisc = null;
UIUseShared uius = null;
try {
if (page1 != null) {
shared_comp_name = page1.getSharedComponentName();
keep_original = page1.keepComponent();
}
if (page2 != null) {
dlg_map = page2.getVariableMap();
}
// Create shared component
uisc = createSharedComponent();
monitor.setTaskName("SharedComponent created");
monitor.worked(1);
// Create UseShared
uius = createUseShared(uisc.getQName());
monitor.setTaskName("UseShared component created");
monitor.worked(1);
// Disable or Remove selected databaseObject(s)
for (DatabaseObject dbo : objectList) {
UIComponent uic = (UIComponent) dbo;
if (keep_original) {
uic.setEnabled(false);
uic.hasChanged = true;
} else {
MobileComponent mc = (MobileComponent) uic.getParent();
if (mc instanceof ApplicationComponent) {
ApplicationComponent parent = (ApplicationComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
} else if (mc instanceof PageComponent) {
PageComponent parent = (PageComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
} else if (mc instanceof UIComponent) {
UIComponent parent = (UIComponent) mc;
parent.remove(uic);
parent.hasChanged = true;
}
}
}
// Set newBean to new shared component
newBean = uisc;
} catch (Exception e) {
try {
if (uisc != null) {
uisc.getParent().remove(uisc);
}
if (uius != null) {
uius.getParent().remove(uius);
}
} catch (Exception ex) {
}
String message = "Unable to create a new object from class '" + this.className + "'.";
ConvertigoPlugin.logException(e, message);
newBean = null;
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UISharedRegularComponent in project convertigo by convertigo.
the class SharedComponentWizard method createSharedComponent.
private UISharedRegularComponent createSharedComponent() throws Exception {
UIComponent uic = (UIComponent) getFirstInList();
UISharedRegularComponent uisc = new UISharedRegularComponent();
uisc.setName(shared_comp_name);
uisc.hasChanged = true;
uisc.bNew = true;
// must be added before copy/paste !
uic.getApplication().add(uisc);
for (DatabaseObject dbo : objectList) {
ConvertigoPlugin.clipboardManagerSystem.reset();
ConvertigoPlugin.clipboardManagerSystem.isCopy = true;
String sXml = ConvertigoPlugin.clipboardManagerSystem.copy(dbo);
ConvertigoPlugin.clipboardManagerSystem.paste(sXml, uisc, false);
}
updateMobileSmartSources(uisc);
for (String name : dlg_map.keySet()) {
String value = getVariablesDefaultValue(name);
uisc.add(createCompVariable(dlg_map.get(name), value));
}
return uisc;
}
Aggregations