Search in sources :

Example 21 with UIComponent

use of com.twinsoft.convertigo.beans.mobile.components.UIComponent in project convertigo by convertigo.

the class SharedComponentWizard method doFinish.

private void doFinish(IProgressMonitor monitor) throws CoreException {
    UISharedComponent 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;
    }
}
Also used : ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) UIUseShared(com.twinsoft.convertigo.beans.mobile.components.UIUseShared) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MobileComponent(com.twinsoft.convertigo.beans.mobile.components.MobileComponent)

Example 22 with UIComponent

use of com.twinsoft.convertigo.beans.mobile.components.UIComponent in project convertigo by convertigo.

the class SharedComponentWizard method sharedComponentAlreadyExists.

protected boolean sharedComponentAlreadyExists(String sharedComponentName) {
    UIComponent uic = (UIComponent) getFirstInList();
    MobileApplication ma = uic.getProject().getMobileApplication();
    ApplicationComponent app = (ApplicationComponent) ma.getApplicationComponent();
    for (UISharedComponent uisc : app.getSharedComponentList()) {
        if (uisc.getName().equals(sharedComponentName)) {
            return true;
        }
    }
    return false;
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent)

Example 23 with UIComponent

use of com.twinsoft.convertigo.beans.mobile.components.UIComponent in project convertigo by convertigo.

the class SharedComponentWizard method createUseShared.

private UIUseShared createUseShared(String qname) throws Exception {
    UIUseShared uius = new UIUseShared();
    uius.setSharedComponentQName(qname);
    uius.hasChanged = true;
    uius.bNew = true;
    for (String name : dlg_map.keySet()) {
        String value = ovarMap.get(name).keySet().iterator().next();
        uius.add(createControlVariable(dlg_map.get(name), value));
    }
    UIComponent uic = (UIComponent) getLastInList();
    MobileComponent mc = (MobileComponent) uic.getParent();
    if (mc instanceof ApplicationComponent) {
        ApplicationComponent parent = (ApplicationComponent) mc;
        parent.add((DatabaseObject) uius, uic.priority);
    } else if (mc instanceof PageComponent) {
        PageComponent parent = (PageComponent) mc;
        parent.add((DatabaseObject) uius, uic.priority);
    } else if (mc instanceof UIComponent) {
        UIComponent parent = (UIComponent) mc;
        parent.add((DatabaseObject) uius, uic.priority);
    }
    return uius;
}
Also used : ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) UIUseShared(com.twinsoft.convertigo.beans.mobile.components.UIUseShared) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) MobileComponent(com.twinsoft.convertigo.beans.mobile.components.MobileComponent)

Example 24 with UIComponent

use of com.twinsoft.convertigo.beans.mobile.components.UIComponent in project convertigo by convertigo.

the class DisableMobileUIComponentAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
        for (int i = treeObjects.length - 1; i >= 0; --i) {
            WrapDatabaseObject treeObject = (WrapDatabaseObject) treeObjects[i];
            if (treeObject.instanceOf(UIComponent.class)) {
                // StepView stepTreeObject = (StepView) treeObject;
                UIComponent component = (UIComponent) treeObject.getObject();
                component.setEnabled(false);
            // stepTreeObject.setEnabled(true);
            // stepTreeObject.hasBeenModified(true);
            // TreeObjectEvent treeObjectEvent = new TreeObjectEvent(stepTreeObject, "isEnable", false, true);
            // explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
            }
        }
    // explorerView.refreshSelectedTreeObjects();
    } catch (Throwable e) {
        throw e;
    // ConvertigoPlugin.logException(e, "Unable to enable step!");
    }
// finally {
// shell.setCursor(null);
// waitCursor.dispose();
}
Also used : UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)

Example 25 with UIComponent

use of com.twinsoft.convertigo.beans.mobile.components.UIComponent in project convertigo by convertigo.

the class EnableMobileUIComponentAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
        for (int i = treeObjects.length - 1; i >= 0; --i) {
            WrapDatabaseObject treeObject = (WrapDatabaseObject) treeObjects[i];
            if (treeObject.instanceOf(UIComponent.class)) {
                // StepView stepTreeObject = (StepView) treeObject;
                UIComponent component = (UIComponent) treeObject.getObject();
                component.setEnabled(true);
            // stepTreeObject.setEnabled(true);
            // stepTreeObject.hasBeenModified(true);
            // TreeObjectEvent treeObjectEvent = new TreeObjectEvent(stepTreeObject, "isEnable", false, true);
            // explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
            }
        }
    // explorerView.refreshSelectedTreeObjects();
    } catch (Throwable e) {
        throw e;
    // ConvertigoPlugin.logException(e, "Unable to enable step!");
    }
// finally {
// shell.setCursor(null);
// waitCursor.dispose();
}
Also used : UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)

Aggregations

UIComponent (com.twinsoft.convertigo.beans.mobile.components.UIComponent)26 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)13 UISharedComponent (com.twinsoft.convertigo.beans.mobile.components.UISharedComponent)13 PageComponent (com.twinsoft.convertigo.beans.mobile.components.PageComponent)10 ApplicationComponent (com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent)9 UIActionStack (com.twinsoft.convertigo.beans.mobile.components.UIActionStack)9 EngineException (com.twinsoft.convertigo.engine.EngineException)8 CoreException (org.eclipse.core.runtime.CoreException)7 UIUseShared (com.twinsoft.convertigo.beans.mobile.components.UIUseShared)6 MobileSmartSourceType (com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType)5 JSONException (org.codehaus.jettison.json.JSONException)5 JSONObject (org.codehaus.jettison.json.JSONObject)5 MobileComponent (com.twinsoft.convertigo.beans.mobile.components.MobileComponent)4 SourceData (com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.SourceData)4 UICustomAction (com.twinsoft.convertigo.beans.mobile.components.UICustomAction)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 ArrayList (java.util.ArrayList)4 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)3 File (java.io.File)3 FullSyncConnector (com.twinsoft.convertigo.beans.connectors.FullSyncConnector)2