Search in sources :

Example 6 with MobileApplication

use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.

the class Migration7_0_0 method migrate.

public static Element migrate(Document document, Element projectNode) throws EngineException {
    try {
        NodeList mobileDevicesNodeList = XMLUtils.findElements(projectNode, "/mobiledevice");
        if (mobileDevicesNodeList != null) {
            MobileApplication mobileApplication = new MobileApplication();
            Element mobileApplicationElement = mobileApplication.toXml(document);
            projectNode.appendChild(mobileApplicationElement);
            Node[] mobileDeviceNodes = XMLUtils.toNodeArray(mobileDevicesNodeList);
            boolean hasAndroid = false;
            boolean hasIOs = false;
            for (Node mobileDeviceNode : mobileDeviceNodes) {
                Element mobileDevice = (Element) mobileDeviceNode;
                String classname = mobileDevice.getAttribute("classname");
                if (classname == null) {
                // may never arrived
                } else if (classname.equals("com.twinsoft.convertigo.beans.mobiledevices.Android")) {
                    hasAndroid = true;
                } else if (classname.startsWith("com.twinsoft.convertigo.beans.mobiledevices.IP")) {
                    hasIOs = true;
                }
                projectNode.removeChild(mobileDevice);
            }
            if (hasAndroid) {
                mobileApplicationElement.appendChild(new Android().toXml(document));
            }
            if (hasIOs) {
                mobileApplicationElement.appendChild(new IOs().toXml(document));
            }
            if (hasAndroid && hasIOs) {
                mobileApplicationElement.appendChild(new WindowsPhone8().toXml(document));
                mobileApplicationElement.appendChild(new Windows().toXml(document));
            }
            String projectName = "" + XMLUtils.findPropertyValue(projectNode, "name");
            File mobileFolder = new File(Engine.projectDir(projectName) + "/DisplayObjects/mobile");
            if (mobileFolder.exists()) {
                FileUtils.write(new File(mobileFolder, "mobile_project_migrated.txt"), "Your mobile project has been migrated.\n" + "Now, we make per platform configuration and resources.\n" + "You may customize your config.xml (the existing one will never used) and dispatch your existing specific resources per platform (see the 'platforms' folder).\n" + "You can delete this file after reading it.", "UTF-8");
            }
        }
    } catch (Exception e) {
        throw new EngineException("[Migration 7.0.0] Unable to migrate project", e);
    }
    return projectNode;
}
Also used : WindowsPhone8(com.twinsoft.convertigo.beans.mobileplatforms.WindowsPhone8) NodeList(org.w3c.dom.NodeList) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Element(org.w3c.dom.Element) Node(org.w3c.dom.Node) EngineException(com.twinsoft.convertigo.engine.EngineException) Windows(com.twinsoft.convertigo.beans.mobileplatforms.Windows) IOs(com.twinsoft.convertigo.beans.mobileplatforms.IOs) EngineException(com.twinsoft.convertigo.engine.EngineException) IOException(java.io.IOException) Android(com.twinsoft.convertigo.beans.mobileplatforms.Android) MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) File(java.io.File)

Example 7 with MobileApplication

use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.

the class NgxBuilder method addPage.

private void addPage(PageComponent page) throws EngineException {
    MobileApplication mobileApplication = project.getMobileApplication();
    if (mobileApplication != null) {
        ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
        if (application != null) {
            writePageSourceFiles(page);
            writeAppSourceFiles(application);
        }
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent)

Example 8 with MobileApplication

use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.

the class NgxBuilder method compRenamed.

@Override
public void compRenamed(final ISharedComponent sharedComponent, final String oldName) throws EngineException {
    UISharedComponent comp = (UISharedComponent) sharedComponent;
    if (comp != null && initDone) {
        synchronized (comp) {
            String newName = comp.getName();
            String newQName = comp.getQName();
            String oldQName = newQName.replace("." + newName, "." + oldName);
            ComponentRefManager.get(Mode.use).copyKey(oldQName, newQName);
            MobileApplication mobileApplication = project.getMobileApplication();
            if (mobileApplication != null) {
                ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
                if (application != null) {
                    writeCompSourceFiles(comp);
                    writeAppSourceFiles(application);
                    deleteUselessCompDir(oldName, oldQName);
                    moveFiles();
                    Engine.logEngine.trace("(MobileBuilder) Handled 'compRenamed'");
                }
            }
        }
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) UISharedComponent(com.twinsoft.convertigo.beans.ngx.components.UISharedComponent)

Example 9 with MobileApplication

use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.

the class NgxBuilder method pageDisabled.

@Override
public void pageDisabled(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && !page.isEnabled() && initDone) {
        synchronized (page) {
            MobileApplication mobileApplication = project.getMobileApplication();
            if (mobileApplication != null) {
                ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
                if (application != null) {
                    writePageSourceFiles(page);
                    writeAppSourceFiles(application);
                    moveFiles();
                    Engine.logEngine.trace("(MobileBuilder) Handled 'pageDisabled'");
                }
            }
        }
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) ApplicationComponent(com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.ngx.components.PageComponent)

Example 10 with MobileApplication

use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.

the class Ionic3Builder method addPage.

private void addPage(PageComponent page) throws EngineException {
    MobileApplication mobileApplication = project.getMobileApplication();
    if (mobileApplication != null) {
        ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
        if (application != null) {
            writePageSourceFiles(page);
            writeAppSourceFiles(application);
        }
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent)

Aggregations

MobileApplication (com.twinsoft.convertigo.beans.core.MobileApplication)36 IApplicationComponent (com.twinsoft.convertigo.beans.core.IApplicationComponent)16 ApplicationComponent (com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent)12 IPageComponent (com.twinsoft.convertigo.beans.core.IPageComponent)8 MobilePlatform (com.twinsoft.convertigo.beans.core.MobilePlatform)8 IOException (java.io.IOException)8 UISharedComponent (com.twinsoft.convertigo.beans.ngx.components.UISharedComponent)7 Element (org.w3c.dom.Element)7 Project (com.twinsoft.convertigo.beans.core.Project)6 ApplicationComponent (com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent)6 ServiceException (com.twinsoft.convertigo.engine.admin.services.ServiceException)6 File (java.io.File)6 EngineException (com.twinsoft.convertigo.engine.EngineException)5 IOs (com.twinsoft.convertigo.beans.mobileplatforms.IOs)4 AuthenticationException (com.twinsoft.convertigo.engine.AuthenticationException)4 PageComponent (com.twinsoft.convertigo.beans.mobile.components.PageComponent)3 Android (com.twinsoft.convertigo.beans.mobileplatforms.Android)3 PageComponent (com.twinsoft.convertigo.beans.ngx.components.PageComponent)3 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)3 Cursor (org.eclipse.swt.graphics.Cursor)3