/* if a language is selected get the object from the listbox */
Listitem item = lbox_usrLocale.getSelectedItem();
if (item != null) {
ListModelList lml1 = (ListModelList) lbox_usrLocale.getListModel();
Language lang = (Language) lml1.get(item.getIndex());
anUser.setUsrLocale(lang.getLanLocale());
}
// save it to database
try {
getUserService().saveOrUpdate(anUser);
} catch (DataAccessException e) {
ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString());
// Reset to init values
doResetInitValues();
doReadOnly();
btnCtrl.setBtnStatus_Save();
return;
}
// now synchronize the listBox
ListModelList lml = (ListModelList) listBoxUser.getListModel();
// Check if the object is new or updated
// -1 means that the obj is not in the list, so it's new.
if (lml.indexOf(anUser) == -1) {
lml.add(anUser);
} else {
lml.set(lml.indexOf(anUser), anUser);
}
doReadOnly();
btnCtrl.setBtnStatus_Save();
// init the old values vars new