Creating a Server-Side Component

Typical server-side Vaadin applications use server-side components that are rendered on the client-side using their counterpart widgets. A server-side component must manage state synchronization between the widget on the client-side, in addition to any server-side logic.

Basic Server-Side Component

The component state is usually managed by a shared state, described later in “Shared State”.

Java

  1. public class MyComponent extends AbstractComponent {
  2. public MyComponent() {
  3. getState().setText("This is MyComponent");
  4. }
  5. @Override
  6. protected MyComponentState getState() {
  7. return (MyComponentState) super.getState();
  8. }
  9. }