}
public void objToView(Object obj) {
MechanicForm form = (MechanicForm) obj;
Radiogroup hasCitizenshipRG = (Radiogroup) getFellow("hasCitizenship");
Textbox mechanicNameTB = (Textbox) getFellow("mechanicName");
Textbox uniIdTB = (Textbox) getFellow("uniId");
Combobox companyCB = (Combobox) getFellow("company");
Radiogroup sexRG = (Radiogroup) getFellow("sex");
Iterator it = hasCitizenshipRG.getItems().iterator();
while (it.hasNext()) {
Radio r = (Radio) it.next();
if (r.getValue().equals(form.getHasCitizenship())) {
r.setChecked(true);
}
}
mechanicNameTB.setText(form.getMechanicName());
uniIdTB.setText(form.getUniId());
boolean mechanicBelongToCompany = false;
Iterator companyCBItr = companyCB.getItems().iterator();
while (companyCBItr.hasNext()) {
Comboitem item = (Comboitem) companyCBItr.next();
Org varCompany = (Org) item.getValue();
if (form.getCompanyId() != null
&& varCompany.getOrgId().equals(form.getCompanyId())) {
companyCB.setSelectedItem(item);
form.setCompany(varCompany); // if has company, re-link it now
mechanicBelongToCompany = true;
}
}
if(!mechanicBelongToCompany){
companyCB.setValue("please");
}
Iterator sexRGItr = sexRG.getItems().iterator();
while (sexRGItr.hasNext()) {
Radio r = (Radio) sexRGItr.next();
if (r.getValue().equals(form.getSex())) {
r.setChecked(true);
}