There's no better way to learn than practice. Follow these steps to see how binding works in real life:
Create a new project named binding using your IDE. A Vaadin one, of course.
Don't hesitate and delete all the content in the generated
BindingUI
class.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); }
Create a new local instance of
Label
:Label label = new Label();
Add the
TextField
andLabel
components to a newVerticalLayout
and set it to be the content of the UI:VerticalLayout layout = new VerticalLayout(); layout.addComponent(textField); layout.addComponent(label); setContent(layout);
Nothing new so far, so create a new instance of the
ObjectProperty
class:ObjectProperty<String> property = new ObjectProperty<String>("the value");
Wow, that was new...