Search in sources :

Example 11 with UIComponent

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

the class DisableMobileUIComponentAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            DatabaseObjectTreeObject treeObject = null;
            UIComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileUIComponentTreeObject) {
                    MobileUIComponentTreeObject componentTreeObject = (MobileUIComponentTreeObject) treeObject;
                    component = (UIComponent) componentTreeObject.getObject();
                    component.setEnabled(false);
                    componentTreeObject.setEnabled(false);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", true, false);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to disable component!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 12 with UIComponent

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

the class MobilePickerContentProvider 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);
                }
            }
        }
    }
}
Also used : UIAppEvent(com.twinsoft.convertigo.beans.mobile.components.UIAppEvent) UIPageEvent(com.twinsoft.convertigo.beans.mobile.components.UIPageEvent) IAction(com.twinsoft.convertigo.beans.mobile.components.IAction) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) ArrayList(java.util.ArrayList) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) JSONException(org.codehaus.jettison.json.JSONException) UIEventSubscriber(com.twinsoft.convertigo.beans.mobile.components.UIEventSubscriber) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) SourceData(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.SourceData) UIActionStack(com.twinsoft.convertigo.beans.mobile.components.UIActionStack) UIControlEvent(com.twinsoft.convertigo.beans.mobile.components.UIControlEvent) JSONObject(org.codehaus.jettison.json.JSONObject) UIActionEvent(com.twinsoft.convertigo.beans.mobile.components.UIActionEvent)

Example 13 with UIComponent

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

the class MobilePickerContentProvider 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));
                    }
                }
            }
        }
    }
}
Also used : JSONObject(org.codehaus.jettison.json.JSONObject) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) ArrayList(java.util.ArrayList) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) JSONException(org.codehaus.jettison.json.JSONException) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) SourceData(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.SourceData)

Example 14 with UIComponent

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

the class MobileUIComponentTreeObject method getNamedSourceSelector.

@Override
public NamedSourceSelector getNamedSourceSelector() {
    return new NamedSourceSelector() {

        @Override
        Object thisTreeObject() {
            return MobileUIComponentTreeObject.this;
        }

        @Override
        protected List<String> getPropertyNamesForSource(Class<?> c) {
            List<String> list = new ArrayList<String>();
            UIComponent object = getObject();
            if (object instanceof UIDynamicTab) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("tabpage");
                }
            } else if (object instanceof UIDynamicMenuItem) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("itempage");
                }
            } else if (object instanceof UIDynamicAnimate) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c) || MobileUIComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("identifiable");
                }
            } else if (object instanceof UIDynamicInvoke) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobileUIComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("stack");
                }
            } else if (object instanceof UIUseShared) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobileUIComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("sharedcomponent");
                }
            } else if (object instanceof UIDynamicInfiniteScroll) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c) || MobileUIComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("scrollaction");
                }
            } else if (object instanceof UIDynamicElement) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || SequenceTreeObject.class.isAssignableFrom(c) || ConnectorTreeObject.class.isAssignableFrom(c)) {
                    list.add("requestable");
                }
                if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || MobileApplicationComponentTreeObject.class.isAssignableFrom(c) || MobilePageComponentTreeObject.class.isAssignableFrom(c)) {
                    list.add("page");
                }
                if (ProjectTreeObject.class.isAssignableFrom(c) || ConnectorTreeObject.class.isAssignableFrom(c) || DesignDocumentTreeObject.class.isAssignableFrom(c) || DesignDocumentViewTreeObject.class.isAssignableFrom(c)) {
                    list.add("fsview");
                }
            }
            return list;
        }

        @Override
        protected boolean isNamedSource(String propertyName) {
            UIComponent object = getObject();
            if (object instanceof UIDynamicTab) {
                return "tabpage".equals(propertyName);
            } else if (object instanceof UIDynamicMenuItem) {
                return "itempage".equals(propertyName);
            } else if (object instanceof UIDynamicAnimate) {
                return "identifiable".equals(propertyName);
            } else if (object instanceof UIDynamicInvoke) {
                return "stack".equals(propertyName);
            } else if (object instanceof UIUseShared) {
                return "sharedcomponent".equals(propertyName);
            } else if (object instanceof UIDynamicInfiniteScroll) {
                return "scrollaction".equals(propertyName);
            } else if (object instanceof UIDynamicElement) {
                return "requestable".equals(propertyName) || "fsview".equals(propertyName) || "page".equals(propertyName);
            }
            return false;
        }

        @Override
        public boolean isSelectable(String propertyName, Object nsObject) {
            UIComponent object = getObject();
            if (object instanceof UIDynamicTab) {
                if ("tabpage".equals(propertyName)) {
                    if (nsObject instanceof PageComponent) {
                        return (((PageComponent) nsObject).getProject().equals(object.getProject()));
                    }
                }
            } else if (object instanceof UIDynamicMenuItem) {
                if ("itempage".equals(propertyName)) {
                    if (nsObject instanceof PageComponent) {
                        return (((PageComponent) nsObject).getProject().equals(object.getProject()));
                    }
                }
            } else if (object instanceof UIDynamicAnimate) {
                if ("identifiable".equals(propertyName)) {
                    UIDynamicAnimate uda = (UIDynamicAnimate) object;
                    if (nsObject instanceof UIElement) {
                        UIElement ue = (UIElement) nsObject;
                        if (hasSameScriptComponent(uda, ue)) {
                            return !ue.getIdentifier().isEmpty();
                        }
                    }
                }
            } else if (object instanceof UIDynamicInvoke) {
                if ("stack".equals(propertyName)) {
                    return nsObject instanceof UIActionStack;
                }
            } else if (object instanceof UIUseShared) {
                if ("sharedcomponent".equals(propertyName)) {
                    return nsObject instanceof UISharedComponent;
                }
            } else if (object instanceof UIDynamicInfiniteScroll) {
                if ("scrollaction".equals(propertyName)) {
                    if (nsObject instanceof UIDynamicAction) {
                        UIDynamicAction uida = (UIDynamicAction) nsObject;
                        if (uida.getProject().equals(object.getProject())) {
                            if (uida.getIonBean().getName().equals("CallSequenceAction")) {
                                return true;
                            }
                            if (uida.getIonBean().getName().equals("FullSyncViewAction")) {
                                return true;
                            }
                        }
                    }
                }
            } else if (object instanceof UIDynamicElement) {
                if ("requestable".equals(propertyName)) {
                    UIDynamicElement cc = (UIDynamicElement) object;
                    if (cc.getIonBean().getName().equals("CallSequenceAction")) {
                        return nsObject instanceof Sequence;
                    }
                    if (cc.getIonBean().getName().equals("CallFullSyncAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncSyncAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncViewAction")) {
                        return nsObject instanceof DesignDocument;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncPostAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncGetAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncDeleteAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncPutAttachmentAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FullSyncDeleteAttachmentAction")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("FSImage")) {
                        return nsObject instanceof FullSyncConnector;
                    }
                    if (cc.getIonBean().getName().equals("AutoScrollComponent")) {
                        return nsObject instanceof Sequence;
                    }
                }
                if ("fsview".equals(propertyName)) {
                    UIDynamicElement cc = (UIDynamicElement) object;
                    if (cc.getIonBean().getName().equals("FullSyncViewAction")) {
                        return nsObject instanceof String;
                    }
                    if (cc.getIonBean().getName().equals("AutoScrollComponent")) {
                        return nsObject instanceof DesignDocument || nsObject instanceof String;
                    }
                }
                if ("page".equals(propertyName)) {
                    if (nsObject instanceof PageComponent) {
                        return (((PageComponent) nsObject).getProject().equals(object.getProject()));
                    }
                }
            }
            return false;
        }

        @Override
        protected void handleSourceCleared(String propertyName) {
        // nothing to do
        }

        @Override
        protected void handleSourceRenamed(String propertyName, String oldName, String newName) {
            if (isNamedSource(propertyName)) {
                boolean hasBeenRenamed = false;
                Object oValue = getPropertyValue(propertyName);
                String pValue;
                if (oValue instanceof MobileSmartSourceType) {
                    MobileSmartSourceType sst = (MobileSmartSourceType) oValue;
                    pValue = sst.getSmartValue();
                } else {
                    pValue = (String) oValue;
                }
                String _pValue = pValue;
                if (pValue != null && (pValue.startsWith(oldName + ".") || pValue.equals(oldName))) {
                    _pValue = newName + pValue.substring(oldName.length());
                    if (!pValue.equals(_pValue)) {
                        UIComponent object = getObject();
                        if (object instanceof UIDynamicTab) {
                            if ("tabpage".equals(propertyName)) {
                                ((UIDynamicTab) object).setTabPage(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIDynamicMenuItem) {
                            if ("itempage".equals(propertyName)) {
                                ((UIDynamicMenuItem) object).setItemPage(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIDynamicAnimate) {
                            if ("identifiable".equals(propertyName)) {
                                ((UIDynamicAnimate) object).setIdentifiable(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIDynamicInvoke) {
                            if ("stack".equals(propertyName)) {
                                ((UIDynamicInvoke) object).setSharedActionQName(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIUseShared) {
                            if ("sharedcomponent".equals(propertyName)) {
                                ((UIUseShared) object).setSharedComponentQName(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIDynamicInfiniteScroll) {
                            if ("scrollaction".equals(propertyName)) {
                                ((UIDynamicInfiniteScroll) object).setScrollAction(_pValue);
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIDynamicElement) {
                            if ("requestable".equals(propertyName)) {
                                ((UIDynamicElement) object).getIonBean().setPropertyValue("requestable", new MobileSmartSourceType(_pValue));
                                hasBeenRenamed = true;
                            }
                            if ("fsview".equals(propertyName)) {
                                ((UIDynamicElement) object).getIonBean().setPropertyValue("fsview", new MobileSmartSourceType(_pValue));
                                hasBeenRenamed = true;
                            }
                            if ("page".equals(propertyName)) {
                                ((UIDynamicElement) object).getIonBean().setPropertyValue("page", new MobileSmartSourceType(_pValue));
                                hasBeenRenamed = true;
                            }
                        } else if (object instanceof UIText) {
                            if ("textValue".equals(propertyName)) {
                                ((UIText) object).setTextSmartType(new MobileSmartSourceType(_pValue));
                                hasBeenRenamed = true;
                            }
                        }
                    }
                }
                if (hasBeenRenamed) {
                    hasBeenModified(true);
                    viewer.refresh();
                    ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(MobileUIComponentTreeObject.this);
                    // refresh editors (e.g labels in combobox)
                    getDescriptors();
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(MobileUIComponentTreeObject.this, propertyName, pValue, _pValue);
                    ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
        }

        @Override
        protected void refactorSmartSources(Class<?> c, String oldName, String newName) {
            try {
                // A project has been renamed
                if (ProjectTreeObject.class.isAssignableFrom(c)) {
                    UIComponent object = getObject();
                    for (java.beans.PropertyDescriptor pd : CachedIntrospector.getBeanInfo(object).getPropertyDescriptors()) {
                        if (pd.getPropertyType().equals(MobileSmartSourceType.class)) {
                            String propertyName = pd.getName();
                            Object oValue = getPropertyValue(propertyName);
                            MobileSmartSourceType msst = (MobileSmartSourceType) oValue;
                            MobileSmartSource mss = msst.getSmartSource();
                            boolean hasBeenChanged = false;
                            if (mss != null) {
                                if (oldName.equals(mss.getProjectName())) {
                                    mss.setProjectName(newName);
                                    msst.setSmartValue(mss.toJsonString());
                                    hasBeenChanged = true;
                                }
                            }
                            if (hasBeenChanged) {
                                Object nValue = getPropertyValue(propertyName);
                                hasBeenModified(true);
                                viewer.refresh();
                                ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(MobileUIComponentTreeObject.this);
                                // refresh editors (e.g labels in combobox)
                                getDescriptors();
                                TreeObjectEvent treeObjectEvent = new TreeObjectEvent(MobileUIComponentTreeObject.this, propertyName, oValue, nValue);
                                ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
                            }
                        }
                    }
                }
            } catch (Exception e) {
            // TODO: handle exception
            }
        }
    };
}
Also used : UIElement(com.twinsoft.convertigo.beans.mobile.components.UIElement) MobileSmartSourceType(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType) UIUseShared(com.twinsoft.convertigo.beans.mobile.components.UIUseShared) ArrayList(java.util.ArrayList) UIDynamicTab(com.twinsoft.convertigo.beans.mobile.components.UIDynamicTab) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) UIDynamicInfiniteScroll(com.twinsoft.convertigo.beans.mobile.components.UIDynamicInfiniteScroll) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) UIText(com.twinsoft.convertigo.beans.mobile.components.UIText) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) UIDynamicElement(com.twinsoft.convertigo.beans.mobile.components.UIDynamicElement) Sequence(com.twinsoft.convertigo.beans.core.Sequence) CoreException(org.eclipse.core.runtime.CoreException) EngineException(com.twinsoft.convertigo.engine.EngineException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) UIActionStack(com.twinsoft.convertigo.beans.mobile.components.UIActionStack) UIDynamicAnimate(com.twinsoft.convertigo.beans.mobile.components.UIDynamicAnimate) UIDynamicAction(com.twinsoft.convertigo.beans.mobile.components.UIDynamicAction) MobileSmartSource(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource) UIDynamicInvoke(com.twinsoft.convertigo.beans.mobile.components.UIDynamicInvoke) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument) UIDynamicMenuItem(com.twinsoft.convertigo.beans.mobile.components.UIDynamicMenuItem) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 15 with UIComponent

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

the class MobileUIComponentTreeObject method treeObjectAdded.

@Override
public void treeObjectAdded(TreeObjectEvent treeObjectEvent) {
    super.treeObjectAdded(treeObjectEvent);
    TreeObject treeObject = (TreeObject) treeObjectEvent.getSource();
    Set<Object> done = checkDone(treeObjectEvent);
    String propertyName = (String) treeObjectEvent.propertyName;
    propertyName = ((propertyName == null) ? "" : propertyName);
    if (treeObject instanceof DatabaseObjectTreeObject) {
        DatabaseObjectTreeObject doto = (DatabaseObjectTreeObject) treeObject;
        DatabaseObject dbo = doto.getObject();
        try {
            if (this.equals(treeObject)) {
                UIActionStack uisa = ((UIComponent) dbo).getSharedAction();
                UISharedComponent uisc = ((UIComponent) dbo).getSharedComponent();
                if (uisa != null && !uisa.equals(getObject())) {
                    notifyDataseObjectPropertyChanged(uisa, "", null, null, done);
                }
                if (uisc != null && !uisc.equals(getObject())) {
                    notifyDataseObjectPropertyChanged(uisc, "", null, null, done);
                }
            } else {
                if (dbo instanceof UIActionStack) {
                    handleSharedActionChanged((UIActionStack) dbo, done);
                } else if (dbo instanceof UISharedComponent) {
                    handleSharedComponentChanged((UISharedComponent) dbo, done);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : UIActionStack(com.twinsoft.convertigo.beans.mobile.components.UIActionStack) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) UISharedComponent(com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) CoreException(org.eclipse.core.runtime.CoreException) EngineException(com.twinsoft.convertigo.engine.EngineException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

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