summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni.koivuviita@itmill.com>2009-09-16 19:09:38 +0000
committerJouni Koivuviita <jouni.koivuviita@itmill.com>2009-09-16 19:09:38 +0000
commitcec0d92d4f2e66bfccd5a7881bf0189a4e54cad0 (patch)
tree57e07a480a1d0e6b22f6310c4a14571554f3f1eb /src
parentfdd1d015f5891bab44252661631f1ed77cc30c3a (diff)
downloadvaadin-framework-cec0d92d4f2e66bfccd5a7881bf0189a4e54cad0.tar.gz
vaadin-framework-cec0d92d4f2e66bfccd5a7881bf0189a4e54cad0.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/demo/sampler/SamplerApplication.java41
1 files changed, 27 insertions, 14 deletions
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<Object, Resource> iconCache = new HashMap<Object, Resource>();
+ private final HashMap<Object, Resource> iconCache = new HashMap<Object, Resource>();
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<Object, Resource> iconCache = new HashMap<Object, Resource>();
+ private final HashMap<Object, Resource> iconCache = new HashMap<Object, Resource>();
FeatureGrid() {
setSizeFull();