use of com.twinsoft.convertigo.beans.ngx.components.UISharedComponent in project convertigo by convertigo.
the class NgxBuilder method compTemplateChanged.
@Override
public void compTemplateChanged(final ISharedComponent sharedComponent) throws EngineException {
UISharedComponent comp = (UISharedComponent) sharedComponent;
if (comp != null && initDone) {
synchronized (comp) {
writeCompTemplate(comp);
moveFiles();
Engine.logEngine.trace("(MobileBuilder) Handled 'compTemplateChanged'");
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UISharedComponent in project convertigo by convertigo.
the class NgxBuilder method getTempTsRelativePath.
@Override
public String getTempTsRelativePath(final ISharedComponent compComponent) throws EngineException {
UISharedComponent comp = (UISharedComponent) compComponent;
try {
if (comp != null) {
String compName = comp.getName();
File compDir = compDir(comp);
File tempTsFile = new File(compDir, compName.toLowerCase() + ".temp.ts");
String filePath = tempTsFile.getPath().replace(projectDir.getPath(), File.separator);
return filePath;
}
} catch (Exception e) {
throw new EngineException("Unable to write component temp ts file", e);
}
return null;
}
use of com.twinsoft.convertigo.beans.ngx.components.UISharedComponent 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.ngx.components.UISharedComponent in project convertigo by convertigo.
the class NgxBuilder method compModuleTsChanged.
@Override
public void compModuleTsChanged(ISharedComponent sharedComponent) throws EngineException {
UISharedComponent comp = (UISharedComponent) sharedComponent;
if (comp != null && initDone) {
synchronized (comp) {
writeCompModuleTs(comp);
moveFiles();
Engine.logEngine.trace("(MobileBuilder) Handled 'compModuleTsChanged'");
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UISharedComponent in project convertigo by convertigo.
the class NgxBuilder method writeCompTempTs.
@Override
public void writeCompTempTs(final ISharedComponent compComponent) throws EngineException {
UISharedComponent comp = (UISharedComponent) compComponent;
try {
if (comp != null) {
String compName = comp.getName();
File compDir = compDir(comp);
String tsContent;
boolean isEnabled = true;
if (isEnabled) {
File compTsFile = new File(compDir, compName.toLowerCase() + ".ts");
synchronized (writtenFiles) {
if (writtenFiles.contains(compTsFile)) {
File compTsFileTmp = toTmpFile(compTsFile);
if (compTsFileTmp.exists()) {
compTsFile = compTsFileTmp;
}
}
}
tsContent = FileUtils.readFileToString(compTsFile, "UTF-8");
} else {
tsContent = getCompTsContent(comp);
}
// Replace all Begin_c8o_function:XXX, End_c8o_function:XXX
Pattern pattern = Pattern.compile("/\\*Begin_c8o_function:(.+)\\*/");
Matcher matcher = pattern.matcher(tsContent);
while (matcher.find()) {
String markerId = matcher.group(1);
String beginMarker = "/*Begin_c8o_function:" + markerId + "*/";
String endMarker = "/*End_c8o_function:" + markerId + "*/";
tsContent = tsContent.replace(beginMarker, "//---" + markerId + "---");
tsContent = tsContent.replace(endMarker, "//---" + markerId + "---");
}
// Remove all CTSXXX
int index = tsContent.indexOf("/*End_c8o_CompFunction*/");
if (index != -1) {
tsContent = tsContent.substring(0, index) + "/*End_c8o_CompFunction*/" + System.lineSeparator() + "}";
}
// Write file (do not need delay)
tsContent = LsPattern.matcher(tsContent).replaceAll(System.lineSeparator());
File tempTsFile = new File(compDir, compName.toLowerCase() + ".temp.ts");
FileUtils.write(tempTsFile, tsContent, "UTF-8");
}
} catch (Exception e) {
throw new EngineException("Unable to write ionic component temp ts file", e);
}
}
Aggregations