summaryrefslogtreecommitdiffstats
path: root/java/vaadin
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-03-13 00:38:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2017-03-13 00:38:54 +0100
commit4c2590c4566478a81d4d26e824f9c2db37ba157b (patch)
treec40047576c99fdd1b57925dd5cf2bd5a44b19086 /java/vaadin
parent118b98b5936e420af72bc2534d45c5bdedc50a35 (diff)
downloadshare-4c2590c4566478a81d4d26e824f9c2db37ba157b.zip
share-4c2590c4566478a81d4d26e824f9c2db37ba157b.tar.gz
java : vaadin : simple Hello World
Diffstat (limited to 'java/vaadin')
-rw-r--r--java/vaadin/Application.properties3
-rw-r--r--java/vaadin/build.xml139
-rw-r--r--java/vaadin/ivy.xml20
-rw-r--r--java/vaadin/ivysettings.xml22
-rw-r--r--java/vaadin/src/main/WebContent/WEB-INF/web.xml45
-rw-r--r--java/vaadin/src/main/java/ch/asynk/HelloWorld.java34
-rw-r--r--java/vaadin/tomcat.properties4
7 files changed, 267 insertions, 0 deletions
diff --git a/java/vaadin/Application.properties b/java/vaadin/Application.properties
new file mode 100644
index 0000000..193ca7f
--- /dev/null
+++ b/java/vaadin/Application.properties
@@ -0,0 +1,3 @@
+app.name=VaadinHelloWorld
+app.version=0.0.1
+app.path=/hello
diff --git a/java/vaadin/build.xml b/java/vaadin/build.xml
new file mode 100644
index 0000000..6702c7a
--- /dev/null
+++ b/java/vaadin/build.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:ivy="antlib:org.apache.ivy.ant"
+ name="My Vaadin Hello World"
+ basedir="."
+ default="package-war">
+
+ <target name="configure">
+ <property file="${basedir}/Application.properties"/>
+
+ <property name="main.dir" value="${basedir}/src/main" />
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="dist.dir" value="${basedir}/dist"/>
+
+ <property name="src.dir" value="${main.dir}/java" />
+ <property name="web.dir" value="${main.dir}/WebContent"/>
+ <property name="classes.dir" value="${build.dir}/WEB-INF/classes"/>
+ <property name="lib.dir" value="${build.dir}/WEB-INF/lib"/>
+
+ <property name="war.name" value="${app.name}-${app.version}.war"/>
+
+ <property name="compile.debug" value="true"/>
+ <property name="compile.deprecation" value="false"/>
+ <property name="compile.optimize" value="true"/>
+
+ <property file="${basedir}/tomcat.properties"/>
+ <path id="cp.tomcat">
+ <fileset dir="${catalina.home}/bin">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${catalina.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <taskdef classpathref="cp.tomcat" resource="org/apache/catalina/ant/catalina.tasks" />
+ </target>
+
+
+ <target name="resolve" description="retrieve dependencies with Ivy">
+ <ivy:resolve file="ivy.xml" log="download-only"/>
+ <ivy:cachepath pathid="ivy.deps.server-side" conf="server-side" />
+ <ivy:cachefileset setid="ivy.deps.server-side.fileset" conf="server-side"/>
+ </target>
+
+ <target name="ivy-report" depends="configure,resolve">
+ <ivy:report conf="default" organisation="ch.asynk" module="${app.name}"/>
+ </target>
+
+ <target name="clean" depends="configure" description="clean project">
+ <delete dir="${build.dir}" />
+ <delete dir="${dist.dir}" />
+ <delete file="build.log" />
+ <delete file="test.log" />
+ <delete file="ivy-report.css" />
+ <delete>
+ <fileset dir="${basedir}" includes="ch.asynk-${app.name}-*"/>
+ </delete>
+ </target>
+
+ <target name="ctags" depends="configure">
+ <exec executable="ctags" failonerror="false">
+ <arg value="-R"/>
+ <arg value="--language-force=java"/>
+ <arg value="-f.tags"/>
+ <arg value="${src.dir}"/>
+ </exec>
+ </target>
+
+ <target name="compile-server-side" depends="configure,resolve,ctags">
+ <record name="build.log" loglevel="verbose" action="start" />
+ <mkdir dir="${classes.dir}" />
+ <javac srcdir="${main.dir}"
+ destdir="${classes.dir}"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ includeantruntime="false">
+ <classpath refid="ivy.deps.server-side"/>
+ <compilerarg value="-Xlint:all"/>
+ <compilerarg value="-Xlint:-path"/>
+ <compilerarg value="-Xlint:-processing"/>
+ <compilerarg value="-Xmaxerrs"/>
+ <compilerarg value="10"/>
+ </javac>
+ </target>
+
+ <target name="package-war" depends="compile-server-side">
+ <mkdir dir="${lib.dir}"/>
+ <copy todir="${lib.dir}" flatten="true">
+ <fileset refid="ivy.deps.server-side.fileset"/>
+ </copy>
+ <delete>
+ <fileset dir="${lib.dir}">
+ <include name="**/*-sources.jar"/>
+ <include name="**/*-javadoc.jar"/>
+ </fileset>
+ </delete>
+
+ <delete file="${dist.dir}/${war.name}"/>
+ <war destfile="${dist.dir}/${war.name}"
+ webxml="${web.dir}/WEB-INF/web.xml">
+ <classes dir="${classes.dir}" includes="**" />
+ <fileset dir="${web.dir}">
+ <patternset>
+ <include name="images/**/*" />
+ <include name="VAADIN/widgetsets/**/*" />
+ <include name="*.html" />
+ <include name="WEB-INF/lib/*" />
+ <include name="WEB-INF/*.xml" />
+ </patternset>
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="WEB-INF/lib/*" />
+ <include name="VAADIN/themes/**/*" />
+ </fileset>
+ </war>
+ </target>
+
+ <!-- tomcat specific targets -->
+
+ <target name="remove" description="Remove application on servlet container">
+ <undeploy url="${manager.url}"
+ username="${manager.username}"
+ password="${manager.password}"
+ path="${app.path}"
+ failonerror="false"/>
+ </target>
+
+
+ <target name="install" depends="package-war,remove" description="Install application to servlet container">
+ <copy todir="/tmp" file="${dist.dir}/${war.name}"/>
+ <deploy url="${manager.url}"
+ username="${manager.username}"
+ password="${manager.password}"
+ path="${app.path}"
+ localWar="file://tmp/${war.name}"/>
+ <delete file="/tmp/${war.name}"/>
+ </target>
+
+</project>
diff --git a/java/vaadin/ivy.xml b/java/vaadin/ivy.xml
new file mode 100644
index 0000000..033e347
--- /dev/null
+++ b/java/vaadin/ivy.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE ivy-module [
+<!ENTITY vaadin.version "7.7.7">
+]>
+<ivy-module version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+ <info organisation="ch.asynk" module="VaadinHelloWorld" />
+
+ <configurations>
+ <conf name="server-side" description="only needed for server side classes compilation"/>
+ </configurations>
+
+ <dependencies defaultconf="server-side" defaultconfmapping="server-side->default">
+ <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;"/>
+ <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;"/>
+ <dependency org="com.vaadin" name="vaadin-client-compiled" rev="&vaadin.version;"/>
+ </dependencies>
+</ivy-module>
diff --git a/java/vaadin/ivysettings.xml b/java/vaadin/ivysettings.xml
new file mode 100644
index 0000000..e5fc415
--- /dev/null
+++ b/java/vaadin/ivysettings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivysettings>
+ <settings defaultResolver="default" />
+ <!-- <caches defaultCacheDir="${basedir}/lib" /> -->
+ <!-- <caches default="mine" defaultCacheDir="${basedir}/ivy"> -->
+ <!-- <cache name="mine" basedir="${basedir}/ivy" /> -->
+ <!-- </caches> -->
+ <resolvers>
+ <chain name="default">
+ <ibiblio name="maven2" m2compatible="true"/>
+ <ibiblio name="maven" m2compatible="true" usepoms="false"/>
+ <!-- <ibiblio name="vaadin-addons" usepoms="true" m2compatible="true" -->
+ <!-- root="http://maven.vaadin.com/vaadin-addons" /> -->
+ <!-- <ibiblio name="vaadin-prereleases" usepoms="true" m2compatible="true" -->
+ <!-- root="http://maven.vaadin.com/vaadin-prereleases" /> -->
+ <filesystem name="local">
+ <ivy pattern="${user.home}/ivy-local/[revision]/[module]/ivy-[revision].xml"/>
+ <artifact pattern="${user.home}/ivy-local/[revision]/[module]/[module]-[revision](-[classifier]).[ext]"/>
+ </filesystem>
+ </chain>
+ </resolvers>
+</ivysettings>
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!");
+ }
+ }));
+ }
+}
diff --git a/java/vaadin/tomcat.properties b/java/vaadin/tomcat.properties
new file mode 100644
index 0000000..7ec1b73
--- /dev/null
+++ b/java/vaadin/tomcat.properties
@@ -0,0 +1,4 @@
+manager.username=manager
+manager.password=h46bh2j0
+manager.url=http://127.0.0.1:8080/manager/text
+catalina.home=/usr/share/tomcat7