native popup support; page-based browsing; bookmarking and URL; embed UIs
Embedding UIs in web pages
Debugging mode and window
by default, enabled by Eclipse plugin; configured by annotation of Vaadin servlet or in web.xml
opening: add ?debug to URL
for caching parameters or generating dynamic contents such as HTML / image / PDF
How to define shortcut keys for field components, default button, etc.
use javascript "print", example code given
can open a new window with specific UI for printing
print as PDF - example given
Integration with Google App Engine
Cross-Site scripting: make sure content received from user are safe to display
Advanced Application Architectures
Model-View-Presenter Pattern (MVP)
an example:
- Domain - the Calculator, includes data model and operations, know nothing about others
- CalculatorPresenter
- implements CalculatorViewListener
- know Calculator
- know CalculatorView and handles user interface logic with the view (CalculatorView)
- CalculatorView (interface) definition of interface, framework neutral
- CalculatorViewImpl - Vaadin implementation of the View, can send event to, or just call the presenter
- can use standard java.util.logging facilities
- configuration - put a file named logging.properties in default package
- see notes for logging in various environments and a sample
Access session-global data
- get user session data in UI class
- implement a UI subclass and attach user data to the instance (not a static variable)
- getUI() from any component (problem: require component connected to UI, and this is not true when initializing the UI)
- static UI.getCurrent()
- get global data cross session
- passing as parameters around (X, bad!)
- override attach() method in custom component, call getApplication().getUserData()... (slightly messy)
- static variable - if it's constant, read only, or not significant (like only a counter for performance...) then it's ok
- ThreadLocal Pattern
- problem with static variables for global access
- user A can change the reference to another data, while user B is using it, even request is processed sequentially
- threading - multiple thread doing work on the same data
- ThreadLocal class in Java