diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-13 11:24:41 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-13 11:24:41 +0100 |
commit | 09c4b4be9ec33bac7d814dbeb28095a7a7add835 (patch) | |
tree | 4bfda9a01916a45aa0dcc8b91305956fe75508bc /java/vaadin/src/main | |
parent | 7b2889665d790585f4e1e0ac5c215359240a8d33 (diff) | |
download | share-09c4b4be9ec33bac7d814dbeb28095a7a7add835.zip share-09c4b4be9ec33bac7d814dbeb28095a7a7add835.tar.gz |
java : vaadin : add theme support
Diffstat (limited to 'java/vaadin/src/main')
-rw-r--r-- | java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png | bin | 0 -> 1783 bytes | |||
-rw-r--r-- | java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/mytheme.scss | 15 | ||||
-rw-r--r-- | java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/styles.scss | 4 | ||||
-rw-r--r-- | java/vaadin/src/main/java/ch/asynk/HelloWorld.java | 11 |
4 files changed, 26 insertions, 4 deletions
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 Binary files differnew file mode 100644 index 0000000..7362322 --- /dev/null +++ b/java/vaadin/src/main/WebContent/VAADIN/themes/mytheme/icons/home.png 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); } } |