I have a Client entity as follows:
package com.kargil.mybatis.bean;
public class Client {
private String clientKey;
private String name;
private String contactPerson;
public Client() {
}
public Client(String clientKey, String name, String contactPerson) {
this.clientKey = clientKey;
this.name = name;
this.contactPerson = contactPerson;
}
public String getClientKey() {
return clientKey;
}
public void setClientKey(String clientKey) {
this.clientKey = clientKey;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContactPerson() {
return contactPerson;
}
public void setContactPerson(String contactPerson) {
this.contactPerson = contactPerson;
}
}
How do I define comboBox binding ?
I have the following code so far but cannot figure out the binding statement that will bind the component to the Binder object :
List<Client> clientList = ClientManager.selectClients();
ComboBox<Client> clientCB = new ComboBox<>("Client");
clientCB.setItems(clientList);
clientCB.setItemLabelGenerator(Client::getName);
FormLayout form = new FormLayout(
clientCB
);
Binder<ClientPayment> binder = new Binder<>(ClientPayment.class);
binder.bind(clientCB, .........
So I need to know what to code in order to bind the component to the “binder” instance.
I want the comboBox to display field “name” but want field value “clientKey” to be stored value during binding.
Thanks in advance for your help