I have a ComboBox in my Vaadin application that is always highlighted as an error, even though the value is correct. If I remove the Binder, it works fine.
Here are my Java classes:
@SpringComponent
@RouteScope
@RouteScopeOwner(MainLayout.class)
public class SolicitudBean {
private Producto producto;
public SolicitudBean() {
this.producto = new Producto();
}
}
public class Producto {
private String code;
private String denominacion;
private List<Plazo> plazos;
......
(methods)
}
@PageTitle(ConstantsSimulacion.PAGE_TITLE)
@Route(value = ConstantsSimulacion.ROUTE, layout = MainLayout.class)
@RolesAllowed("ADMIN")
@Uses(Icon.class)
public class SimulacionRequestView extends Composite<VerticalLayout> implements BeforeEnterObserver {
private ComboBox<Producto> productoComboBox;
private Binder<SolicitudBean> solicitudBinder;
public SimulacionRequestView(
UserService userService,
SolicitudCalificarRestClientService solicitudCalificarRestClientService,
ProductsRestClientService productsRestClientService,
@Autowired @RouteScopeOwner(MainLayout.class) SolicitudBean solicitudBean) {
this.solicitudBean = solicitudBean;
this.solicitudBinder = new Binder<>(SolicitudBean.class);
this.solicitudBinder.forField(this.productoComboBox)
.bind(SolicitudBean::getProducto, SolicitudBean::setProducto);
this.solicitudBinder.setBean(this.solicitudBean);
this.productoComboBox = new ComboBox<Producto>(ConstantsSimulacion.DD_TIPO_DE_PRODUCTO);
// ... (other configuration)
}
}
The ComboBox is highlighted as an error when I use the Binder. If I remove the Binder, it works fine. Any idea why this might be happening? Am I missing something in my configuration?
Thanks!!!