From: Artur Signell Date: Thu, 17 Sep 2009 11:28:26 +0000 (+0000) Subject: Fixed #3351 - Sampler uses the same theme for all users X-Git-Tag: 6.7.0.beta1~2478^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=32fbbaaaa6907f2aee1657ed5bcd509abeb4ee11;p=vaadin-framework.git Fixed #3351 - Sampler uses the same theme for all users svn changeset:8826/svn branch:6.1 --- diff --git a/src/com/vaadin/demo/sampler/SamplerApplication.java b/src/com/vaadin/demo/sampler/SamplerApplication.java index 7122acf506..91ae0b4c84 100644 --- a/src/com/vaadin/demo/sampler/SamplerApplication.java +++ b/src/com/vaadin/demo/sampler/SamplerApplication.java @@ -59,6 +59,9 @@ public class SamplerApplication extends Application { // used when trying to guess theme location private static String APP_URL = null; + private String currentApplicationTheme = SAMPLER_THEME_NAME + "-" + + THEMES[0]; + @Override public void init() { setMainWindow(new SamplerWindow()); @@ -152,8 +155,6 @@ public class SamplerApplication extends Application { private final ThemeResource SELECTED_THEME_ICON = new ThemeResource( "../sampler/sampler/select-bullet.png"); - private String currentTheme = SAMPLER_THEME_NAME + "-" + THEMES[0]; - private FeatureList currentList = new FeatureGrid(); private final FeatureView featureView = new FeatureView(); private final ObjectProperty currentFeature = new ObjectProperty(null, @@ -192,7 +193,7 @@ public class SamplerApplication extends Application { setSizeFull(); mainExpand.setSizeFull(); setCaption("Vaadin Sampler"); - setTheme(currentTheme); + setTheme(currentApplicationTheme); // topbar (navigation) HorizontalLayout nav = new HorizontalLayout(); @@ -390,8 +391,10 @@ public class SamplerApplication extends Application { + themeName.substring(1) + " theme"); theme.setItemIcon(id, EMPTY_THEME_ICON); } - theme.setValue(currentTheme); - theme.setItemIcon(currentTheme, SELECTED_THEME_ICON); + + final String currentWindowTheme = getTheme(); + theme.setValue(currentWindowTheme); + theme.setItemIcon(currentWindowTheme, SELECTED_THEME_ICON); theme.addListener(new ComboBox.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -399,9 +402,14 @@ public class SamplerApplication extends Application { final String newTheme = event.getProperty().getValue() .toString(); setTheme(newTheme); - theme.setItemIcon(currentTheme, EMPTY_THEME_ICON); + + for (String themeName : THEMES) { + String id = SAMPLER_THEME_NAME + "-" + themeName; + theme.setItemIcon(id, EMPTY_THEME_ICON); + } + theme.setItemIcon(newTheme, SELECTED_THEME_ICON); - currentTheme = newTheme; + currentApplicationTheme = newTheme; } });