Vaadin 7 Cookbook
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Covers exciting features such as using drag and drop, creating charts, custom components, lazy loading, server-push functionality, and more
  • Tips for facilitating the development and testing of Vaadin applications
  • Enhance your applications with Spring, Grails, or Roo integration

Book Details

Language : English
Paperback : 404 pages [ 235mm x 191mm ]
Release Date : April 2013
ISBN : 1849518807
ISBN 13 : 9781849518802
Author(s) : Jaroslav Holaň, Ondřej Kvasnovský
Topics and Technologies : All Books, Web Development, Cookbooks, Open Source

Table of Contents

Chapter 1: Creating a Project in Vaadin
Chapter 2: Layouts
Chapter 3: UI Components
Chapter 4: Custom Widgets
Chapter 5: Events
Chapter 6: Messages
Chapter 7: Working with Forms
Chapter 8: Spring and Grails Integration
Chapter 9: Data Management
Chapter 10: Architecture and Performance
Chapter 11: Facilitating Development
Chapter 12: Fun
  • Chapter 1: Creating a Project in Vaadin
    • Introduction
    • Creating a project in Eclipse IDE
    • Generating a Vaadin project in Maven archetype
    • Building a Vaadin application with Gradle
    • Using Vaadin with Scala
    • Running Vaadin on Grails
    • Chapter 2: Layouts
      • Introduction
      • Creating an adjustable layout using split panels
      • Creating a custom layout
      • Controlling components over the CSS layout
      • Using CSS layouts for mobile devices
      • Binding tabs with a hard URL
      • Using Navigator for creating bookmarkable applications with back-forward button support
      • Aligning components on a page
      • Creating UI collections of components
      • Dragging-and-dropping between different layouts
      • Building any layout with AbsoluteLayout
      • Chapter 3: UI Components
        • Introduction
        • Viewing details of items in ListSelect
        • Inserting a button to remove a table row
        • Creating a line chart with Flot
        • Creating a pie chart with Highcharts
        • Drag-and-drop from the desktop
        • Using DateField with Joda-Time DateTime
        • Zooming with the slider
        • Restricting buttons in Rich text area
        • Styling components with CSS
        • Chapter 4: Custom Widgets
          • Introduction
          • Creating a TextField with counter
          • Creating a TextField only for digits
          • Creating a chroma-hash password field
          • Creating a tri-state checkbox using JavaScript
          • Styling widgets
          • Speeding up widget set compilation
          • Chapter 5: Events
            • Introduction
            • Responding immediately to an event in TextArea
            • Changing Label to TextField by double-clicking
            • Lazy loading in a table
            • Reordering columns and rows in a table
            • Customizing shortcuts
            • Adding click listener to the Link component
            • Creating a custom context menu
            • Updating messages in the menu bar using the ICEPush add-on
            • Updating the noticeboard using the Refresher add-on
            • Chapter 6: Messages
              • Introduction
              • Showing validation messages
              • Styling system messages
              • Showing a login form in pop-up view
              • Customizing tray notifications
              • Making a confirmation window
              • Showing a rich tooltip with an image
              • Informing about file transfers by a progress bar
              • Waiting for an indeterminate process
              • Showing information about browsers
              • Chapter 7: Working with Forms
                • Introduction
                • Creating a simple form
                • Generating fields from a bean
                • Binding fields to a bean
                • Using field validation
                • Using bean validation
                • Creating a custom validation
                • Creating a CRUD form
                • Filtering items using ComboBox
                • Chapter 8: Spring and Grails Integration
                  • Introduction
                  • Setting up a Vaadin project with Spring in Maven
                  • Handling login with Spring
                  • Accessing a database with Spring
                  • Internationalizing Vaadin applications with Spring
                  • Vaadin and Spring injector
                  • Internationalizing Vaadin in Grails
                  • Using Grails ORM for Vaadin application
                  • Using Grails services in Vaadin
                  • Adding a Vaadin add-on into Grails project
                  • Chapter 9: Data Management
                    • Introduction
                    • Binding property to a component
                    • Binding items to a component
                    • Binding a container to a component
                    • Creating a complex table – CRUD II
                    • Filtering data in the table
                    • Using converters
                    • Storing the last selected tab name in cookies
                    • Chapter 10: Architecture and Performance
                      • Introduction
                      • Building the core
                      • The Login form with Model View Presenter
                      • Model View Presenter for a view with two panels
                      • Unit testing in an MVP pattern
                      • Improving the application's startup time
                      • Avoid sluggish UI – lazy loaded tables
                      • Avoid sluggish UI – paged tables
                      • Optimizing Vaadin applications for search engines
                      • Chapter 11: Facilitating Development
                        • Introduction
                        • The basics of test-driven development in Vaadin
                        • The basics of mocking in Vaadin
                        • Testing a table with a container
                        • Testing the UI with TestBench
                        • Recompiling widgetsets in Maven
                        • Auto-reloading changes in Maven
                        • Blocking uncaught exceptions in the production mode
                        • Chapter 12: Fun
                          • Introduction
                          • Magic tricks
                          • Can you raed tihs?
                          • Goodbye, world!

                          Jaroslav Holaň

                          Jaroslav Holaň is a skilled and creative Sun Certified Java Programmer. His main focus of interest is on frontend applications. He has experience with web technologies such as Vaadin, GWT, Rich Faces, JSF, and has also created desktop applications in Eclipse SWT and JFace. He has worked on various software projects, ranging from banking systems to mobile applications. He is mainly focused on Java, but is open to other languages and technologies. When he's not programming, he's dealing with magic tricks. You can find him on

                          Ondřej Kvasnovský

                          Ondřej Kvasnovský is currently working as a Senior Java Developer in pricing the business for an American company, Vendavo. Ondrej has spent six years in a large international company working mainly for the banking industry in Scandinavia as a Java Programmer, Project Manager, and Manager. Ondrej's biggest free time interest is working on the Grails plugin for Vaadin (see and participation on projects using the Vaadin and Grails frameworks. He, together with other people, is taking care of the organization of the Java User Group in Ostrava, Czech Republic. Ondrej can be found on LinkedIn at, his public projects on Github can be found at, and his blog on
                          Sorry, we don't have any reviews for this title yet.

                          Code Downloads

                          Download the code and support files for this book.

                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                          - 1 submitted: last submission 02 Aug 2013

                          Errata type: Typo | Page number: 43 | Errata date: 20 May 2013

                          In the sentence "The first view will be the welcome view, which we map to an empty URL fragment, so it becomes accessible at http://localhost:8080 address." The word "address" should be ignored.  

                          Errata type: Code | Page number: 30 | Errata date: 04 June 2013

                          The following two lines are indented too far to the right, so that they appear to be nested when they are not: editorPanel.setSplitPosition(80, Unit.PERCENTAGE); return editorPane;  

                          Errata type: Code | Page number: 42 | Errata date: 04 June 2013

                          UUI.getCurrent().getPage() should be UI.getCurrent().getPage() String name = convertNameToFrament should be String name = convertNameToFragment  

                          Errata type: Code | Page number: 343 | Errata date: 05 June 2013

                          The text states that status method returns the hardcoded string "Online". This should instead return "Offline".    

                          Errata type: Typo | Page number: 56 | Errata date: 05 June 2013

                          In the sentence: "In some cases we can use it for special layouts as mentioned with CicrleLayout." The word "CicrleLayout" should be "CircleLayout".  

                          Errata type: Code | Page number: 61 | Errata date: 05 June 2013

                          In bullet #8, the letters "ne" are missing from the word "new" as follows: BeanItemContainer contacts = w BeanItemContainer<>(Contact.class); should be BeanItemContainer contacts = new BeanItemContainer<>(Contact.class);

                          Errata type: Code | Page number: 65-66 | Errata date: 05 June 2013

                          The generateCell(...) method will not compile as written. Specifically, the parameter "source" should be declared as final, and the line: table.removeItem(itemId); should be source.removeItem(itemId);

                          Errata type: Code | Page number: 88 | Errata date: 05 June 2013

                          In order to work with the stylesheets defined in subsequent steps, the following line in bullet #2: BeanItemContainer richTextArea.setStyleName("myRichTextArea"); should be richTextArea.setStyleName("my");

                          Errata type: Code | Page number: 92 | Errata date: 07 June 2013

                          In step #2 (beginning on page 91), the following line will not compile: addComponent(table);: Changing it as follows will run it: setContent(table);  

                          Errata type: Code | Page number: 105 | Errata date: 07 June 2013

                          In the code for step #9, IntegerTextField is shown to extend com.vaadin.ui.AbstractComponent. If the reader has correctly followed the instructions to create the component, the class will be extending com.vaadin.ui.TextField instead.  

                          Errata type: Code | Page number: 123 | Errata date: 07 June 2013

                          Step #7, given as: layout.addComponent(textArea); layout.addComponent(saveButton); should be addComponent(textArea); addComponent(saveButton);

                          Errata type: Typo| Page number: 131 | Errata date: 07 June 2013

                          In the first getAcceptiCriterion() method, should be In the first getAcceptCriterion() method,

                          Errata type: Typo | Page number: 153 | Errata date: 11 June 2013

                          Although written correctly in the text, the hyperlink to Matti's blog entry in the "See also" section is broken in the PDF. The referenced article is at: The hyperlink takes you to: (Missing the final dash). Please note this while using the URL.  

                          Errata type: Code | Page number: 307 | Errata date: 18 June 2013

                          In step #9, the definition of method getTxtTagName() should have the @Override annotation.  

                          Errata type: Code | Page number:60 | Errata date; 23 July 2013

                          In the following, "Then we create our main component contactSelect that is an instance of the SelectList class." SelectList class should be ListSelect class.


                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          Vaadin 7 Cookbook +    Haskell Data Analysis Cookbook =
                          50% Off
                          the second eBook
                          Price for both: $43.05

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • Develop a Rich Internet Application in pure Java language
                          • Create a Vaadin project in different IDEs and platforms
                          • Explore the new Vaadin 7 features such as Extensions, URI fragments, Converter mechanism, and more
                          • Understand and use different types of layouts
                          • Use build-in atomic components such as button, table, text field, and more
                          • Bind model to components and fetch data from the database lazily
                          • Work with listeners and events and improve your web application by adding server-push add-ons
                          • Integrate Vaadin into the Grails framework

                          In Detail

                          It is really expensive and demanding to develop Rich Internet Applications from scratch. Vaadin is an amazing framework that contains many ready-made components for the creation of user interfaces. Applications created in Vaadin are compatible with all the latest versions of web browsers. Although the screenshots in this book are from Chrome, examples can also run on other browsers like Firefox Mozilla, Internet Explorer, and Opera.

                          Vaadin 7 Cookbook contains many practical recipes that we have gathered during the development of Vaadin applications. This book will help you to take your learning experience to the next level by giving you many solutions to the common problems faced along with explanations. There is even more than that. Vaadin 7 Cookbook goes beyond the basics and shows you how to build Vaadin application for real-world scenarios.

                          Vaadin 7 Cookbook starts with the creation of a project in various tools and languages then moves to components, layouting, events, data binding, and custom widgets. Vaadin, together with Grails, is a powerful tool for the rapid development of RIA applications and this is described in a chapter on how to work with GORM, Service, compiling a widgetset. The quality and stability of the application, testing the Vaadin code, and data management of Vaadin is also explained in detail.

                          Vaadin 7 Cookbook is focused on learning and understanding how to work with Vaadin as well as trying out Vaadin with other technologies such as Grails.


                          This is a cookbook with easy-to-follow recipes containing practical and detailed examples which are all fully backed up with code, illustrations, and tips.

                          Who this book is for

                          "Vaadin 7 Cookbook" is for developers who want to create Rich Internet Applications with Vaadin.

                          Both newcomers to Vaadin and those who have some experience with it will find recipes to expand their working knowledge of Vaadin.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software