MechanicForm emptyObj = new MechanicForm();
objToView(emptyObj);
}
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);
}
}
Datebox birthdayDB = (Datebox) getFellow("birthday");
Textbox homePhoneTB = (Textbox) getFellow("homePhone");
Textbox mobileTB = (Textbox) getFellow("mobile");
Textbox informPeopleTB = (Textbox) getFellow("informPeople");
Textbox relationTB = (Textbox) getFellow("relation");
birthdayDB.setValue(form.getBirthday());
homePhoneTB.setText(form.getHomePhone());
mobileTB.setText(form.getMobile());
informPeopleTB.setText(form.getInformPeople());
relationTB.setText(form.getRelation());
Textbox informPhoneTB = (Textbox) getFellow("informPhone");
Textbox deliveryZipTB = (Textbox) getFellow("deliveryZip");
Textbox deliveryAddressTB = (Textbox) getFellow("deliveryAddress");
Textbox billZipTB = (Textbox) getFellow("billZip");
Textbox billAddressTB = (Textbox) getFellow("billAddress");
informPhoneTB.setText(form.getInformPhone());
deliveryZipTB.setText(form.getDeliveryZip());
deliveryAddressTB.setText(form.getDeliveryAddress());
billZipTB.setText(form.getBillZip());
billAddressTB.setText(form.getBillAddress());
}