private void populateScreenFromData(Object[] args, PersonNameCollection names) { if(names != null) { for(int i = 0; i < names.size(); i++) { PersonName name = names.get(i); addGridRow(name); } } if(args != null && args.length > 0) { if(args.length > 1 && args[1] instanceof Boolean) { form.getLocalContext().setCanAddOrEdit((Boolean) args[1]); } if(args[0] instanceof FormMode) { form.setMode((FormMode) args[0]); } } }
protected void onFormOpen() throws ims.framework.exceptions.FormOpenException { if (form.getGlobalContext().Core.getOtherNamesIsNotNull()) { PersonNameCollection names = form.getGlobalContext().Core.getOtherNames(); GenForm.grdNamesRow row; if (names != null) { for (int i = 0; i < names.size(); i++) { ims.core.vo.PersonName name = names.get(i); row = form.grdNames().getRows().newRow(); if (name.getNameTypeIsNotNull()) row.setcolNameType(name.getNameType().getText()); if (name.getForenameIsNotNull()) //WDEV-14050 { row.setcolName(name.getForename() + " " + name.getSurname()); } else row.setcolName(name.getSurname()); } } } // Unless using local patient registration, this form should go to view mode only if (!ConfigFlag.DOM.LOCAL_PATIENT_REGISTRATION.getValue() || form.getGlobalContext().Core.getParentFormMode().equals(FormMode.VIEW)) form.setMode(FormMode.VIEW); }
@Override protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { if(populateDataFromScreen()) { PersonName name = form.getLocalContext().getAddedItem(); if(name != null) { //newly added if(form.getGlobalContext().Core.getOtherNames() == null) form.getGlobalContext().Core.setOtherNames(new PersonNameCollection()); form.getGlobalContext().Core.getOtherNames().add(name); addGridRow(name); } else { name = form.getLocalContext().getEditedItem(); //edited grdNamesRow row = form.grdNames().getSelectedRow(); row.setcolSurname(name.getSurname()); row.setcolForename(name.getForename()); row.setcolNameType(name.getNameType()); } form.setMode(FormMode.VIEW); form.grdNames().setValue(name); } updateControlsStatus(); }
private PersonName getNameByObjectIdentifier(String objectidentifier, PersonNameCollection otherNames) { if(otherNames == null || objectidentifier == null) return null; for(PersonName pn : otherNames) { if(objectidentifier.equals(pn.getObjectidentifier())) return pn; } return null; }