VaadinNotes » History » Revision 26
« Previous |
Revision 26/125
(diff)
| Next »
Cherian Mathew, 12/03/2014 01:29 PM
Vaadin Development Resources¶
Vaadin is an open source Web application framework for rich Internet applications. In contrast to JavaScript libraries and browser-plugin based solutions, it features a server-side architecture, which means that the majority of the logic runs on the servers. Ajax technology is used at the browser-side to ensure a rich and interactive user experience. On the client-side Vaadin is built on top of and can be extended with Google Web Toolkit.
This page holds information and resources for developing with the GWT-based Vaadin-Framework. For general information to this framework see: https://vaadin.com/faq
(quoted from Wikipedia:https://en.wikipedia.org/wiki/Vaadin, the free encyclopedia)
- Table of contents
- Vaadin Development Resources
General Structure of Vaadin¶
The Vaadin architecture can be split very roughly into client and server side.
The server side holds all the business logic and services as well as the standard java vaadin components, which will be translated into JavaScript later on.
The client side incorporates the GWT-part as well as client side specific JavaScript code, to do some more dynamic manipulation on the browser side.
All Vaadin Components are written in plain Java. There is no need to program in JavaScript or even HTML. This all will be compiled by the framework. See the next section for supported browsers.
Browser compatibility¶
Vaadin 7 supports the following browsers:
Android 2.3 or newer
Google Chrome 23 or newer
Internet Explorer 8 or newer
iOS 5,6,7 or newer
Mozilla Firefox 17 or newer
Opera 12 or newer
Safari 6 or newer
NOTE: From release 7.2+ all permutations have been merged into a single one - refer #13274
Getting Started¶
To start with you will need to install the Eclipse IDE. Currently, the versions of Eclipse tested with this setup include :
- Eclipse 4.4.1 Luna
You will also need to install Maven 3.x.x
Since we will be using Jetty to run the project as web appplication, you will also need to install RunJettyRun plugin for Eclipse (specifically version 9.0.0+ which is available via the nightly update site - http://run-jetty-run.googlecode.com/svn/trunk/updatesite-nightly)
The next step is to install the Vaadin Plugin for Eclipse - section 2.4.2 from the Book of Vaadin. This plugin provides tools for compiling widgetsets, creating Vaadin specific objects and designing components using the included Vaadin Visual Designer.
Checkout the cdm-vaadin project with
svn co http://dev.e-taxonomy.eu/svn/trunk/cdm-vaadin
and build the project with
mvn clean install
Vaadin specific maven goals include,
vaadin:clean vaadin:resources vaadin:update-theme vaadin:update-widgetset vaadin:compile-theme vaadin:compile
cdm-vaadin project¶
The cdm-vaadin project is a stand-alone war Eclipse / Maven project, which includes cdmlib dependencies allowing it to function as a full-fledged web application. This allows for testing the vaadin framework with the cdmlib. This project itself is not a target for deployment as a webapp, but is integrated into the cdmlib-remote-webapp project as described below.
cdm-vaadin project integration with the cdmlib-remote-webapp¶
Vaadin & Maven¶
After you built your project with
mvn clean install
and
mvn eclipse:eclipse
it is necessary to compile the vaadin specific part of the project with
mvn vaadin:compile
This will download all vaadin specific libraries and also compile a widgetset, which will be needed to render client-side components.
If you are in development and want to extend the standard widgetset you need to force to re-compile your widgetset. This can be done by specifically call
mvn vaadin:widgetset-update
Vaadin & Eclipse¶
The developers from the Vaadin Framework made a plug-in for eclipse available, that enables graphical manipulations of components, respectively to build a UI from different components, create new widgets or manipulate the widget-set itself.
Go to Help -> Install New Software and paste the following URL into the Work with: field
http://vaadin.com/eclipse/
Check the plugin, restart Eclipse and you are good to go.
Vaadin & Spring¶
To connect the spring framework with Vaadin, we use the SpringVaadinIntegration plug-in by Alexander Fedorov https://vaadin.com/directory#addon/springvaadinintegration:vaadin. It enables the following features
Spring Framework integration
No AOP dependencies!
Spring scopes for UI: prototype, session, singleton
Vaadin's Views Autowiring
Vaadin's Views caching
Vaadin's SystemMessages customization
and more. It is a very simple a approach, to connect the two frameworks by using a servlet, which hands over the applicationContext of the spring application.
web.xml | +-- ContextLoaderListener | | | +-- applicationContext.xml <-----+ | | | | +-- Hibernate SessionFactory | | | | | +-- DAO beans parent | | | | +-- Whatever other beans | | | +-- DispatcherServlet | | | +-- dispatcher-servlet.xml >-----+ | +-- ServletWrappingController | | | +-- AutowiringApplicationServlet | | | +-- MyApplication | +-- SimpleUrlHandlerMapping | +-- Whatever other beans
The ContextLoaderListener is a servlet context listener that associates a
Spring application context with your servlet context and makes it accessible
to other Spring classes. Typically this is defined via an applicationContext.xml
file that sits in WEB-INF.
The RequestContextListener is a servlet filter that, at the start of each
request, stuffs a reference to the request object etc. in a private ThreadLocal
variable so that other Spring classes that want to answer the question "what is
the current HTTP request associated with this thread?" can get the answer to that
question by invoking the appropriate static method.
The DispatcherServlet is a regular Java servlet that Spring provides. Each
such servlet has its own Spring application context - distinct from, though a "child"
of, the one mentioned above associated with the ContextLoaderListener. If your servlet
is named foobar then the default XML file name is foobar-servlet.xml.
The autowiring of your Vaadin application using the AutowiringApplicationServlet can be done
at either level, i.e., using the ContextLoaderListener context or using the DispatcherServlet context.
Vaadin Project¶
Creating a server-side UI¶
Normally, you need to:
extend the UI class
build an initial UI from components
define event listeners to implement the UI logic
Optionally, you can also:
set a custom theme for the UI
bind components to data
bind components to resources
Vaadin Components¶
Vaadin AddOn's¶
The official Vaadin website hosts a directory of all available AddOn's http://vaadin.com/directory.
In order to add an extension to your project add the maven dependencies to your pom file and run
mvn eclipse:eclipse
the needed libraries will be downloaded. Check if the libraries are added in you IDE specific dependency tree. Sometimes it can be necessary to clean the whole project and build it again with
mvn clean install
Conventions & Policies¶
Vaadin Security¶
Updated by Cherian Mathew over 9 years ago · 26 revisions