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

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

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

Добавлен: 01.01.2026

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

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

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

Book of Vaadin

10.5.2. Page Length and Cache Size ......................................................

270

10.5.3. Refreshing the Container ............................................................

270

10.5.4. Cache Flush Notification Mechanism ...........................................

271

10.6. Referencing Another SQLContainer ......................................................

271

10.7. Using FreeformQuery and FreeformStatementDelegate .......................

272

10.8. Non-implemented methods of Vaadin container interfaces .......................

273

10.9. Known Issues and Limitations ................................................................

274

Chapter 11. Advanced Web Application Topics ....................................................

277

11.1. Handling Browser Windows ...................................................................

278

11.1.1. Opening Popup Windows ............................................................

278

11.2. Embedding UIs in Web Pages ................................................................

280

11.2.1. Embedding Inside a div Element ................................................

280

11.2.2. Embedding Inside an iframe Element ........................................

285

11.2.3. Cross-Site Embedding with the Vaadin XS Add-on .......................

287

11.3. Debug and Production Mode ..................................................................

287

11.3.1. Debug Mode ..............................................................................

288

11.3.2. Analyzing Layouts ......................................................................

288

11.3.3. Custom Layouts .........................................................................

289

11.3.4. Debug Functions for Component Developers ................................

289

11.4. Request Handlers .................................................................................

289

11.5. Shortcut Keys .......................................................................................

290

11.5.1. Click Shortcuts for Default Buttons ...............................................

290

11.5.2. Field Focus Shortcuts .................................................................

291

11.5.3. Generic Shortcut Actions ............................................................

291

11.5.4. Supported Key Codes and Modifier Keys .....................................

293

11.6. Printing .................................................................................................

294

11.6.1. Printing the Browser Window .......................................................

294

11.6.2. Opening a Print Window .............................................................

294

11.6.3. Printing PDF ..............................................................................

295

11.7. Google App Engine Integration ..............................................................

296

11.8. Common Security Issues .......................................................................

297

11.8.1. Sanitizing User Input to Prevent Cross-Site Scripting ....................

297

11.9. Navigating in an Application ...................................................................

297

11.9.1. Setting Up for Navigation ............................................................

298

11.9.2. Implementing a View ..................................................................

299

11.9.3. Handling URI Fragment Path .......................................................

299

11.10. URI Fragment and History Management with UriFragmentUtility ..........

302

11.11. Drag and Drop ....................................................................................

304

11.11.1. Handling Drops ........................................................................

304

11.11.2. Dropping Items On a Tree .........................................................

305

11.11.3. Dropping Items On a Table .......................................................

307

11.11.4. Accepting Drops .......................................................................

307

11.11.5. Dragging Components ..............................................................

310

11.11.6. Dropping on a Component ........................................................

311

11.11.7. Dragging Files from Outside the Browser ...................................

312

11.12. Logging ..............................................................................................

312

11.13. JavaScript Interaction ..........................................................................

313

11.13.1. Calling JavaScript .....................................................................

313

11.13.2. Handling JavaScript Function Callbacks .....................................

314

11.14. Accessing Session-Global Data ...........................................................

315

11.14.1. Passing References Around ......................................................

316

11.14.2. Overriding attach() ...............................................................

316

11.14.3. ThreadLocal Pattern .................................................................

317

vi


Book of Vaadin

Chapter 12. Portal Integration ..............................................................................

319

12.1. Deploying to a Portal .............................................................................

319

12.2. Creating a Portal Application Project in Eclipse .......................................

320

12.3. Portlet Deployment Descriptors ..............................................................

322

12.4. Portlet Hello World ................................................................................

327

12.5. Installing Vaadin in Liferay ......................................................................

327

12.5.1. Removing the Bundled Installation ...............................................

328

12.5.2. Installing Vaadin .........................................................................

328

12.6. Handling Portlet Requests .....................................................................

329

12.7. Handling Portlet Mode Changes .............................................................

330

12.8. Non-Vaadin Portlet Modes .....................................................................

332

12.9. Vaadin IPC for Liferay ............................................................................

335

12.9.1. Installing the Add-on ...................................................................

336

12.9.2. Basic Communication .................................................................

337

12.9.3. Considerations ...........................................................................

337

12.9.4. Communication Through Session Attributes .................................

338

12.9.5. Serializing and Encoding Data ....................................................

339

12.9.6. Communicating with Non-Vaadin Portlets .....................................

340

Part III. Client-Side Framework .......................................................................................

341

Chapter 13. Client-Side Vaadin Development .......................................................

343

13.1. Overview ..............................................................................................

343

13.2. Installing the Client-Side Development Environment ................................

344

13.3. Client-Side Module Descriptor ................................................................

344

13.3.1. Specifying a Stylesheet ...............................................................

344

13.3.2. Limiting Compilation Targets ........................................................

345

13.4. Compiling a Client-Side Module .............................................................

345

13.4.1. Vaadin Compiler Overview ..........................................................

345

13.4.2. Compiling in Eclipse ...................................................................

346

13.4.3. Compiling with Ant ......................................................................

346

13.4.4. Compiling with Maven .................................................................

346

13.5. Creating a Custom Widget .....................................................................

346

13.5.1. A Basic Widget ...........................................................................

346

13.5.2. Using the Widget ........................................................................

347

13.6. Debugging Client-Side Code ..................................................................

347

13.6.1. Launching Development Mode ....................................................

348

13.6.2. Launching SuperDevMode ..........................................................

348

Chapter 14. Client-Side Applications ...................................................................

351

14.1. Overview ..............................................................................................

351

14.2. Client-Side Module Entry-Point ..............................................................

353

14.2.1. Module Descriptor ......................................................................

353

14.3. Compiling and Running a Client-Side Application ....................................

354

14.4. Loading a Client-Side Application ...........................................................

354

Chapter 15. Client-Side Widgets ..........................................................................

357

15.1. Overview ..............................................................................................

357

15.2. GWT Widgets .......................................................................................

358

15.3. Vaadin Widgets .....................................................................................

358

Chapter 16. Integrating with the Server-Side .......................................................

359

16.1. Overview ..............................................................................................

359

16.2. Starting It Simple With Eclipse ...............................................................

361

16.2.1. Creating a Widget .......................................................................

361

vii


Book of Vaadin

16.2.2. Compiling the Widget Set ............................................................

363

16.3. Creating a Server-Side Component ........................................................

364

16.3.1. Basic Server-Side Component ....................................................

364

16.4. Integrating the Two Sides with a Connector .............................................

364

16.4.1. A Basic Connector ......................................................................

365

16.4.2. Communication with the Server-Side ...........................................

365

16.5. Shared State ........................................................................................

366

16.5.1. Accessing Shared State on Server-Side ......................................

366

16.5.2. Handing Shared State in a Connector ..........................................

366

16.5.3. Referring to Components in Shared State ....................................

367

16.5.4. Sharing Resources .....................................................................

367

16.6. RPC Calls Between Clientand Server-Side ...........................................

368

16.6.1. RPC Calls to the Server-Side ......................................................

368

16.7. Component and UI Extensions ...............................................................

369

16.7.1. Server-Side Extension API ..........................................................

370

16.7.2. Extension Connectors .................................................................

370

16.8. Styling a Widget ....................................................................................

371

16.8.1. Determining the CSS Class .........................................................

371

16.8.2. Default Stylesheet ......................................................................

372

16.9. Component Containers ..........................................................................

372

16.10. Creating Add-ons ................................................................................

372

16.10.1. Exporting Add-on in Eclipse ......................................................

373

16.10.2. Building Add-on with Ant ...........................................................

373

16.11. Migrating from Vaadin 6 .......................................................................

377

16.11.1. Quick (and Dirty) Migration ........................................................

378

16.12. Integrating JavaScript Components and Extensions ...............................

378

16.12.1. Example JavaScript Library .......................................................

378

16.12.2. A Server-Side API for a JavaScript Component ..........................

379

16.12.3. Defining a JavaScript Connector ................................................

381

16.12.4. RPC from JavaScript to Server-Side ..........................................

381

Part IV. Vaadin Add-ons .................................................................................................

383

Chapter 17. Using Vaadin Add-ons ......................................................................

385

17.1. Overview ..............................................................................................

385

17.2. Downloading Add-ons from Vaadin Directory ...........................................

386

17.2.1. Compiling Widget Sets with an Ant Script .....................................

386

17.3. Installing Add-ons in Eclipse with Ivy ......................................................

386

17.4. Using Add-ons in a Maven Project ..........................................................

388

17.4.1. Adding a Dependency ................................................................

388

17.4.2. Compiling the Project Widget Set ................................................

389

17.4.3. Enabling Widget Set Compilation .................................................

390

17.5. Troubleshooting .....................................................................................

391

Chapter 18. Vaadin Calendar ...............................................................................

393

18.1. Overview ..............................................................................................

393

18.2. Installing Calendar ................................................................................

396

18.3. Basic Use .............................................................................................

396

18.3.1. Setting the Date Range ...............................................................

396

18.3.2. Adding and Managing Events ......................................................

396

18.3.3. Getting Events from a Container ..................................................

397

18.4. Implementing an Event Provider .............................................................

399

18.4.1. Custom Events ...........................................................................

399

18.4.2. Implementing the Event Provider .................................................

401

18.5. Configuring the Appearance ..................................................................

401

viii


Book of Vaadin

18.5.1. Sizing ........................................................................................

401

18.5.2. Styling .......................................................................................

401

18.5.3. Visible Hours and Days ...............................................................

403

18.6. Drag and Drop ......................................................................................

403

18.7. Using the Context Menu ........................................................................

404

18.8. Localization and Formatting ...................................................................

405

18.8.1. Setting the Locale and Time Zone ...............................................

405

18.8.2. Time and Date Caption Format ....................................................

405

18.9. Customizing the Calendar ......................................................................

405

18.9.1. Overview of Handlers .................................................................

405

18.9.2. Creating a Calendar ...................................................................

406

18.9.3. Backward and Forward Navigation ...............................................

406

18.9.4. Date Click Handling ....................................................................

407

18.9.5. Handling Week Clicks .................................................................

407

18.9.6. Handling Event Clicks .................................................................

408

18.9.7. Event Dragging ..........................................................................

408

18.9.8. Handling Drag Selection .............................................................

409

18.9.9. Resizing Events .........................................................................

410

Chapter 19. Vaadin Charts ...................................................................................

411

19.1. Overview ..............................................................................................

411

19.2. Installing Vaadin Charts .........................................................................

413

19.3. Basic Use .............................................................................................

414

19.3.1. Displaying Multiple Series ...........................................................

415

19.3.2. Mixed Type Charts ......................................................................

416

19.3.3. Chart Themes ............................................................................

417

19.4. Chart Types ..........................................................................................

417

19.4.1. Line and Spline Charts ...............................................................

417

19.4.2. Area Charts ...............................................................................

417

19.4.3. Column and Bar Charts ..............................................................

418

19.4.4. Scatter Charts ............................................................................

419

19.4.5. Pie Charts .................................................................................

421

19.4.6. Gauges .....................................................................................

423

19.4.7. Area and Column Range Charts ..................................................

424

19.4.8. Polar, Wind Rose, and Spiderweb Charts .....................................

425

19.5. Chart Configuration ...............................................................................

427

19.5.1. Plot Options ...............................................................................

427

19.5.2. Axes ..........................................................................................

427

19.5.3. Legend ......................................................................................

428

19.6. Chart Data ............................................................................................

429

19.6.1. List Series ..................................................................................

429

19.6.2. Generic Data Series ...................................................................

429

19.6.3. Range Series .............................................................................

430

19.6.4. Container Data Series ................................................................

431

19.7. Advanced Uses .....................................................................................

432

19.7.1. Server-Side Rendering and Exporting ..........................................

432

Chapter 20. Vaadin Timeline .................................................................................

435

20.1. Overview ..............................................................................................

435

20.2. Using Timeline ......................................................................................

439

20.2.1. Data Source Requirements .........................................................

439

20.2.2. Events and Listeners ..................................................................

441

20.2.3. Configurability ............................................................................

441

20.2.4. Localization ................................................................................

442

ix


Book of Vaadin

20.3. Code example .......................................................................................

442

20.3.1. Prerequisites ..............................................................................

442

20.3.2. Create the data sources ..............................................................

444

20.3.3. Create the Vaadin Timeline .........................................................

447

20.3.4. Final Touches .............................................................................

448

Chapter 21. Vaadin JPAContainer ........................................................................

451

21.1. Overview ..............................................................................................

451

21.2. Installing ...............................................................................................

453

21.2.1. Downloading the Package ...........................................................

454

21.2.2. Installation Package Content .......................................................

454

21.2.3. Downloading with Maven ............................................................

455

21.2.4. Including Libraries in Your Project ................................................

455

21.2.5. Persistence Configuration ...........................................................

455

21.2.6. Troubleshooting ..........................................................................

457

21.3. Defining a Domain Model .......................................................................

458

21.3.1. Persistence Metadata .................................................................

458

21.4. Basic Use of JPAContainer ....................................................................

461

21.4.1. Creating JPAContainer with JPAContainerFactory .....................

461

21.4.2. Creating and Accessing Entities ..................................................

463

21.4.3. Nested Properties ......................................................................

464

21.4.4. Hierarchical Container ................................................................

465

21.5. Entity Providers .....................................................................................

466

21.5.1. Built-In Entity Providers ...............................................................

466

21.5.2. Using JNDI Entity Providers in JEE6 Environment ........................

467

21.5.3. Entity Providers as Enterprise Beans ...........................................

468

21.6. Filtering JPAContainer ..........................................................................

469

21.7. Querying with the Criteria API ................................................................

469

21.7.1. Filtering the Query ......................................................................

470

21.7.2. Compatibility ..............................................................................

470

21.8. Automatic Form Generation ...................................................................

470

21.8.1. Configuring the Field Factory ......................................................

471

21.8.2. Using the Field Factory ...............................................................

471

21.8.3. Master-Detail Editor ....................................................................

473

21.9. Using JPAContainer with Hibernate ........................................................

473

21.9.1. Lazy loading ..............................................................................

473

21.9.2. The EntityManager-Per-Request pattern ......................................

473

21.9.3. Joins in Hibernate vs EclipseLink ................................................

474

Chapter 22. Mobile Applications with TouchKit ...................................................

475

22.1. Overview ..............................................................................................

475

22.2. Considerations Regarding Mobile Browsing ............................................

478

22.2.1. Mobile Human Interface ..............................................................

478

22.2.2. Bandwidth ..................................................................................

478

22.2.3. Mobile Features .........................................................................

479

22.2.4. Compatibility ..............................................................................

479

22.3. Installing Vaadin TouchKit ......................................................................

479

22.3.1. Installing the Zip Package ...........................................................

479

22.3.2. Installing in Maven ......................................................................

480

22.3.3. Importing the Vornitologist Demo .................................................

481

22.4. Elements of a TouchKit Application .........................................................

481

22.4.1. Deployment Descriptor ...............................................................

481

22.4.2. Creating a Custom Servlet ..........................................................

482

22.4.3. TouchKit Settings ........................................................................

482

x