Preface
Vaadin is an open source framework to ease development of Java web applications that provides a programming model close to Swing or AWT. Vaadin is licensed under the Apache License, is well documented, comes with out-of-the-box theming facilities, and is supported by a committed company and a vibrant community contributing to the framework through forums and hundreds of add-ons.
Vaadin allows developers to write web applications using only Java. Of course, HTML, CSS, and JavaScript are building blocks of web application development, however, by using Vaadin, developers will be maintaining Java code most of the time. The UI layer is implemented using the object-oriented paradigm. This allows developers to bring all the object-oriented knowledge out there directly to their UI layers. Developers missing the joy of using Swing or AWT to build desktop applications when creating web applications usually love Vaadin.
This book will teach you how to develop Java web applications in minutes. Starting from chapter one, you will begin with simple examples and quickly move towards more complex applications covering UI components, themes, custom components, and client-side applications.
What this book covers
Chapter 1, Writing Your First Vaadin-powered Application, explains how to set up your development environment and create your first Vaadin project.
Chapter 2, Using Input Components and Forms – Time to Listen to Users, explains basic usage of input components and the Vaadin data model.
Chapter 3, Arranging Components into Layouts, covers layout components, panels, pop-up windows, tab sheets, and accordions.
Chapter 4, Using Vaadin Navigation Capabilities, deals with using Vaadin to build more website-like applications.
Chapter 5, Using Tables – Time to Talk to Users, covers one of the most useful and powerful UI components in Vaadin: the table component.
Chapter 6, Adding More Components, introduces several UI components such as trees, progress indicators, icons, sliders, color pickers, images, web content, and drag and drop.
Chapter 7, Customizing UI Components – Time to Theme it, covers Vaadin theme creation using CSS and Sass.
Chapter 8, Developing Your Own Components, introduces the strategies to develop pure client-side applications and custom components.
What you need for this book
To run the examples and follow the tutorials in this book, you will need Java SDK installed. You will need also Eclipse, NetBeans, or Maven.
Who this book is for
This book is ideal for developers with a good knowledge of Java willing to build rich-Internet applications using Vaadin. Basic understanding of HTML and CSS is useful but not required to understand the content of the book.
Conventions
In this book, you will find several headings appearing frequently.
To give clear instructions of how to complete a procedure or task, we use:
Time for action – heading
Action 1
Action 2
Action 3
Instructions often need some extra explanation so that they make sense, so they are followed with:
What just happened?
This heading explains the working of tasks or instructions that you have just completed.
You will also find some other learning aids in the book, including:
Pop quiz – heading
These are short multiple-choice questions intended to help you test your own understanding.
Have a go hero – heading
These practical challenges give you ideas for experimenting with what you have learned.
You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Change your code to add the required text fields before creating the button
instance."
A block of code is set as follows:
new Button.ClickListener() { public void buttonClick(ClickEvent event) { // this will be called if button is clicked } }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
public class WelcomeUI extends UI { protected void init(VaadinRequest request) { VerticalLayout layout = new VerticalLayout(); setContent(layout); Button button = new Button("Click Me"); layout.addComponent(button); } }
Any command-line input or output is written as follows:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.0.0 -Dpackaging=war
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "You can right-click on your project and select Debug As | Run Jetty."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.