From 2a1aeaee2b0f57e55cb0f8c814520945d0f04752 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Tue, 8 Dec 2009 14:29:24 +0000 Subject: [PATCH] Theme version check for #3416 svn changeset:10202/svn branch:6.2 --- build/build.xml | 4 ++- .../buildhelpers/CompileDefaultTheme.java | 29 ++++++++++++++++--- .../terminal/gwt/client/VDebugConsole.java | 7 ++++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/build/build.xml b/build/build.xml index 5f84d8b83c..10dce77b31 100644 --- a/build/build.xml +++ b/build/build.xml @@ -868,11 +868,13 @@ - + Combining default themes css files + + diff --git a/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java b/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java index 96d5a3440a..b4c016d434 100644 --- a/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java +++ b/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java @@ -19,6 +19,8 @@ import java.util.Comparator; */ public class CompileDefaultTheme { + private static final String ARG_VERSION = "-version"; + private static final String THEME_DIR = "./WebContent/VAADIN/themes/"; private static final String BASE = "base"; private static final String RUNO = "runo"; @@ -29,9 +31,18 @@ public class CompileDefaultTheme { * @throws IOException */ public static void main(String[] args) throws IOException { - combineTheme(new String[] { BASE }, false); - combineTheme(new String[] { BASE, RUNO }, false); - combineTheme(new String[] { BASE, REINDEER }, true); + String ver = null; + for (int i = 0; i < args.length; i++) { + if (ARG_VERSION.equals(args[i])) { + if (args.length >= i) { + ver = args[i + 1]; + } + break; + } + } + combineTheme(new String[] { BASE }, false, ver); + combineTheme(new String[] { BASE, RUNO }, false, ver); + combineTheme(new String[] { BASE, REINDEER }, true, ver); } /** @@ -46,10 +57,20 @@ public class CompileDefaultTheme { * @throws IOException */ private static void combineTheme(String[] themeNames, - boolean useSmartSprites) throws IOException { + boolean useSmartSprites, String version) throws IOException { StringBuffer combinedCss = new StringBuffer(); + // Theme version + if (version == null) { + version = "9.9.9.INTERNAL-DEBUG-BUILD"; + } + version = version.replaceAll("\\.", "_"); + combinedCss.append(".v-theme-version:after {content:\"" + version + + "\";}\n"); + combinedCss.append(".v-theme-version-" + version + + " {display: none;}\n"); + for (int j = 0; j < themeNames.length; j++) { File f = new File(THEME_DIR + themeNames[j]); combinedCss diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index f3a59460e0..45b8c9353b 100755 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -39,7 +39,7 @@ public final class VDebugConsole extends VOverlay implements Console { /* Initialize version numbers from string replaced by build-script. */ static { if ("@VERSION@".equals("@" + "VERSION" + "@")) { - VERSION = "5.9.9-INTERNAL-NONVERSIONED-DEBUG-BUILD"; + VERSION = "9.9.9.INTERNAL-DEBUG-BUILD"; } else { VERSION = "@VERSION@"; } @@ -184,6 +184,11 @@ public final class VDebugConsole extends VOverlay implements Console { + "version than the one used on server. Unexpected " + "behavior may occur."); } + + log("
Warning: widgetset version " + VERSION + + " does not seem to match theme version
"); } private EventPreview dragpreview = new EventPreview() { -- 2.39.5