Interfaces and Abstractions

    This section gives details on the basic component interfaces and abstractions. The layout and other component container abstractions are described in “Managing Layout”. The interfaces that define the Vaadin data model are described in .

    Component Interfaces and Abstractions

    All components also implement the Paintable interface, which is used for serializing (“painting”) the components to the client, and the reverse VariableOwner interface, which is needed for deserializing component state or user interaction from the client.

    The Component interface is paired with the AbstractComponent class, which implements all the methods defined in the interface.

    Components are laid out in the user interface hierarchically. The layout is managed by layout components, or more generally components that implement the ComponentContainer interface. Such a container is the parent of the contained components.

    The getParent() method allows retrieving the parent component of a component. While there is a setParent(), you rarely need it as you usually add components with the addComponent() method of the ComponentContainer interface, which automatically sets the parent.

    A component does not know its parent when the component is still being created, so you can not refer to the parent in the constructor with getParent().

    Java

    The attachment logic is implemented in AbstractComponent, as described in AbstractComponent.

    AbstractComponent

    AbstractComponent is the base class for all user interface components. It is the (only) implementation of the Component interface, implementing all the methods defined in the interface.

    AbstractComponent has a single abstract method, getTag(), which returns the serialization identifier of a particular component class. It needs to be implemented when (and only when) creating entirely new components. AbstractComponent manages much of the serialization of component states between the client and the server. Creation of new components and serialization is described in “Integrating with the Server-Side”.