@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { initialize(); if (args != null && args.length > 0 && args[0] instanceof PersonAddressCollection) { PersonAddressCollection voColl = (PersonAddressCollection)args[0]; populateRecordBrowser(voColl); } else if (args != null && args.length > 0 && args[0] instanceof PersonAddress){ form.getLocalContext().setPersonAddress((PersonAddress) args[0]); form.ccAddress().setValue((PersonAddress) args[0]); form.setMode(FormMode.EDIT); form.btnOk().setText("Save"); } }
private PersonAddressCollection sortByDate(PersonAddressCollection voColl) { PersonAddressCollection voHistoricalColl = new PersonAddressCollection(); for (int i = 0 ; i < voColl.size() ; i++) { if(voColl.get(i).getAddressTypeIsNotNull() && voColl.get(i).getAddressType().equals(AddressType.HISTORICAL)) voHistoricalColl.add(voColl.get(i)); } PersonAddressCollection voSortedHistoricalColl = new PersonAddressCollection(); while(voHistoricalColl!= null && voHistoricalColl.size()>0) { for (int i = 0 ; i < voHistoricalColl.size() ; i++) if(isNext(voHistoricalColl.get(i), voHistoricalColl)){ voSortedHistoricalColl.add(voHistoricalColl.get(i)); voHistoricalColl.remove(voHistoricalColl.get(i)); } } return voSortedHistoricalColl; }
private void displayOtherAdressesAndTooltip(PersonAddressCollection voCollAddresses) { //update GC form.getGlobalContext().Core.setOtherAddresses(voCollAddresses); if (form.getLocalContext().getPatient() == null) form.getLocalContext().setPatient(new Patient()); form.getLocalContext().getPatient().setAddresses(voCollAddresses); if (voCollAddresses == null || voCollAddresses.size() == 0) { if (form.getMode().equals(FormMode.VIEW)) form.imbAddress().setVisible(false); else form.imbAddress().setVisible(true); return; } voCollAddresses.sort(); String l_address = voCollAddresses.toDisplayString(); //display address form.txtOtherAddress().setValue(l_address); //set tooltip String l_addressHeader = Textile.setBold("OTHER ADDRESSES "); l_addressHeader += "\r\n"; l_addressHeader += l_address; l_addressHeader = new Textile().process(l_addressHeader); form.imbAddress().setTooltip(l_addressHeader); form.txtOtherAddress().setTooltip(l_addressHeader); }
private void populateRecordBrowser(PersonAddressCollection voColl) { PersonAddressCollection voHistoricalColl = sortByDate(voColl); for (int i = 0 ; i < voHistoricalColl.size() ; i++) { form.recbrAddress().newRow(voHistoricalColl.get(i), voHistoricalColl.get(i).toDisplayString()); } if(voHistoricalColl.size()>0) populateScreenFromData(voHistoricalColl.get(0)); }
private PersonAddressCollection getDTOHistoricAddresses(String hospnum, PersonAddressCollection addresses) { PersonAddressCollection collNonHistoricalAddresses = new PersonAddressCollection(); PersonAddressCollection collAddresses = new PersonAddressCollection(); try { collAddresses = domain.getDTOHistoricAddresses(hospnum); } catch (DomainInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Non Historical for (int i = 0 ; i < addresses.size() ; i++) { if(addresses.get(i).getAddressType()==null || !addresses.get(i).getAddressType().equals(AddressType.HISTORICAL)) collNonHistoricalAddresses.add(addresses.get(i)); } //add Non Historical for (int i = 0 ; i < collNonHistoricalAddresses.size() ; i++) collAddresses.add(collNonHistoricalAddresses.get(i)); form.getGlobalContext().Core.setOtherAddresses(collAddresses); return collAddresses; }
private void showHistoricAddressesButton(PersonAddressCollection addresses) { form.ccAddressSearch().setHistoricAddressBtnVisible(false); if(addresses!=null) for (int i = 0 ; i < addresses.size() ; i++) { if(addresses.get(i).getAddressTypeIsNotNull() && addresses.get(i).getAddressType().equals(AddressType.HISTORICAL)) { form.ccAddressSearch().setHistoricAddressBtnVisible(true); return; } } }
private void populateRecordBrowser(PersonAddressCollection voColl) { PersonAddressCollection voHistoricalColl = sortByDate(voColl); for (int i = 0 ; i < voHistoricalColl.size() ; i++) { form.recbrAddress().newRow(voHistoricalColl.get(i), reduceLength(voHistoricalColl.get(i).toDisplayString())); //WDEV-22882 } if(voHistoricalColl.size()>0) populateScreenFromData(voHistoricalColl.get(0)); }
@Override public void populateDataFromScreen(Patient patient) { patient.setAddress(getValue()); patient.setHARCCode(form.txtPctCode().getValue()); if(form.getGlobalContext().Core.getOtherAddresses()!=null) { if (patient.getAddresses() == null) patient.setAddresses(new PersonAddressCollection()); patient.setAddresses(form.getGlobalContext().Core.getOtherAddresses()); } }
private PersonAddress getAddressByObjectIdentifier(String objectidentifier, PersonAddressCollection addresses) { if(addresses == null || objectidentifier == null) return null; for(PersonAddress addr : addresses) { if(objectidentifier.equals(addr.getObjectidentifier())) return addr; } return null; }
private void initalize() { //update local context if (form.getGlobalContext().Core.getOtherAddressesIsNotNull()) { PersonAddressCollection coll = (ims.core.vo.PersonAddressCollection)form.getGlobalContext().Core.getOtherAddresses().clone(); PersonAddressCollection collNonHistorical = new PersonAddressCollection(); for(int i=0; i<coll.size(); i++) { if(coll.get(i).getAddressType()!=null && !coll.get(i).getAddressType().equals(AddressType.HISTORICAL)) collNonHistorical.add(coll.get(i)); } form.getLocalContext().setpersonAddressCol(collNonHistorical); } else form.getLocalContext().setpersonAddressCol(null); if (form.getLocalContext().getpersonAddressColIsNotNull() && form.getLocalContext().getpersonAddressCol().size() > 0) { for(PersonAddress pa:form.getLocalContext().getpersonAddressCol()) { if(pa.getAddressType()!=null && !pa.getAddressType().equals(AddressType.HISTORICAL))//WDEV-13009 exclude Historical addresses { form.recbrAddress().newRow(pa, pa.getLine1IsNotNull()?pa.getLine1():""); form.recbrAddress().setValue(pa); form.recbrAddress().setEnabled(true); } else if(pa.getAddressType()==null) { form.recbrAddress().newRow(pa, pa.getLine1IsNotNull()?pa.getLine1():""); form.recbrAddress().setValue(pa); form.recbrAddress().setEnabled(true); } } } form.cmbAddressType().removeRow(AddressType.NOKHOME); form.cmbAddressType().removeRow(AddressType.HISTORICAL);//WDEV-13009 exclude Historical type populateScreenFromData(form.recbrAddress().getValue()); form.btnClear().setVisible(true); form.btnNew().setVisible(true); form.btnUpdate().setVisible(true); form.btnOK().setVisible(true); form.setMode(FormMode.VIEW); }
protected void onBtnOKClick() throws ims.framework.exceptions.PresentationLogicException { if (form.getMode().equals(FormMode.EDIT)) { form.ccAddress().setRequireAdress(true); form.cmbAddressType().setRequired(true); if ( ! form.getLocalContext().getFieldsWereCleared() || (form.getLocalContext().getFieldsWereCleared() && !AddressFieldsAreEmpty()) || (form.getLocalContext().getFieldsWereCleared() && form.txtOtherPhone().getValue() != null) ) { form.getLocalContext().setFieldsWereCleared(false); String[] errors = validateUIRules(); if (errors != null) { engine.showErrors(errors); return; } } int nIndex = -1; if (form.getLocalContext().getaddressIndex() != -1) { for (int i = 0 ; i < form.getGlobalContext().Core.getOtherAddresses().size() ; i++) { if (form.getGlobalContext().Core.getOtherAddresses().get(i).equals(form.getLocalContext().getpersonAddress())) nIndex = i; } } if ( ! form.getLocalContext().getFieldsWereCleared()) { populateDataFromScreen(); //form.getLocalContext().getpersonAddress(); } else { form.getLocalContext().getpersonAddress().setAddressBuildingName(""); form.getLocalContext().getpersonAddress().setAddressBuildingNumber(""); form.getLocalContext().getpersonAddress().setAddressLocality(""); form.getLocalContext().getpersonAddress().setAddressCounty(""); form.getLocalContext().getpersonAddress().setAddressPostTown(""); form.getLocalContext().getpersonAddress().setAddressStreet(""); form.getLocalContext().getpersonAddress().setAddressLine5(""); form.getLocalContext().getpersonAddress().setPostCode(""); form.getLocalContext().getpersonAddress().setOtherphone(""); form.getLocalContext().getpersonAddress().setPhone(""); form.getLocalContext().getpersonAddress().setAddressType(null); } if (form.getLocalContext().getaddressIndex() != -1) //FB form.getGlobalContext().Core.getOtherAddresses().set(nIndex, form.getLocalContext().getpersonAddress()); else { //WDEV-14367 if (form.getGlobalContext().Core.getOtherAddresses()==null) form.getGlobalContext().Core.setOtherAddresses( new PersonAddressCollection()); form.getGlobalContext().Core.getOtherAddresses().add(form.getLocalContext().getpersonAddress()); } } engine.close(DialogResult.OK); }
private void displayOtherAdressesAndTooltip(PersonAddressCollection voCollAddresses) { // update GC form.getGlobalContext().Core.setOtherAddresses(voCollAddresses); PersonAddressCollection voTempColl = (PersonAddressCollection)voCollAddresses.clone(); //dont display Historic addresses in other address control for (int i = 0 ; i < voTempColl.size() ; i++) { if(voTempColl.get(i).getAddressTypeIsNotNull() && voTempColl.get(i).getAddressType().equals(AddressType.HISTORICAL)) voTempColl.remove(i); } if (voTempColl == null || voTempColl == null || voTempColl.size() == 0) { if (form.getMode().equals(FormMode.VIEW)) form.imbAddress().setVisible(false); else { form.imbAddress().setVisible(true); //WDEV-14367 form.txtOtherAddress().setValue(null); form.getGlobalContext().Core.setOtherAddresses(null); //form.getGlobalContext().Core.setOtherAddresses(new PersonAddressCollection()); } return; } voTempColl.sort(); String l_address = voTempColl.toDisplayString(); // display address form.txtOtherAddress().setValue(l_address); // set tooltip String l_addressHeader = Textile.setBold("OTHER ADDRESSES "); l_addressHeader += "\r\n"; l_addressHeader += l_address; l_addressHeader = new Textile().process(l_addressHeader); form.imbAddress().setTooltip(l_addressHeader); form.txtOtherAddress().setTooltip(l_addressHeader); }
protected void onBtnOKClick() throws ims.framework.exceptions.PresentationLogicException { if (form.getMode().equals(FormMode.EDIT)) { form.ccAddress().setRequireAdress(true); form.cmbAddressType().setRequired(true); if ( ! form.getLocalContext().getFieldsWereCleared() || (form.getLocalContext().getFieldsWereCleared() && !AddressFieldsAreEmpty()) || (form.getLocalContext().getFieldsWereCleared() && form.txtOtherPhone().getValue() != null)) { form.getLocalContext().setFieldsWereCleared(false); String[] errors = validateUIRules(); if (errors != null) { engine.showErrors(errors); return; } } int nIndex = -1; if (form.getLocalContext().getaddressIndex() != -1) { for (int i = 0 ; i < form.getGlobalContext().Core.getOtherAddresses().size() ; i++) { if (form.getGlobalContext().Core.getOtherAddresses().get(i).equals(form.getLocalContext().getpersonAddress())) nIndex = i; } } if ( ! form.getLocalContext().getFieldsWereCleared()) { populateDataFromScreen(); //form.getLocalContext().getpersonAddress(); } else if (form.getLocalContext().getpersonAddress()!=null) //WDEV-23248 { form.getLocalContext().getpersonAddress().setAddressBuildingName(""); form.getLocalContext().getpersonAddress().setAddressBuildingNumber(""); form.getLocalContext().getpersonAddress().setAddressLocality(""); form.getLocalContext().getpersonAddress().setAddressCounty(""); form.getLocalContext().getpersonAddress().setAddressPostTown(""); form.getLocalContext().getpersonAddress().setAddressStreet(""); form.getLocalContext().getpersonAddress().setAddressLine5(""); form.getLocalContext().getpersonAddress().setPostCode(""); form.getLocalContext().getpersonAddress().setOtherphone(""); form.getLocalContext().getpersonAddress().setPhone(""); form.getLocalContext().getpersonAddress().setAddressType(null); form.getLocalContext().getpersonAddress().setAreaOfResidence(null); //WDEV-17700 form.getLocalContext().getpersonAddress().setCounty(null); //WDEV-17700 } if (form.getLocalContext().getaddressIndex() != -1) //FB form.getGlobalContext().Core.getOtherAddresses().set(nIndex != -1 ? nIndex : form.getLocalContext().getaddressIndex(), form.getLocalContext().getpersonAddress()); //WDEV-20042 - fixed IndexOutOfBoundsExc when nIndex had the value assigned on initialisation. else { //WDEV-14367 if (form.getGlobalContext().Core.getOtherAddresses()==null) form.getGlobalContext().Core.setOtherAddresses( new PersonAddressCollection()); form.getGlobalContext().Core.getOtherAddresses().add(form.getLocalContext().getpersonAddress()); } } engine.close(DialogResult.OK); }
private void displayOtherAdressesAndTooltip(PersonAddressCollection voCollAddresses) //WDEV-17700 { // update GC form.getGlobalContext().Core.setOtherAddresses(voCollAddresses); PersonAddressCollection voTempColl = (PersonAddressCollection)voCollAddresses.clone(); clearOtherAddressesControls(); //WDEV-17700 //dont display Historic addresses in other address control for (int i = 0 ; i < voTempColl.size() ; i++) { if(voTempColl.get(i).getAddressTypeIsNotNull() && voTempColl.get(i).getAddressType().equals(AddressType.HISTORICAL)) voTempColl.remove(i); } if (voTempColl == null || voTempColl.size() == 0) //WDEV-17700 { if (form.getMode().equals(FormMode.VIEW)) form.imbAddress().setVisible(false); else { form.imbAddress().setVisible(true); //WDEV-14367 form.getGlobalContext().Core.setOtherAddresses(null); //form.getGlobalContext().Core.setOtherAddresses(new PersonAddressCollection()); } return; } voTempColl.sort(); String l_address = voTempColl.toDisplayString(); // display address if (l_address.length() > 0 && l_address != "No Other Addresses") //WDEV-17700 { form.txtOtherAddress().setValue(l_address); // set tooltip String l_addressHeader = Textile.setBold("OTHER ADDRESSES: "); l_addressHeader += "\r\n"; l_addressHeader += l_address; l_addressHeader = new Textile().process(l_addressHeader); form.imbAddress().setTooltip(l_addressHeader); form.txtOtherAddress().setTooltip(l_addressHeader); } }
private void displayOtherAdressesAndTooltip(PersonAddressCollection voCollAddresses) //WDEV-17700 { if(voCollAddresses== null)//WDEV-22338 { form.btnViewOtherAddresses().setTooltip(null); return; } // update GC form.getGlobalContext().Core.setOtherAddresses(voCollAddresses); PersonAddressCollection voTempColl = (PersonAddressCollection)voCollAddresses.clone(); //dont display Historic addresses in other address control for (int i = 0 ; i < voTempColl.size() ; i++) { if(voTempColl.get(i).getAddressTypeIsNotNull() && voTempColl.get(i).getAddressType().equals(AddressType.HISTORICAL) || voTempColl.get(i).getAddressType() == null) voTempColl.remove(i); } if (FormMode.EDIT.equals(form.getGlobalContext().Core.getParentFormMode())) { form.btnViewOtherAddresses().setVisible(true); //WDEV-14367 //form.getGlobalContext().Core.setOtherAddresses(null); } if (voTempColl == null || voTempColl.size() == 0) //WDEV-17700 { if (form.getMode().equals(FormMode.VIEW)) form.btnViewOtherAddresses().setVisible(false); return; } voTempColl.sort(); String l_address = voTempColl.toDisplayString(); // display address if (l_address.length() > 0 && l_address != "No Other Addresses") //WDEV-17700 { // set tooltip String l_addressHeader = Textile.setBold("OTHER ADDRESSES: "); l_addressHeader += "\r\n"; l_addressHeader += l_address; l_addressHeader = new Textile().process(l_addressHeader); form.btnViewOtherAddresses().setTooltip(l_addressHeader); } }