This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 32ab3e9d482ff651a12e482fe7dd814c09f5d717 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Aug 21 17:12:00 2014 +0200 fixes #3456: Bad message when using autoImportCss and use others css --- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 31 +++++++++------------- .../main/java/jaxx/compiler/tags/StyleHandler.java | 18 +------------ .../jaxx/compiler/tasks/CompileFirstPassTask.java | 8 ++---- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 7227c2a..31cfd4d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -987,38 +987,31 @@ public class JAXXCompiler { /*-- StyleSheet methods --------------------------------------------------*/ /*------------------------------------------------------------------------*/ -// public File getIdentCssFile() { -// String extension = FileUtil.extension(src); -// String jaxxFileName = src.getName(); -// String identCssFilename = jaxxFileName.substring( -// 0, -// jaxxFileName.length() - extension.length()) + "css"; -// File identCssFile = new File(src.getParentFile(), identCssFilename); -// return identCssFile; -// } - public boolean isIdentCssFound() { return identCssFound; } - public void registerStyleSheetFile(File styleFile) throws IOException { - if (!identCssFound && getConfiguration().isAutoImportCss()) { + public void registerStyleSheetFile(File styleFile, boolean warnAutoCssImport) throws IOException { + if (!identCssFound) { // detects if the given css file is ident to jaxx file File identCssFile = jaxxFile.getCssFile(); - if (identCssFile.exists()) { + if (styleFile.equals(identCssFile) && identCssFile.exists()) { // ok found ident css file identCssFound = true; - reportWarning("autoImportCss mode is on, you can remove " + - "style declaration with source " + styleFile); + if (warnAutoCssImport) { + + reportWarning("The css file "+styleFile+" can be automaticly imported since it is named as his jaxx file."); + + } + } } String content = loadFile(styleFile); -// String content = StylesheetHelper.loadCssFile(this, styleFile); getSourceFiles().push(styleFile); try { Stylesheet stylesheet = StylesheetHelper.processStylesheet(content); @@ -1996,9 +1989,9 @@ public class JAXXCompiler { } } - public void setIdentCssFound(boolean identCssFound) { - this.identCssFound = identCssFound; - } +// public void setIdentCssFound(boolean identCssFound) { +// this.identCssFound = identCssFound; +// } public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java index e9fc58b..c96ce5c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java @@ -62,24 +62,8 @@ public class StyleHandler implements TagHandler { if (!styleFile.exists()) { compiler.reportError("stylesheet file not found: " + styleFile); } else { - compiler.registerStyleSheetFile(styleFile); + compiler.registerStyleSheetFile(styleFile, true); } -// StringWriter styleBuffer = new StringWriter(); -// FileReader in = new FileReader(styleFile); -// try { -// char[] readBuffer = new char[2048]; -// int c; -// while ((c = in.read(readBuffer)) > 0) { -// styleBuffer.write(readBuffer, 0, c); -// } -// } catch (FileNotFoundException e) { -// compiler.reportError("stylesheet file not found: " + styleFile); -// } finally { -// in.close(); -// } -// compiler.getSourceFiles().push(styleFile); -// compiler.registerStylesheet(StylesheetHelper.processStylesheet(styleBuffer.toString())); -// compiler.getSourceFiles().pop(); } else if (!name.startsWith(XMLNS_ATTRIBUTE) && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tasks/CompileFirstPassTask.java b/jaxx-compiler/src/main/java/jaxx/compiler/tasks/CompileFirstPassTask.java index d17b25a..ee691cc 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tasks/CompileFirstPassTask.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tasks/CompileFirstPassTask.java @@ -86,14 +86,12 @@ public class CompileFirstPassTask extends JAXXEngineTask { boolean success = true; - CompilerConfiguration configuration = engine.getConfiguration(); - JAXXCompiler compiler = engine.newCompiler(jaxxFile); addStartProfileTime(engine, compiler); compiler.compileFirstPass(); - if (configuration.isAutoImportCss() && !compiler.isIdentCssFound()) { + if (!compiler.isIdentCssFound()) { // check if we can add ident css file @@ -104,13 +102,11 @@ public class CompileFirstPassTask extends JAXXEngineTask { } if (cssFile.exists()) { - compiler.setIdentCssFound(true); - if (isVerbose) { log.info("Auto import of css " + cssFile); } // ok add it - compiler.registerStyleSheetFile(cssFile); + compiler.registerStyleSheetFile(cssFile, false); } } addEndProfileTime(engine, compiler); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.