Extensions

In Chapter 6, Adding More Components we used the FileDownloader extension to add downloading capabilities to a button:

// create an extension
FileDownloader downloader = new FileDownloader(resource);

// extend a component
downloader.extend(button);

Extensions allow us to add functionality at runtime. We can add multiple extensions to the same component, that's something we cannot do by extending a class (in the object oriented sense, of course).

Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.