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 .
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);
}
});
...
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.