setViewSelector(id != null ? "contract/contractEdit" : "contract/contractAdd");
company = new ContractCompanyEditWidget();
person = new ContractPersonEditWidget();
notes = new ContractNotesEditWidget();
StandardWizardWidget wizard = new StandardWizardWidget();
addWidget("wizard", wizard);
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();