Using the Composite class

If you have some experience with Vaadin, chances are that you already know the CustomComponent class. The Composite class works in the same way as the CustomComponent class, but it's more lightweight since it only adds a simple <div> element to the DOM in the browser. The Composite class eases the development of compositions of components by eliminating some of the problems previously described. Composite directly extends AbstractComponentwhich means that any class extending Composite is a Component itself that can be added to any Vaadin layout. A Composite can specify a composition root that serves as the root of the components tree (usually a layout), for example:

public class LoginFormComponent extends Composite {

    public LoginFormComponent() {

        ... create and configure all required components

        VerticalLayout layout = new VerticalLayout(
                username, password, button, rememberMe);

        setCompositionRoot(layout);
    }

    ... getters and setters
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset