summaryrefslogtreecommitdiffstats
path: root/documentation/articles/ChangingThemeOnTheFly.asciidoc
diff options
context:
space:
mode:
authorErik Lumme <erik@vaadin.com>2017-09-13 10:48:29 +0300
committerErik Lumme <erik@vaadin.com>2017-09-13 10:48:29 +0300
commit3455f93e28e9e90f14399fa39645f4614634a53a (patch)
tree67fa8725dc8bc7b9419efed2a7e64e2ae78a2950 /documentation/articles/ChangingThemeOnTheFly.asciidoc
parent4402f17af84e22c6487273e62ef515c6a42b9268 (diff)
downloadvaadin-framework-3455f93e28e9e90f14399fa39645f4614634a53a.tar.gz
vaadin-framework-3455f93e28e9e90f14399fa39645f4614634a53a.zip
Migrate ChangingThemeOnTheFly
Diffstat (limited to 'documentation/articles/ChangingThemeOnTheFly.asciidoc')
-rw-r--r--documentation/articles/ChangingThemeOnTheFly.asciidoc35
1 files changed, 35 insertions, 0 deletions
diff --git a/documentation/articles/ChangingThemeOnTheFly.asciidoc b/documentation/articles/ChangingThemeOnTheFly.asciidoc
new file mode 100644
index 0000000000..9f0722f383
--- /dev/null
+++ b/documentation/articles/ChangingThemeOnTheFly.asciidoc
@@ -0,0 +1,35 @@
+[[changing-theme-on-the-fly]]
+Changing theme on the fly
+-------------------------
+
+Starting from Vaadin 7.3, you can change themes in the application
+without reloading the page. To do this, simply use the
+`UI.setTheme(String)` method.
+
+[source,java]
+....
+public class ThemeChangeUI extends UI {
+
+ private String[] themes = { "valo", "reindeer", "runo", "chameleon" };
+
+ @Override
+ protected void init(VaadinRequest request) {
+ ComboBox themePicker = new ComboBox("Theme", Arrays.asList(themes));
+ themePicker.setValue(getTheme());
+
+ themePicker.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ String theme = (String) event.getProperty().getValue();
+ setTheme(theme);
+ }
+ });
+
+ setContent(themePicker);
+ }
+}
+....
+
+In this way, you can let your users choose the look of your application.
+The functionality also makes it easier to create applications that are
+branded for different customers.