From: Jouni Koivuviita Date: Wed, 16 Sep 2009 19:09:38 +0000 (+0000) Subject: Forgot to commit, part of fix for #3352. X-Git-Tag: 6.7.0.beta1~2479^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cec0d92d4f2e66bfccd5a7881bf0189a4e54cad0;p=vaadin-framework.git Forgot to commit, part of fix for #3352. Also, trying to fix #3351, but this doesn't completely fix the issue. svn changeset:8822/svn branch:6.1 --- diff --git a/src/com/vaadin/demo/sampler/SamplerApplication.java b/src/com/vaadin/demo/sampler/SamplerApplication.java index d3a85287fc..7122acf506 100644 --- a/src/com/vaadin/demo/sampler/SamplerApplication.java +++ b/src/com/vaadin/demo/sampler/SamplerApplication.java @@ -56,8 +56,6 @@ public class SamplerApplication extends Application { private static final String[] THEMES = { "reindeer", "runo" }; private static final String SAMPLER_THEME_NAME = "sampler"; - private static String currentTheme = SAMPLER_THEME_NAME + "-" + THEMES[0]; - // used when trying to guess theme location private static String APP_URL = null; @@ -147,17 +145,26 @@ public class SamplerApplication extends Application { * */ class SamplerWindow extends Window { + + private final ThemeResource EMPTY_THEME_ICON = new ThemeResource( + "../sampler/sampler/icon-empty.png"); + + 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 FeatureView featureView = new FeatureView(); - private ObjectProperty currentFeature = new ObjectProperty(null, + private final FeatureView featureView = new FeatureView(); + private final ObjectProperty currentFeature = new ObjectProperty(null, Feature.class); - private ModeSwitch mode; + private final ModeSwitch mode; - private SplitPanel mainSplit; - private Tree navigationTree; + private final SplitPanel mainSplit; + private final Tree navigationTree; // itmill: UA-658457-6 - private GoogleAnalytics webAnalytics = new GoogleAnalytics( + private final GoogleAnalytics webAnalytics = new GoogleAnalytics( "UA-658457-6", "none"); // "backbutton" UriFragmentUtility uriFragmentUtility = new UriFragmentUtility(); @@ -376,18 +383,24 @@ public class SamplerApplication extends Application { theme.setImmediate(true); theme.setNullSelectionAllowed(false); for (String themeName : THEMES) { - theme.addItem(SAMPLER_THEME_NAME + "-" + themeName); - theme.setItemCaption(SAMPLER_THEME_NAME + "-" + themeName, - themeName.substring(0, 1).toUpperCase() - + themeName.substring(1) + " theme"); + String id = SAMPLER_THEME_NAME + "-" + themeName; + theme.addItem(id); + theme.setItemCaption(id, themeName.substring(0, 1) + .toUpperCase() + + themeName.substring(1) + " theme"); + theme.setItemIcon(id, EMPTY_THEME_ICON); } theme.setValue(currentTheme); + theme.setItemIcon(currentTheme, SELECTED_THEME_ICON); theme.addListener(new ComboBox.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { + final String newTheme = event.getProperty().getValue() .toString(); setTheme(newTheme); + theme.setItemIcon(currentTheme, EMPTY_THEME_ICON); + theme.setItemIcon(newTheme, SELECTED_THEME_ICON); currentTheme = newTheme; } }); @@ -617,7 +630,7 @@ public class SamplerApplication extends Application { * Table -mode FeatureList. Displays the features in a Table. */ private class FeatureTable extends Table implements FeatureList { - private HashMap iconCache = new HashMap(); + private final HashMap iconCache = new HashMap(); FeatureTable() { setStyleName("featuretable"); @@ -717,7 +730,7 @@ public class SamplerApplication extends Application { private class FeatureGrid extends Panel implements FeatureList { GridLayout grid = new GridLayout(11, 1); - private HashMap iconCache = new HashMap(); + private final HashMap iconCache = new HashMap(); FeatureGrid() { setSizeFull();