private void populateMergeRow(DynamicGridRow row, PatientMergeVo sourcePatient, PatientMergeVo destinationPatient) { if(row == null || sourcePatient == null || destinationPatient == null) return; if(row.getValue() instanceof PatientMergeFields) { populateCell(row.getCells().newCell(getColumn(COL_SOURCE_PATIENT), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), sourcePatient, null, false, false); populateCell(row.getCells().newCell(getColumn(COL_DESTINATION_PATIENT), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), destinationPatient, null, false, false); if(!PatientMergeFields.DATE_OF_DEATH.equals((PatientMergeFields) row.getValue())) { createMoveButtons(row); } populateCell(row.getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING), (PatientMergeFields) row.getValue(), destinationPatient, null, false, false); removeMoveButtons(row); } }
private DynamicGridRow getParentRow(PatientMergeFields patientMergeFields) { if(patientMergeFields == null) return null; if(patientMergeFields.getParent() != null) { for(int i=0 ; i<form.dyngrdMerge().getRows().size(); i++) { if(patientMergeFields.getParent().equals(form.dyngrdMerge().getRows().get(i).getValue())) return form.dyngrdMerge().getRows().get(i).getRows().newRow(); } } return form.dyngrdMerge().getRows().newRow(); }
private void addPatientMergeRow(PatientMergeFields patientMergeFields) { if(patientMergeFields == null) return; DynamicGridRow row = getParentRow(patientMergeFields); row.setSelectable(false); row.setExpanded(true); row.setValue(patientMergeFields); DynamicGridCell cell = row.getCells().newCell(getColumn(COL_FIELD_NAME), DynamicCellType.STRING); cell.setValue("<b>" + patientMergeFields.getText() + "</b>"); cell.setReadOnly(true); }
private void createMoveButtons(DynamicGridRow row) { DynamicGridCell sourceCell = row.getCells().get(getColumn(COL_SOURCE_PATIENT)); DynamicGridCell destinationCell = row.getCells().get(getColumn(COL_DESTINATION_PATIENT)); if((sourceCell != null && sourceCell.getValue() != null) || (destinationCell != null && destinationCell.getValue() != null) || PatientMergeFields.NAME.equals(row.getValue()) || PatientMergeFields.ADDRESS.equals(row.getValue()) || PatientMergeFields.COMMUNICATION_CHANNELS.equals(row.getValue())) { DynamicGridCell cell = row.getCells().newCell(getColumn(COL_SOURCE_BUTTONS), DynamicCellType.IMAGEBUTTON); cell.setValue(form.getImages().Core.UseSource); cell.setTooltip(SOURCE_BUTTON_TEXT); cell = row.getCells().newCell(getColumn(COL_DESTINATION_BUTTONS), DynamicCellType.IMAGEBUTTON); cell.setValue(form.getImages().Core.UseDestination); cell.setTooltip(DESTINATION_BUTTON_TEXT); } }
private void populateAddressCells(DynamicGridCell cell, PersonAddress address, boolean isFromSource) { if(cell == null) return; for(int i=0; i<cell.getRow().getRows().size(); i++) { DynamicGridRow row = cell.getRow().getRows().get(i); Object rowValue = cell.getRow().getRows().get(i).getValue(); DynamicGridCell resultCell = row.getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING); resultCell.setReadOnly(true); if(PatientMergeFields.ADDRESSLINE1.equals(rowValue)) { resultCell.setValue(address != null ? address.getLine1() : null ); } else if(PatientMergeFields.ADDRESSLINE2.equals(rowValue)) { resultCell.setValue(address != null ? address.getLine2() : null); } else if(PatientMergeFields.ADDRESSLINE3.equals(rowValue)) { resultCell.setValue(address != null ? address.getLine3() : null); } else if(PatientMergeFields.ADDRESSLINE4.equals(rowValue)) { resultCell.setValue(address != null ? address.getLine4() : null); } else if(PatientMergeFields.ADDRESSLINE5.equals(rowValue)) { resultCell.setValue(address != null ? address.getLine5() : null); } else if(PatientMergeFields.POSTCODE.equals(rowValue)) { resultCell.setValue(address != null ? address.getPostCode() : null); } else if(PatientMergeFields.PHONE.equals(rowValue)) { resultCell.setValue(address != null ? address.getPhone() : null); } else if(PatientMergeFields.FAX.equals(rowValue)) { resultCell.setValue(address != null ? address.getFax() : null); } else if(PatientMergeFields.ADDRESSTYPE.equals(rowValue)) { resultCell.setValue((address != null && address.getAddressType() != null) ? address.getAddressType().getText() : null); } else if(PatientMergeFields.CCG.equals(rowValue)) { resultCell.setValue(address != null ? address.getPCT() : null); } else if(PatientMergeFields.OTHERPHONE.equals(rowValue)) { resultCell.setValue(address != null ? address.getOtherphone() : null); } resultCell.setBackColor(isFromSource ? Color.Beige : null); DynamicGridCell wasDestinationModified = row.getCells().get(getColumn(COL_WAS_MODIFIED)); if(wasDestinationModified == null) wasDestinationModified = row.getCells().newCell(getColumn(COL_WAS_MODIFIED), DynamicCellType.BOOL); wasDestinationModified.setValue(isFromSource ? Boolean.TRUE : Boolean.FALSE); } }
private void populateNameCells(DynamicGridCell cell, PersonName name, boolean isFromSource) { if(cell == null) return; for(int i=0; i<cell.getRow().getRows().size(); i++) { DynamicGridRow row = cell.getRow().getRows().get(i); Object rowValue = row.getValue(); DynamicGridCell resultCell = row.getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING); resultCell.setReadOnly(true); if(PatientMergeFields.TITLE.equals(rowValue)) { resultCell.setValue((name != null && name.getTitle() != null) ? name.getTitle().toString() : null); } else if(PatientMergeFields.SURNAME.equals(rowValue)) { resultCell.setValue(name != null ? name.getSurname() : null); } else if(PatientMergeFields.FORENAME.equals(rowValue)) { resultCell.setValue(name != null ? name.getForename() : null); } else if(PatientMergeFields.MIDDLENAME.equals(rowValue)) { resultCell.setValue(name != null ? name.getMiddleName() : null); } resultCell.setBackColor(isFromSource && !sourceIsEqualWithDestination(row) ? Color.Beige : null); if(!sourceIsEqualWithDestination(row)) { DynamicGridCell wasDestinationModified = row.getCells().get(getColumn(COL_WAS_MODIFIED)); if(wasDestinationModified == null) wasDestinationModified = row.getCells().newCell(getColumn(COL_WAS_MODIFIED), DynamicCellType.BOOL); wasDestinationModified.setValue(isFromSource ? Boolean.TRUE : Boolean.FALSE); } } }
@Override protected void onMessageBoxClosed(int messageBoxId, DialogResult result) throws PresentationLogicException { if(form.getLocalContext().getMessageBoxIdFromGPAndGPSurgery() != null && messageBoxId == form.getLocalContext().getMessageBoxIdFromGPAndGPSurgery()) { if(DialogResult.YES.equals(result)) { form.getLocalContext().getResultPatient().setGp(form.getLocalContext().getNewGP() != null ? new GpShortVo(form.getLocalContext().getNewGP().getID_Gp(), form.getLocalContext().getNewGP().getVersion_Gp()) : null); form.getLocalContext().getResultPatient().setGpSurgery(form.getLocalContext().getNewGPSurgery() != null ? new LocSiteShortVo(form.getLocalContext().getNewGPSurgery().getID_Location(), form.getLocalContext().getNewGPSurgery().getVersion_Location()) : null); for(int i=0; i<form.dyngrdMerge().getRows().size(); i++) { DynamicGridCell cell = null; if(PatientMergeFields.GP.equals(form.dyngrdMerge().getRows().get(i).getValue()) || PatientMergeFields.GP_SURGERY.equals(form.dyngrdMerge().getRows().get(i).getValue())) { cell = form.dyngrdMerge().getRows().get(i).getCells().get(getColumn(COL_RESULT_DATA)); if(cell == null) cell = form.dyngrdMerge().getRows().get(i).getCells().newCell(getColumn(COL_RESULT_DATA), DynamicCellType.STRING); if(PatientMergeFields.GP.equals(form.dyngrdMerge().getRows().get(i).getValue())) { cell.setValue(form.getLocalContext().getNewGP() != null ? form.getLocalContext().getNewGP().getName().toString() : null); } else if(PatientMergeFields.GP_SURGERY.equals(form.dyngrdMerge().getRows().get(i).getValue())) { cell.setValue(form.getLocalContext().getNewGPSurgery() != null ? form.getLocalContext().getNewGPSurgery().getName() : null); } cell.setBackColor(form.getLocalContext().getCellColor()); } } } form.getLocalContext().setMessageBoxIdFromGPAndGPSurgery(null); } else if(form.getLocalContext().getMessageBoxIdFromAddresCollection() != null && messageBoxId == form.getLocalContext().getMessageBoxIdFromAddresCollection()) { if(DialogResult.YES.equals(result)) { form.getLocalContext().getResultPatient().setAddresses(form.getLocalContext().getAddressCollection()); } } }