diff options
Diffstat (limited to 'java/vaadin/src')
-rw-r--r-- | java/vaadin/src/main/WebContent/WEB-INF/web.xml | 45 | ||||
-rw-r--r-- | java/vaadin/src/main/java/ch/asynk/HelloWorld.java | 34 |
2 files changed, 79 insertions, 0 deletions
diff --git a/java/vaadin/src/main/WebContent/WEB-INF/web.xml b/java/vaadin/src/main/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..f4b7f85 --- /dev/null +++ b/java/vaadin/src/main/WebContent/WEB-INF/web.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app id="HelloWorld" version="3.0" + xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> + + <display-name>Hello World Vaadin</display-name> + <description> + Hello World in Vaadin + </description> + + <context-param> + <description>Vaadin production mode</description> + <param-name>productionMode</param-name> + <param-value>false</param-value> + </context-param> + + <session-config> + <session-timeout>60</session-timeout> + <!-- <tracking-mode>COOKIE</tracking-mode> --> + </session-config> + + <servlet> + <servlet-name>default</servlet-name> + <servlet-class>com.vaadin.server.VaadinServlet</servlet-class> + <init-param> + <description>Vaadin application class to start</description> + <param-name>UI</param-name> + <param-value>ch.asynk.HelloWorld</param-value> + </init-param> + <async-supported>true</async-supported> + </servlet> + <servlet-mapping> + <servlet-name>default</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> + + <!-- <welcome-file-list> --> + <!-- <welcome-file>index.html</welcome-file> --> + <!-- <welcome-file>index.htm</welcome-file> --> + <!-- <welcome-file>index.jsp</welcome-file> --> + <!-- <welcome-file>default.html</welcome-file> --> + <!-- <welcome-file>default.htm</welcome-file> --> + <!-- <welcome-file>default.jsp</welcome-file> --> + <!-- </welcome-file-list> --> +</web-app> diff --git a/java/vaadin/src/main/java/ch/asynk/HelloWorld.java b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java new file mode 100644 index 0000000..65ef27d --- /dev/null +++ b/java/vaadin/src/main/java/ch/asynk/HelloWorld.java @@ -0,0 +1,34 @@ +package ch.asynk; + +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.Title; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.Notification; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +@Title("Hello!!") +@Theme("valo") +public class HelloWorld extends UI +{ + private static final long serialVersionUID = 511085335415683713L; + @Override + protected void init(VaadinRequest request) + { + VerticalLayout content = new VerticalLayout(); + setContent(content); + + content.addComponent(new Label("Hello World!")); + content.addComponent(new Button("Push Me!", new ClickListener() { + private static final long serialVersionUID = 5808429544582385114L; + @Override + public void buttonClick(ClickEvent event) { + Notification.show("Pushed!"); + } + })); + } +} |