From 09c4b4be9ec33bac7d814dbeb28095a7a7add835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 13 Mar 2017 11:24:41 +0100 Subject: java : vaadin : add theme support --- java/vaadin/build.xml | 38 +++++++++++++++++---- java/vaadin/ivy.xml | 2 ++ .../VAADIN/themes/mytheme/icons/home.png | Bin 0 -> 1783 bytes .../WebContent/VAADIN/themes/mytheme/mytheme.scss | 15 ++++++++ .../WebContent/VAADIN/themes/mytheme/styles.scss | 4 +++ java/vaadin/src/main/java/ch/asynk/HelloWorld.java | 11 +++--- 6 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png create mode 100644 java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/mytheme.scss create mode 100644 java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/styles.scss diff --git a/java/vaadin/build.xml b/java/vaadin/build.xml index 5d9da2f..b1ee9f4 100644 --- a/java/vaadin/build.xml +++ b/java/vaadin/build.xml @@ -39,6 +39,7 @@ + @@ -66,7 +67,28 @@ - + + + + + + + + + + + + + + + + + + + + + + - + + + @@ -105,11 +129,13 @@ - - + + + + @@ -121,7 +147,7 @@ - + - + + @@ -18,5 +19,6 @@ + diff --git a/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png new file mode 100644 index 0000000..7362322 Binary files /dev/null and b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png differ diff --git a/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/mytheme.scss b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/mytheme.scss new file mode 100644 index 0000000..f1c36c3 --- /dev/null +++ b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/mytheme.scss @@ -0,0 +1,15 @@ + +@import "../valo/valo.scss"; + +@mixin mytheme { + @include valo; + + .v-app { + background-color: #e6e6e9; + } + .v-button { + color: #ff6660; + background-image: none; + background-color: #eee666; + } +} diff --git a/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/styles.scss b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/styles.scss new file mode 100644 index 0000000..447ce98 --- /dev/null +++ b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/styles.scss @@ -0,0 +1,4 @@ +@import "mytheme.scss"; +.mytheme { + @include mytheme; +} diff --git a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java index e811599..f15bddd 100644 --- a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java +++ b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java @@ -3,6 +3,7 @@ package ch.asynk; import com.vaadin.annotations.Theme; import com.vaadin.annotations.Title; import com.vaadin.server.VaadinRequest; +import com.vaadin.server.ThemeResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -15,7 +16,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Title("Hello!!") -@Theme("valo") +@Theme("mytheme") public class HelloWorld extends UI { private static final long serialVersionUID = 511085335415683713L; @@ -28,8 +29,9 @@ public class HelloWorld extends UI VerticalLayout content = new VerticalLayout(); setContent(content); - content.addComponent(new Label("Hello World!")); - content.addComponent(new Button("Push Me!", new ClickListener() { + content.addComponent(new Label("Hello World using mytheme")); + Button btn = new Button("Push Me!", new ThemeResource("icons/home.png")); + btn.addClickListener(new ClickListener() { private static final long serialVersionUID = 5808429544582385114L; @Override public void buttonClick(ClickEvent event) { @@ -42,6 +44,7 @@ public class HelloWorld extends UI logger.warn("warn"); logger.error("error"); } - })); + }); + content.addComponent(btn); } } -- cgit v1.1-2-g2b99