Search in sources :

Example 31 with PageComponent

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

the class Ionic3Builder 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) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent)

Example 32 with PageComponent

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

the class Ionic3Builder method pageRemoved.

@Override
public void pageRemoved(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) {
                    writeAppSourceFiles(application);
                    deleteUselessDir(page.getName());
                    moveFiles();
                    Engine.logEngine.trace("(MobileBuilder) Handled 'pageRemoved'");
                }
            }
        }
    }
}
Also used : MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent) ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent)

Example 33 with PageComponent

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

the class Ionic3Builder method writeAppServiceTs.

private void writeAppServiceTs(ApplicationComponent app) throws EngineException {
    try {
        if (app != null) {
            Map<String, String> action_ts_imports = new HashMap<>();
            Map<String, String> action_ts_functions = new HashMap<>();
            // Menus contributors
            for (Contributor contributor : app.getContributors()) {
                action_ts_imports.putAll(contributor.getActionTsImports());
                action_ts_functions.putAll(contributor.getActionTsFunctions());
            }
            // Pages contributors
            List<PageComponent> pages = forceEnable ? app.getPageComponentList() : getEnabledPages(app);
            for (PageComponent page : pages) {
                synchronized (page) {
                    List<Contributor> contributors = page.getContributors();
                    for (Contributor contributor : contributors) {
                        action_ts_imports.putAll(contributor.getActionTsImports());
                        action_ts_functions.putAll(contributor.getActionTsFunctions());
                    }
                }
            }
            String c8o_ActionTsImports = "";
            for (String comp : action_ts_imports.keySet()) {
                if (!getTplServiceActionTsImports().containsKey(comp)) {
                    if (comp.indexOf(" as ") == -1)
                        c8o_ActionTsImports += "import { " + comp + " } from '" + action_ts_imports.get(comp) + "';" + System.lineSeparator();
                    else
                        c8o_ActionTsImports += "import " + comp + " from '" + action_ts_imports.get(comp) + "';" + System.lineSeparator();
                }
            }
            String c8o_ActionTsFunctions = System.lineSeparator();
            for (String function : action_ts_functions.values()) {
                c8o_ActionTsFunctions += function + System.lineSeparator();
            }
            File appServiceTpl = new File(ionicTplDir, "src/services/actionbeans.service.ts");
            String mContent = FileUtils.readFileToString(appServiceTpl, "UTF-8");
            mContent = mContent.replaceAll("/\\*\\=c8o_ActionTsImports\\*/", Matcher.quoteReplacement(c8o_ActionTsImports));
            mContent = mContent.replaceAll("/\\*\\=c8o_ActionTsFunctions\\*/", Matcher.quoteReplacement(c8o_ActionTsFunctions));
            File appServiceTsFile = new File(ionicWorkDir, "src/services/actionbeans.service.ts");
            writeFile(appServiceTsFile, mContent, "UTF-8");
            if (initDone) {
                Engine.logEngine.trace("(MobileBuilder) Ionic service ts file generated for 'app'");
            }
        }
    } catch (Exception e) {
        throw new EngineException("Unable to write ionic app service ts file", e);
    }
}
Also used : HashMap(java.util.HashMap) EngineException(com.twinsoft.convertigo.engine.EngineException) Contributor(com.twinsoft.convertigo.beans.mobile.components.Contributor) File(java.io.File) 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 34 with PageComponent

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

the class Ionic3Builder method pageStyleChanged.

@Override
public void pageStyleChanged(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && page.isEnabled() && initDone) {
        synchronized (page) {
            writePageStyle(page);
            moveFiles();
            Engine.logEngine.trace("(MobileBuilder) Handled 'pageStyleChanged'");
        }
    }
}
Also used : IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent)

Example 35 with PageComponent

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

the class Ionic3Builder method pageTemplateChanged.

@Override
public void pageTemplateChanged(final IPageComponent pageComponent) throws EngineException {
    PageComponent page = (PageComponent) pageComponent;
    if (page != null && page.isEnabled() && initDone) {
        synchronized (page) {
            writePageTemplate(page);
            moveFiles();
            Engine.logEngine.trace("(MobileBuilder) Handled 'pageTemplateChanged'");
        }
    }
}
Also used : IPageComponent(com.twinsoft.convertigo.beans.core.IPageComponent) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent)

Aggregations

PageComponent (com.twinsoft.convertigo.beans.mobile.components.PageComponent)41 IPageComponent (com.twinsoft.convertigo.beans.core.IPageComponent)20 EngineException (com.twinsoft.convertigo.engine.EngineException)16 File (java.io.File)15 ApplicationComponent (com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent)14 IOException (java.io.IOException)11 UIComponent (com.twinsoft.convertigo.beans.mobile.components.UIComponent)9 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)8 UISharedComponent (com.twinsoft.convertigo.beans.mobile.components.UISharedComponent)6 UIUseShared (com.twinsoft.convertigo.beans.mobile.components.UIUseShared)6 ArrayList (java.util.ArrayList)6 IApplicationComponent (com.twinsoft.convertigo.beans.core.IApplicationComponent)5 Project (com.twinsoft.convertigo.beans.core.Project)4 Contributor (com.twinsoft.convertigo.beans.mobile.components.Contributor)4 UIActionStack (com.twinsoft.convertigo.beans.mobile.components.UIActionStack)4 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)4 HashMap (java.util.HashMap)4 JSONObject (org.codehaus.jettison.json.JSONObject)4 Cursor (org.eclipse.swt.graphics.Cursor)4