Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Help About Edit
Hi all,
this code not found:
Usuario u=new Usuario();
u.setId(6);
BeanFieldGroup fieldGroup = new BeanFieldGroup<Usuario>(Usuario.class);
fieldGroup.setItemDataSource(new BeanItem<Usuario>(u));
fieldGroup.bind(txtNombre, "nombre");
The result is null :(
What do you mean "the result is null"? Which result? The code you pasted looks good, no problems there. Do you mean that the textfield has a value of "null" in it? If that's the problem, then please read the chapter about handling null values.
Becouse i click a row and get a element ID, after that i need to complete the textfield and combobox to update elements...
Hi:
first selected item in a table and obtenego ID , then I pressed the button and open the UN edit window, then that must bring all loaded elements in the text boxes to make the upgrade . By now I'm Solving follows , sea But I do not think right.
Attach Image.
TABLE USUARIO(id,nombre,apepat,apemat,fono,celular,ciudad_id,estado)
TABLE CIUDAD(id,nombre,estado)
Fist get the element id of table:
tabla.setSelectable(true);
tabla.addItemClickListener(new ItemClickEvent.ItemClickListener() {
@Override
public void itemClick(ItemClickEvent itemClickEvent) {
id = (Integer) itemClickEvent.getItem().getItemProperty("id").getValue();
}
});
Second i show de the windows and load element:
....
//FIND WITH ID AND COMPLETE TEXTFIELD AND COMBOBOX
UsuarioDAO uDAO = new UsuarioDAO();
List<Usuario> c = uDAO.buscarPorId(id);
for (int i = 0; i < c.size(); i++) {
System.out.println("" + i);
System.out.println("NOMBRE" + c.get(i).getNombre());
txtNombre.setValue(c.get(i).getNombre());
txtApepat.setValue(c.get(i).getApepat());
txtApemat.setValue(c.get(i).getApemat());
txtFono.setValue(c.get(i).getFono());
txtCelular.setValue(c.get(i).getCelular());
comboCiudad.setNewItemsAllowed(true);
comboCiudad.addItem(c.get(i).getCiudad().getNombre());
comboCiudad.setValue(c.get(i).getCiudad().getNombre());
txtEstado.setValue(c.get(i).getEstado());
comboCiudad.setEnabled(false);
}
//IF I CLICK THE BUTTON EDIT SHOW SELECT * FROM CIUDAD AND COMPLETE COMBOBOX
btnEdit.addClickListener(new ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
comboCiudad.setEnabled(true);
CiudadDAO cDAO=new CiudadDAO();
BeanItemContainer bic = new BeanItemContainer<Ciudad>(Ciudad.class, cDAO.mostrarTodo());
comboCiudad.setItemCaptionPropertyId("nombre");
comboCiudad.setContainerDataSource(bic);
}
});
...
Attach Image.
Thank you.
Bye
So what is the problem? You mentioned in your original post about "result is null" - I don't see anything being null in your screenshot. Sorry, but I can't quite understand what the problem is that your are facing.