VaadinEditorDevelopersGuide » History » Revision 23
Revision 22 (Andreas Kohlbecker, 03/09/2017 05:16 PM) → Revision 23/36 (Andreas Kohlbecker, 05/02/2017 03:14 PM)
# Vaadin Editors Developers Guide
This page contains all information related to developing the Vaadin based editors and UIs.
See also the [[VaadinNotes]] for general information on Vaadin.
{{>toc}}
## Development Environment Setup
### Requirements
1. Eclipse IDE: This guide assumes that you are using the Eclipse IDE. For installing and setting up eclipse, please see [[EclipsePreferencesforTeams]]
1. Maven 3: Install maven either via your packagemanegment or download it from [Maven](https://maven.apache.org/download.cgi)
1. Install the Eclipse [Jetty Integration](https://eclipse-jetty.github.io/) plugin (current version 3.9.0). Using the outdated run-jetty-run plugin (http://run-jetty-run.googlecode.com) is not recommended. If you need to use the RunJettyRun plugin for some reasonm make sure you are using version 9.0.0+ which is available via the nightly update site - http://run-jetty-run.googlecode.com/svn/trunk/updatesite-nightly. The reason for the specific version of Jetty is due to the dependency on Servlet 3.0+ API which is used in the project.
1. Vaadin Plugin for Eclipse: For details on this plugin see section [2.4.2 from the Book of Vaadin](https://vaadin.com/book/-/page/getting-started.eclipse.html). This plugin provides tools for compiling widgetsets, creating Vaadin specific objects and designing components using the included Vaadin Visual Designer.
### Setup
Get the cdm-vaadin project source code with
~~~
git clone git@dev.e-taxonomy.eu/var/git/cdm-vaadin.git
~~~
and build the project with
~~~
mvn clean install
~~~
A. If you have the [m2e eclipse plugin](https://www.eclipse.org/m2e/) installed: Import the project via `File->Import->Maven/Existing Maven Projects ...`
B. Otherwise you need to run `mvn eclipse:eclipse` and import the project into Eclipse as `File->Import->General/Existing Projects into Workspace ...`
Now you need to create the configuration files for the data sources:
1. In {home}/.cdmlibrary folder create a file cdmlib-remote.properties (if not yet exists) with an entry to a datasource e.g. cdm.datasource=testDataSource
1. In the same folder copy/create a datasources.xml with the according datasource (testDataSource) in it:
~~~xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="testDataSource" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="user" value="user"/>
<property name="password" value="password"/>
<property name="jdbcUrl" value="jdbc:mysql://localhost/testDataSource?autoReconnect=true&autoReconnectForPools=true&"/>
</bean>
</beans>
~~~
# Starting the Vaadin web app
There are various ways to start the Vaadin web app from the development environment.
Independently from the way you choose the application will run at `http://localhost:8080`. After launching check if http://localhost:8080/app-test/navi is available.
Further GUIs are available from the following endpoints:
* http://localhost:8080/app
* http://localhost:8080/app/editstatus
* http://localhost:8080/app/distribution
* http://localhost:8080/app/concept
## SuperDev Mode
The Book of Vaadin describes the SuperDev mode in chapter 14.6.1. The wiki page [Using SuperDevMode](https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode) is also an valuable source of information.
The SuperDev mode is per default disabled in src/main/java/eu/etaxonomy/cdm/vaadin/AppWidgetSet.gwt.xml`:
~~~xml
<!--
SuperDev mode is enabled default starting with GWT 2.6.0
For more information and instructions see:
https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode
-->
<set-configuration-property name="devModeRedirectEnabled" value="false" />
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
~~~
Once it is enabled the vaadin application requires also the Vaadin code server to run which listens per default at port `9876`
## Launch via Eclipse launchers
If the vaadin project is correctly set up a launcher configuration should be available which is named *cdm-vaadin - run*. If it is missing try to fix the *Resource* configuration in the project setting.
Please refer to [[EclipseLauncherConfigurations]] for **further required preparation steps** for using these launchers.
As last resort you can also import the cdm-vaadin jetty launch configuration in Eclipse by selecting File->Import->Launch Configurations and choosing the cdm-vaadin.launch file in the ide/eclipse directory (*not recommended!*).
Setting details of the launch configuration
* Tab Webapp
* Name: `cdm-vaadin - run`
* Project: `vaadin project`
* WebApp folder: `src/main/webapp`
* HTTP/HTTPS port: `8080`
* Tab Dependencies (only the following check boxes are active)
* Compile Scope `[x]`
* Runtime Scope `[x]`
* Test Scope `[x]`
### Auto Login
The `LoginPresenter` class offers a auto login feature for developers. To activate the auto login you need to provide the user name and password using the environment variables `cdm-vaadin.login.usr` and `cdm-vaadin.login.pwd`, e.g.:
~~~
-Dcdm-vaadin.login.usr=admin -Dcdm-vaadin.login.pwd=00000
~~~
### SuperDev Mode
No prepared launcher available **TODO**
## Launch via the Maven Jetty plugin
Start the Vaadin application:
~~~
mvn jetty:run
~~~
### SuperDev Mode
Start the code server for the SuperDev mode
~~~
mvn vaadin:run-codeserver
~~~
The command
~~~
mvn vaadin:run
~~~
also starts the code server. As of the documentation `mvn vaadin:help` this should start the widget in Hosted Mode but only the Code Server seems to be running.