Annotation Type Bindable
Marks a POJO or PropertyBusinessObject as a target for the component
binding processor. The Codename One Maven plugin generates a Binder next
to the class that copies the marked fields into the matching components of
a Container -- and back, for two-way bindings against TextField,
TextArea, CheckBox, and friends.
@Bindable
public class LoginModel {
@Bind(name="userField", attr=BindAttr.TEXT)
public Property<String, LoginModel> user = new Property<>("user");
@Bind(name="rememberMe", attr=BindAttr.SELECTED)
public boolean remember;
}
LoginModel model = new LoginModel();
Binders.bind(model, form);
// user types into userField -- model.user.get() observes the change
// model.user.set("alice") -- userField re-renders with the new text
Lookup happens through Component#getComponentForm().findByName(name) so
the form's GUI builder names line up with the model field names.