wizard.addPage(company);
wizard.addPage(person);
wizard.addPage(notes);
if (id != null) {
ContractMO contract = (ContractMO) getGeneralDAO().getById(ContractMO.class, id);
company.setCompany(contract.getCompany());
person.setPerson(contract.getPerson());
notes.setNotes(contract.getNotes());
}
wizard.addEventListener(new WizardContext.EventListener() {
public void onGoto(Widget page) throws Exception {}
public void onSubmit() throws Exception {
log.debug("Event 'save' received!");
if (validate()) {
ContractMO contract = id != null ? (ContractMO) getGeneralDAO().getById(ContractMO.class, id) : new ContractMO();
contract.setCompany(company.getCompany());
contract.setPerson(person.getPerson());
contract.setNotes(notes.getNotes());
if (id != null) {
getGeneralDAO().edit(contract);
} else {
id = getGeneralDAO().add(contract);
}