private String[] validateUIRules() { ArrayList<String> errorList = new ArrayList<String>(); if( form.dtimReferredDateTime().getValue() == null ) { errorList.add("Referred Date Time is mandatory"); } else if( form.dtimReferredDateTime().getValue() != null && form.dtimReferredDateTime().getValue().isGreaterThan(new DateTime())) { errorList.add("Referred Date Time cannot be in the future"); } if( form.dtimAcceptedDateTime().getValue() != null && form.dtimAcceptedDateTime().getValue().isGreaterThan(new DateTime() )) { errorList.add("Accepted Date Time cannot be in the future"); } if( form.cmbHospital().getValue() == null ) { errorList.add("Hospital is mandatory"); } else if( form.cmbHospital().getValue() != null && form.cmbHospital().getValue().equals(TransferToHospital.OTHER) ) { if( form.txtOtherHospital().getValue() == null) { errorList.add(" Other Hospital is mandatory"); } } return errorList.toArray(new String[errorList.size()]); }
private void updateControlsState() { if( form.cmbHospital().getValue() != null && form.cmbHospital().getValue().equals(TransferToHospital.OTHER)) { form.txtOtherHospital().setRequired(true); } else form.txtOtherHospital().setRequired(false); }
private String getTransfer(EDTransferVo edTransferVo) { if(edTransferVo == null) return null; if(edTransferVo.getToHospital() != null && !TransferToHospital.OTHER.equals(edTransferVo.getToHospital())) return edTransferVo.getToHospital().getText(); if(edTransferVo.getOtherHospital() != null) return edTransferVo.getOtherHospital(); return null; }
private String[] validateUIRules() { ArrayList<String> errorList = new ArrayList<String>(); if( form.dtimReferredDateTime().getValue() == null ) { errorList.add("Referred Date/Time is mandatory"); } else if( form.dtimReferredDateTime().getValue() != null && form.dtimReferredDateTime().getValue().isGreaterThan(new DateTime())) { errorList.add("Referred Date/Time cannot be in the future"); } if( form.dtimAcceptedDateTime().getValue() != null && form.dtimAcceptedDateTime().getValue().isGreaterThan(new DateTime() )) { errorList.add("Accepted Date/Time cannot be in the future"); } if( form.dtimAcceptedDateTime().getValue() != null && form.dtimReferredDateTime().getValue() != null && (form.dtimReferredDateTime().getValue().getDate().isGreaterThan(form.dtimAcceptedDateTime().getValue().getDate()) || (form.dtimReferredDateTime().getValue().getDate().equals(form.dtimAcceptedDateTime().getValue().getDate()) && form.dtimReferredDateTime().getValue().getTime().isGreaterThan(form.dtimAcceptedDateTime().getValue().getTime())))) { errorList.add("Referred Date/Time cannot be earlier than Accepted Date/Time"); } if( form.cmbHospital().getValue() == null ) { errorList.add("Hospital is mandatory"); } else if( form.cmbHospital().getValue() != null && form.cmbHospital().getValue().equals(TransferToHospital.OTHER) ) { if( form.txtOtherHospital().getValue() == null) { errorList.add("Other Hospital is mandatory"); } } if( form.ccRefferedBy().getValue() == null ) { errorList.add("Referred by is mandatory"); } return errorList.toArray(new String[errorList.size()]); }
private String getTextDisplay(EDTransferVo transfer) { if (transfer == null) return null; StringBuffer text = new StringBuffer(); if (transfer.getReferredDateTimeIsNotNull()) { text.append("Date/Time Referred: " + transfer.getReferredDateTime().toString()); } if (transfer.getReferredBy() != null && transfer.getReferredBy().getName()!=null) { text.append(" - "); text.append(transfer.getReferredBy().getName()); } if (transfer.getToHospitalIsNotNull() && !TransferToHospital.OTHER.equals(transfer.getToHospital())) { text.append(" - "); text.append(transfer.getToHospital().getText()); } else if ((transfer.getToHospitalIsNotNull() && TransferToHospital.OTHER.equals(transfer.getToHospital()))) { text.append(" - "); text.append(transfer.getOtherHospital()); } return text.length() > 0 ? text.toString() : null; }
private void updateControlsState() { form.btnNewTransfer().clearBackgroundColor(); form.btnAccepted().clearBackgroundColor(); form.btnNotAccepted().clearBackgroundColor(); form.txtOtherHospital().setRequired(FormMode.EDIT.equals(form.getMode()) && TransferToHospital.OTHER.equals(form.cmbHospital().getValue())); form.txtOtherHospital().setEnabled(FormMode.EDIT.equals(form.getMode()) && TransferToHospital.OTHER.equals(form.cmbHospital().getValue())); form.dtimAcceptedDateTime().setEnabled(FormMode.EDIT.equals(form.getMode()) && form.dtimAcceptedDateTime().getValue() != null); if (FormMode.VIEW.equals(form.getMode())) { form.btnEdit().setVisible(form.recbrTransfers().getValue() != null); } form.ccRefferedBy().isRequired(FormMode.EDIT.equals(form.getMode())); form.btnAccepted().setEnabled(FormMode.VIEW.equals(form.getMode()) && form.recbrTransfers().getValue() != null && !form.recbrTransfers().getValue().getAcceptedDateTimeIsNotNull() && !Boolean.TRUE.equals(form.recbrTransfers().getValue().getNotAccepted())); form.btnNotAccepted().setEnabled(FormMode.VIEW.equals(form.getMode()) && form.recbrTransfers().getValue() != null && !form.recbrTransfers().getValue().getAcceptedDateTimeIsNotNull() && !Boolean.TRUE.equals(form.recbrTransfers().getValue().getNotAccepted())); form.btnNewTransfer().setVisible(FormMode.VIEW.equals(form.getMode())); if (form.btnAccepted().isEnabled()) form.btnAccepted().setBackgroundColor(Color.LightYellow); if (form.btnNotAccepted().isEnabled()) form.btnNotAccepted().setBackgroundColor(Color.NavajoWhite); if (form.btnNewTransfer().isVisible()) form.btnNewTransfer().setBackgroundColor(Color.LightGreen); }