Search in sources :

Example 1 with MobileApplication

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

the class Ionic3Builder method updateSourceFiles.

private void updateSourceFiles() throws EngineException {
    try {
        MobileApplication mobileApplication = project.getMobileApplication();
        if (mobileApplication != null) {
            ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
            if (application != null) {
                String appTplVersion = application.requiredTplVersion();
                if (compareVersions(tplVersion, appTplVersion) >= 0) {
                    for (PageComponent page : getEnabledPages(application)) {
                        writePageSourceFiles(page);
                    }
                    writeAppSourceFiles(application);
                    removeUselessPages(application);
                    Engine.logEngine.trace("(MobileBuilder) Application source files updated for ionic project '" + project.getName() + "'");
                } else {
                    cleanDirectories();
                    throw new EngineException("Template project minimum " + appTplVersion + " is required for this project.\n" + "You can change template by configuring the 'Template project' property of your project's 'Application' object.\n" + "Then, be sure to update the project node modules packages (Application Right Click->Update packages and execute) \n");
                }
            }
        }
    } catch (EngineException e) {
        throw e;
    } catch (Exception e) {
        throw new EngineException("Unable to update application source files for ionic project '" + project.getName() + "'", e);
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) EngineException(com.twinsoft.convertigo.engine.EngineException) IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) IOException(java.io.IOException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 2 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)

Example 3 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 4 with MobileApplication

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

the class NgxBuilder method pageDisabled.

@Override
public synchronized void pageDisabled(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && !page.isEnabled() && initDone) {
        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 5 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)

Aggregations

MobileApplication (com.twinsoft.convertigo.beans.core.MobileApplication)29 IApplicationComponent (com.twinsoft.convertigo.beans.core.IApplicationComponent)10 IPageComponent (com.twinsoft.convertigo.beans.core.IPageComponent)8 MobilePlatform (com.twinsoft.convertigo.beans.core.MobilePlatform)8 IOException (java.io.IOException)8 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 ApplicationComponent (com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent)5 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 Cursor (org.eclipse.swt.graphics.Cursor)3 Connector (com.twinsoft.convertigo.beans.core.Connector)2 Sequence (com.twinsoft.convertigo.beans.core.Sequence)2