protected void onGrdFormLookupsSelectionChanged() throws PresentationLogicException { FormLookupVo formLookup = form.lyr1().Forms().grdFormLookups().getValue(); form.txtFilter().setValue(formLookup.getLookupType().getName()); form.chkUserTypes().setValue(false); LookupTypeVoCollection coll = domain.getTypes(formLookup.getLookupType().getName(),Boolean.valueOf(false),Boolean.valueOf(false),Boolean.valueOf(true)); form.getLocalContext().settypeColl(coll); populateTree(coll); if (coll.size() > 0) { for (int i = 0 ; i < coll.size() ; i++) { if (coll.get(i).getName() != null && formLookup.getLookupType().getName() != null && coll.get(i).getName().equals(formLookup.getLookupType().getName())) populateCombo(coll.get(i)); } } form.lyr1().Forms().cmbDefInst().setValue(formLookup.getDefaultInstance()); form.getLocalContext().setFormLookup(formLookup); }
protected void onBtnSetDefaultClick() throws PresentationLogicException { FormLookupVo formLookup = form.getLocalContext().getFormLookup(); if (formLookup == null) return; formLookup.setDefaultInstance(form.lyr1().Forms().cmbDefInst().getValue()); try { domain.saveDefaultInstance(form.getLocalContext().getChosenForm(), formLookup); } catch (StaleObjectException e) { engine.showMessage(e.getMessage()); } }
private void populateLookupsGrid(FormLookupVoCollection lookups) { if (lookups == null || lookups.size() == 0) return; form.lyrDetails().tabDetails().grdLookups().getRows().clear(); for (int i = 0; i < lookups.size(); i++) { FormLookupVo lookup = lookups.get(i); grdLookupsRow row = form.lyrDetails().tabDetails().grdLookups().getRows().newRow(); row.setColName(lookup.getLookupType().getName()); row.setColDesc(lookup.getLookupType().getDescription()); } }
public void saveDefaultInstance(AppFormRefVo formRef, FormLookupVo defInst) throws StaleObjectException { if (formRef == null) return; if (defInst == null) return; DomainFactory factory = getDomainFactory(); AppForm domForm = (AppForm) factory.getDomainObject(formRef); LookupInstance lookupInst = null; if (defInst.getDefaultInstance() != null) { lookupInst = factory.getLookupInstance(defInst.getDefaultInstance().getId()); } List lookupTypes = domForm.getLookups(); for (Iterator iter = lookupTypes.iterator(); iter.hasNext();) { AppFormLookup element = (AppFormLookup) iter.next(); if (element.getLookupType().getId() == defInst.getLookupType().getId()) { element.setDefaultInstance(lookupInst); factory.save(domForm); } } //MN this.getLookupService().clearDefaultInstanceCache(formRef.getID_AppForm().intValue(), defInst.getLookupType().getId()); }