Book Image

Learning Vaadin 7: Second Edition

By : Nicolas Fränkel
Book Image

Learning Vaadin 7: Second Edition

By: Nicolas Fränkel

Overview of this book

<p>Vaadin is a new Java web framework for making applications look great and perform well, making your users happy. Vaadin promises to make your user interfaces attractive and usable while easing your development efforts and boosting your productivity as a developer. Vaadin is a web framework that addresses common issues such as poor choice of controls, heterogeneity of technology stacks, page-flow paradigm, and browser compatibility.</p> <p>This book a practical guide that will help you in creating top-notch web applications with one of the best frameworks based on Java. You will learn about the fundamental concepts that are the cornerstones of the framework. Also, this book will show you how to integrate Vaadin with popular frameworks and how to run it on top of internal as well as externalized infrastructures.</p> <p>Learning Vaadin: Second Edition is a practical, step-by-step tutorial to understanding, using, and mastering the art of RIA development with Vaadin. You will learn about the fundamental concepts that are the cornerstones of the framework, at the same time as making progress on building your own web application. The book will also show you how to integrate Vaadin with other popular frameworks and how to run it on top of internal as well as externalized infrastructures.</p> <p>This book will show you how to become a professional Vaadin developer by giving you a concrete foundation through diagrams, practical examples, and ready-to-use source code. It will enable you to grasp all the notions behind Vaadin one step at a time: components, layouts, events, containers, and bindings. You will learn to build first-class web applications using best-of-breed technologies. You will find detailed information on how to integrate Vaadin's presentation layer on top of other widespread technologies, such as Spring, CDI, and Hibernate. Finally, the book will show you how to deploy on different infrastructures like JBoss Portal and Cloud Foundry.</p> <p>With this book in hand you will be able to utilize the full range of development and deployment features offered by Vaadin while thoroughly understanding the concepts.</p>
Table of Contents (18 chapters)

JavaScript wrapping


The previous section taught us about GWT widget wrapping, but what to do when there is no GWT widget available, but plain JavaScript? Do we need to first wrap the JavaScript in a custom made widget? That was the case for version 6 of Vaadin, but version 7 takes care of that.

How-to

On the server-side, there are a couple of requirements:

  1. The component class must inherit from AbstractJavaScriptComponent.

  2. It must be annotated with @Javascript. This annotation takes an array of all JavaScript files needed for value. JavaScripts can be either referenced by an absolute URL or relative to the component class. In the latter case, it is much simpler to put them in the same package as the component to avoid unnecessary hassle and directly reference them by their name (including .js extension).

  3. Finally, we also need a gwt.xml file referencing at least Vaadin default widget set. It has to be set as an init-param in the web deployment descriptor, as before.

On the client-side, a single...