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;
}
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);
}
}
}
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'");
}
}
}
}
}
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'");
}
}
}
}
}
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);
}
}
}
Aggregations