ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 01.01.2026

Просмотров: 2601

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Book of Vaadin

22.4.4. The UI .......................................................................................

484

22.4.5. Mobile Widget Set ......................................................................

484

22.5. Mobile User Interface Components .........................................................

484

22.5.1. NavigationView .........................................................................

485

22.5.2. Toolbar .....................................................................................

486

22.5.3. NavigationManager ..................................................................

486

22.5.4. NavigationButton .....................................................................

488

22.5.5. Popover ....................................................................................

488

22.5.6. Switch ......................................................................................

490

22.5.7. VerticalComponentGroup .........................................................

491

22.5.8. HorizontalComponentGroup ....................................................

491

22.5.9. TabBarView ..............................................................................

491

22.5.10. EmailField ...............................................................................

492

22.5.11. NumberField ...........................................................................

492

22.5.12. UrlField ...................................................................................

492

22.6. Advanced Mobile Features ....................................................................

492

22.6.1. Providing a Fallback UI ...............................................................

492

22.6.2. Geolocation ...............................................................................

493

22.7. Offline Mode .........................................................................................

494

22.7.1. Enabling the Cache Manifest .......................................................

495

22.7.2. Enabling Offline Mode ................................................................

496

22.7.3. The Offline User Interface ...........................................................

496

22.7.4. Sending Data to Server ...............................................................

496

22.7.5. The Offline Theme ......................................................................

496

22.8. Building an Optimized Widget Set ..........................................................

497

22.9. Testing and Debugging on Mobile Devices ..............................................

498

22.9.1. Debugging .................................................................................

498

Chapter 23. Vaadin TestBench .............................................................................

499

23.1. Overview ..............................................................................................

499

23.2. Installing Vaadin TestBench ....................................................................

502

23.2.1. Test Development Installation ......................................................

503

23.2.2. A Distributed Testing Environment ...............................................

503

23.2.3. Downloading and Unpacking the Installation Package ...................

504

23.2.4. Installation Package Contents .....................................................

504

23.2.5. Example Contents ......................................................................

505

23.2.6. Installing the Recorder ................................................................

506

23.2.7. Installing Browser Drivers ...........................................................

507

23.2.8. Test Node Configuration ..............................................................

507

23.3. Preparing an Application for Testing ........................................................

508

23.4. Using Vaadin TestBench Recorder ..........................................................

509

23.4.1. Starting the Recorder .................................................................

509

23.4.2. Recording ..................................................................................

511

23.4.3. Selectors ...................................................................................

512

23.4.4. Playing Back Tests ......................................................................

513

23.4.5. Editing Tests ..............................................................................

513

23.4.6. Exporting Tests ..........................................................................

514

23.4.7. Saving Tests ...............................................................................

515

23.5. Developing JUnit Tests ..........................................................................

515

23.5.1. Starting From a Stub ..................................................................

516

23.5.2. Finding Elements by Selectors ....................................................

517

23.5.3. Running JUnit Tests in Eclipse .....................................................

519

23.5.4. Executing Tests with Ant .............................................................

520

23.5.5. Executing Tests with Maven ........................................................

521

xi


Book of Vaadin

23.5.6. Test Setup ..................................................................................

522

23.5.7. Creating and Closing a Web Driver ..............................................

522

23.5.8. Basic Test Case Structure ...........................................................

523

23.5.9. Waiting for Vaadin .......................................................................

524

23.5.10. Testing Tooltips .........................................................................

525

23.5.11. Scrolling ...................................................................................

525

23.5.12. Testing Notifications ..................................................................

525

23.5.13. Testing Context Menus ..............................................................

526

23.5.14. Profiling Test Execution Time .....................................................

526

23.6. Taking and Comparing Screenshots .......................................................

528

23.6.1. Screenshot Parameters ..............................................................

528

23.6.2. Taking Screenshots on Failure .....................................................

529

23.6.3. Taking Screenshots for Comparison .............................................

529

23.6.4. Practices for Handling Screenshots .............................................

531

23.6.5. Known Compatibility Problems ....................................................

531

23.7. Running Tests in an Distributed Environment ..........................................

531

23.7.1. Running Tests Remotely .............................................................

532

23.7.2. Starting the Hub .........................................................................

532

23.7.3. Node Service Configuration ........................................................

533

23.7.4. Starting a Grid Node ...................................................................

535

23.7.5. Mobile Testing ............................................................................

535

23.8. Known Issues .......................................................................................

536

23.8.1. Using assertTextPresent and assertTextNotPresent ......

536

23.8.2. Exporting Recordings of the Upload Component ..........................

536

23.8.3. Running Firefox Tests on Mac OS X .............................................

536

A. Songs of Vaadin ......................................................................................................

537

xii



Preface

This book provides an overview of the Vaadin Framework and covers the most important topics that you might encounter while developing applications with it. A more detailed documentation of the individual classes, interfaces, and methods is given in the Vaadin API Reference.

This edition covers Vaadin 7 released in early 2013. Vaadin 7 changes the basic architecture of Vaadin applications significantly, more than it did in the previous major revisions. Hence, the book has also evolved significantly. For add-on components, a chapter on the new Vaadin Charts add-on has been added.

Writing this manual is an ongoing work and it is rarely completely up-to-date with the quickevolving product. This version is a snapshot taken soon after the release of Vaadin 7. Publication was rushed to get the book in print for major conferences, so some of the content has not yet been completely updated for Vaadin 7.

While this edition is mostly updated for Vaadin 7, it may still contain some outdated content related to Vaadin 6.

For the most current version, please see the on-line edition available at http://vaadin.com/book.You can also find PDF and EPUB versions of the book there.You may find the other versions more easily searchable than this printed book, but the content is the same.

Also, many Vaadin 7 features are showcased as mini-tutorials, which are available in the Vaadin Wiki at https://vaadin.com/wiki/-/wiki/Main/Vaadin+7.

Who is This Book For?

This book is intended for software developers who use, or are considering to use, Vaadin to develop web applications.

The book assumes that you have some experience with programming in Java, but if not, it is at least as easy to begin learning Java with Vaadin as with any other UI framework. No knowledge of AJAX is needed as it is well hidden from the developer.

You may have used some desktop-oriented user interface frameworks for Java, such as AWT, Swing, or SWT, or a library such as Qt for C++. Such knowledge is useful for understanding the scope of Vaadin, the event-driven programming model, and other common concepts of UI frameworks, but not necessary.

If you do not have a web graphics designer at hand, knowing the basics of HTML and CSS can help so that you can develop presentation themes for your application. A brief introduction to CSS is provided. Knowledge of Google Web Toolkit (GWT) may be useful if you develop or integrate new client-side components.

Organization of This Book

The Book of Vaadin gives an introduction to what Vaadin is and how you use it to develop web applications.

Part I: Introduction

Book of Vaadin

xiii

Preface

Chapter 1, Introduction

The chapter gives an introduction to the application architecture supported by Vaadin, the core design ideas behind the framework, and some historical background.

Chapter 2, Getting Started with Vaadin

This chapter gives practical instructions for installing Vaadin and the reference toolchain, including the Vaadin Plugin for Eclipse, how to run and debug the demos, and how to create your own application project in the Eclipse IDE.

Chapter 3, Architecture

This chapter gives an introduction to the architecture of Vaadin and its major technologies, including AJAX, Google Web Toolkit, and event-driven programming.

Part II: Server-Side Framework

Chapter 4, Writing a Server-Side Web Application

This chapter gives all the practical knowledge required for creating applications with Vaadin, such as window management, application lifecycle, deployment in a servlet container, and handling events, errors, and resources.

Chapter 5, User Interface Components

This chapter essentially gives the reference documentation for all the core user interface components in Vaadin and their most significant features. The text gives examples for using each of the components.

Chapter 6, Managing Layout

This chapter describes the layout components, which are used for managing the layout of the user interface, just like in any desktop application frameworks.

Chapter 7, Visual User Interface Design with Eclipse

This chapter gives instructions for using the visual editor for Eclipse, which is included in the Vaadin Plugin for the Eclipse IDE.

Chapter 8, Themes

This chapter gives an introduction to Cascading Style Sheets (CSS) and explains how you can use them to build custom visual themes for your application.

Chapter 9, Binding Components to Data

This chapter gives an overview of the built-in data model of Vaadin, consisting of properties, items, and containers.

Chapter 10, Vaadin SQLContainer

This chapter gives documentation for the SQLContainer, which allows binding Vaadin components to SQL queries.

Chapter 11, Advanced Web Application Topics

This chapter provides many special topics that are commonly needed in applications, such as opening new browser windows, embedding applications in regular web pages, low-level management of resources, shortcut keys, debugging, etc.

Chapter 12, Portal Integration

This chapter describes the development of Vaadin applications as portlets which you can deploy to any portal supporting Java Portlet API 2.0 (JSR-286). The chapter also describes the special support for Liferay and the Control Panel, IPC, and WSRP addons.

xiv

Organization of This Book


Preface

Part III: Client-Side Framework

Chapter 13, Client-Side Vaadin Development

This chapter gives an introduction to creating and developing client-side applications and widgets, including installation, compilation, and debugging.

Chapter 14, Client-Side Applications

This chapter describes how to develop client-side applications and how to integrate them with a back-end service.

Chapter 15, Client-Side Widgets

This chapter describes the built-in widgets (client-side components) available for clientside development. The built-in widgets include Google Web Toolkit widgets as well as Vaadin widgets.

Chapter 16, Integrating with the Server-Side

This chapter describes how to integrate client-side widgets with their server-side counterparts for the purpose of creating new server-side components. The chapter also covers integrating JavaScript components.

Part IV: Vaadin Add-ons

Chapter 17, Using Vaadin Add-ons

This chapter gives instructions for downloading and installing add-on components from the Vaadin Directory.

Chapter 18, Vaadin Calendar

This chapter gives the developer documentation of the Calendar add-on component.

Chapter 19, Vaadin Charts

This chapter documents the use of the Vaadin Charts add-on component for interactive charting with many diagram types. The add-on includes the Chart and Timeline components.

Chapter 20, Vaadin Timeline

This chapter documents the use of the Timeline component part of the Vaadin Charts add-on.

Chapter 21, Vaadin JPAContainer

This chapter gives documentation of the JPAContainer add-on, which allows binding Vaadin components directly to relational and other databases using Java Persistence API (JPA).

Chapter 22, Mobile Applications with TouchKit

This chapter gives examples and reference documentation for using the Vaadin TouchKit add-on for developing mobile applications.

Chapter 23, Vaadin TestBench

This chapter gives the complete documentation of using the Vaadin TestBench tool for recording and executing user interface regression tests of Vaadin applications.

Appendix A, Songs of Vaadin

Mythological background of the name Vaadin.

Organization of This Book

xv

Preface

Supplementary Material

The Vaadin websites offer plenty of material that can help you understand what Vaadin is, what you can do with it, and how you can do it.

Demo Applications

The most important demo application for Vaadin is the Sampler, which demonstrates the use of all basic components and features.You can run it on-line at http://demo.vaadin.com/ or download it as a WAR from the Vaadin download page [http://vaadin.com/download/].

Most of the code examples in this book and many others can be found online at ht- tp://demo.vaadin.com/book-examples-vaadin7/book/.

Cheat Sheet

The two-page cheat sheet illustrates the basic relationship hierarchy of the user interface and data binding classes and interfaces. You can download it at http://vaadin.com/book.

Refcard

The six-page DZone Refcard gives an overview to application development with Vaadin. It includes a diagram of the user interface and data binding classes and interfaces. You can find more information about it at https://vaadin.com/refcard.

Address Book Tutorial

The Address Book is a sample application accompanied with a tutorial that gives detailed step-by-step instructions for creating a real-life web application with Vaadin.You can find the tutorial from the product website.

Developer's Website

Vaadin Developer's Site at http://dev.vaadin.com/ provides various online resources, such as the ticket system, a development wiki, source repositories, activity timeline, development milestones, and so on.

The wiki provides instructions for developers, especially for those who wish to checkout and compile Vaadin itself from the source repository. The technical articles deal with integration of Vaadin applications with various systems, such as JSP, Maven, Spring, Hibernate, and portals. The wiki also provides answers to Frequently Asked Questions.

Online Documentation

You can read this book online at http://vaadin.com/book. Lots of additional material, including technical HOWTOs, answers to Frequently Asked Questions and other documentation is also available on Vaadin web-site [http://dev.vaadin.com/].

Support

Stuck with a problem? No need to lose your hair over it, the Vaadin Framework developer community and the Vaadin company offer support to all of your needs.

Community Support Forum

You can find the user and developer community forum at http://vaadin.com/forum. Please use the forum to discuss any problems you might encounter, wishes for features,

xvi

Supplementary Material