Vaadin 7 UI Design By Example Beginner's Guide Build exciting Vaadin applications in no time Alejandro Duarte BIRMINGHAM - MUMBAI Vaadin 7 UI Design By Example Beginner's Guide Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2013 Production Reference: 1190713 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78216-226-1 www.packtpub.com Cover Image by Jarek Blaminsky ([email protected]) Credits Author Project Coordinator Alejandro Duarte Shiksha Chaturvedi Reviewers Proofreader Martin Cremer Mario Cecere Max Matveev Indexer Henri Muurimaa Monica Ajmera Mehta Michael Vogt Graphics Acquisition Editor Ronak Dhruv Martin Bell Production Coordinators Lead Technical Editor Arvindkumar Gupta Arun Nadar Kirtee Singhan Technical Editors Cover Work Mrunmayee Patil Arvindkumar Gupta Pragati Singh Hardik B. Soni About the Author Alejandro Duarte learned how to program at age 13 using the Basic language on a black screen with a blinking cursor. He used to spend hours thinking of ideas for software that would be good to have and even more hours bringing these ideas to life. Alejandro graduated from National University of Colombia with a BS in Computer Science and has been involved in many Java-related software development projects. He first started working with Struts 2 and quickly switched to more RIA friendly frameworks such as Grails, jQuery, GWT, and Vaadin. Alejandro is the author of the Enterprise App for Vaadin add-on and InfoDoc Pro, both open source projects based on the Vaadin framework. He currently works as a developer for several companies and customers mainly in Colombia, Chile, India, Kenya, and the UK. When not writing code, Alejandro splits his free time between his family, his beautiful girlfriend, and his passion for the electric guitar. You can contact him at [email protected] or through his personal blog http://www.alejandrodu.com. If you are feeling social, you can follow him on Twitter at @alejandro_du. Acknowledgement I would like to thank the entire team from Packt Publishing, Ashvini, Martin, Shiksha, and Arun, thanks for trusting me. I thank all the technical reviewers and proofreaders for providing me with valuable feedback from which I have learned a lot. Thanks to Mario Pérez and Camilo Gonzáles from National University of Colombia for introducing me as a professional to the world of software development. Thanks to Colombitrade and all Enterprise App for Vaadin users for their support and confidence. A special thanks to the Vaadin team and community for providing such a terrific framework and knowledge base with tons of articles and useful resources. Hope this book reciprocally contributes back to the community. I can't thank my parents enough for being so helpful and supportive. I would never have written this book without their constant support and exemplary way of teaching. There's no better teacher than a good parent. A special thanks to my brothers, Juan and Edgar, and my cousins, Marcelo, Camilo, and Jonathan, with whom I took my first steps in programming and created a fictional software development company when we were children, DPA Software. Thanks to my sister for her amusing company while writing this book. Last but not least, thank you Viviana for your encouragement when reaching deadlines and for all those beautiful moments you have gave me. About the Reviewers Martin Cremer is working as an architect for a company in the financial sector. His work focuses on maintaining and developing reference architecture for web-based enterprise applications with Vaadin as well as supporting developers in their daily work. Max Matveev is a software development expert with 12 years of expertise in software development. Originally from Khabarovsk, Russia, he is currently living in Zurich, Switzerland and working for one of the largest Swiss banks as the Technical Lead. With main focus on Enterprise Java, he is experienced in all areas of enterprise software development ranging from backend data processing to modern rich UI web applications. Always looking for the best user experience possible he is one of those who allowed Vaadin to become one of the bank's standard frameworks for building UI. In addition to his main work, Max is also author of some popular (with over one million downloads) indie iOS applications. Data processing requirements for the huge user base allowed him to become one of the main pre-production tester of Jelastic SaaS platform during the platform's beta period. Michael Vogt started in 2000 at Apple, Germany as a WebObjects developer. Since then, he worked in many different companies and countries, mostly as a freelancer on GWT projects. Currently he works in the services department of Vaadin. www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? Fully searchable across every book published by Packt Copy and paste, print and bookmark content On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Preface 1 Chapter 1: Writing Your First Vaadin-powered Application 7 Creating and running Vaadin applications in Eclipse 8 Installing Eclipse 8 Time for action – downloading and installing Eclipse 8 Installing the Vaadin plugin for Eclipse 8 Time for action – installing the plugin 8 Installing Run Jetty Run plugin 10 Time for action – installing Jetty 10 Creating a new Vaadin project in Eclipse 10 Time for action – creating a new Vaadin project 11 Deploying and running Vaadin applications in Eclipse 11 Time for action – deploying and running 11 Creating and running Vaadin applications in NetBeans 12 Installing NetBeans 12 Time for action – downloading and installing NetBeans 12 Creating a new Vaadin project in NetBeans 13 Time for action – creating a new Vaadin project 13 Deploying and running Vaadin applications in NetBeans 15 Time for action – deploying and testing 15 Creating and running Vaadin applications using Maven 15 Vaadin 7 Maven archetype 16 Time for action – creating a new Vaadin project 16 Deploying and running Vaadin applications with Maven 16 Time for action – deploying and running 17 Generated application explained 17 Buttons 20 Labels 21