Time for action – binding data to properties

There's no better way to learn than practice. Follow these steps to see how binding works in real life:

  1. Create a new project named binding using your IDE. A Vaadin one, of course.
  2. Don't hesitate and delete all the content in the generated BindingUI class.
  3. Create a new local instance of TextField and turn immediate mode on:
      @Override
      protected void init(VaadinRequest request) {
        TextField textField = new TextField("Data");
        textField.setImmediate(true);
      }
  4. Create a new local instance of Label:
        Label label = new Label();
  5. Add the TextField and Label components to a new VerticalLayout and set it to be the content of the UI:
    VerticalLayout layout = new VerticalLayout(); layout.addComponent(textField); layout.addComponent(label); ...

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.