private void expandParentNode(grdPneumaticRow selectedRow) { if (selectedRow.getValue() instanceof ElectrotherapyPneumaticShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyPneumaticShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; ElectrotherapyPneumaticVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && (voParentInstance.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))) { // If this is the Golden Node then we'll colour it golden (ok then beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getPneumaticTreatment() != null) { selectedRow.setValue(voParentInstance); selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getPneumaticTreatment()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(ElectrotherapyPneumaticVo voElectrotherapyPneumatic) { if (form.grdPneumatic().getValue() == null) return; if (voElectrotherapyPneumatic.getPneumaticTreatment() == null) voElectrotherapyPneumatic.setPneumaticTreatment(new ElectrotherapyPneumaticTreatmentVoCollection()); GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo || form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo ? form.grdPneumatic().getSelectedRow() : form.grdPneumatic().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voElectrotherapyPneumatic.getPneumaticTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voElectrotherapyPneumatic.getPneumaticTreatment().add((ElectrotherapyPneumaticTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private boolean newParentNode(ElectrotherapyPneumaticVo voNewParent) { if (voNewParent == null) return true; if(form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().getValue()==null || form.ctnPneumatic().lyrPneumatic().tabPneumatic().dtimAuthoringDateTime().getValue() == null) { engine.showMessage("'Authoring HCP' and 'Authoring Date / Time' are a mandatory fields."); return false; } ElectrotherapyPneumaticShortVo voParentShort = new ElectrotherapyPneumaticShortVo(); voParentShort.setAuthoringCP(form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnPneumatic().lyrPneumatic().tabPneumatic().dtimAuthoringDateTime().getValue()); voParentShort.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getRows().newRow(); parentRow.setColMachineUsed(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdPneumatic().setValue(voParentShort); return true; }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) form.ctnPneumatic().lyrPneumatic().showtabDetails(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else form.ctnPneumatic().lyrPneumatic().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_ElectrotherapyPneumaticIsNotNull())) enableParentControls(false); else enableParentControls(true); } }
private void populateParentNode(ElectrotherapyPneumaticShortVo voElectroPneumaticShort) { GenForm.grdPneumaticRow parRow = form.grdPneumatic().getRows().newRow(); parRow.setColMachineUsed(voElectroPneumaticShort.getAuthoringDateTime().toString()); //+ " - " + // voElectroPneumaticShort.getAuthoringCP().toString()); parRow.setValue(voElectroPneumaticShort); // if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && voElectroPneumaticShort.getClinicalContact().getID_ClinicalContact().equals // (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) // { form.grdPneumatic().setValue(voElectroPneumaticShort); expandParentNode(parRow); // } }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo)); form.setMode(FormMode.EDIT); if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) { ElectrotherapyPneumaticTreatmentVo voCachedChild = (ElectrotherapyPneumaticTreatmentVo) form.grdPneumatic().getValue(); if ( voCachedChild.getID_ElectrotherapyPneumaticTreatment() == null) { populateChildInstanceControls(voCachedChild); } } }
private void getSelectedInstance() { if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo) { populateParentInstanceControls((ElectrotherapyPneumaticVo) form.grdPneumatic().getValue()); } else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyPneumaticShortVo) form.grdPneumatic().getValue())); if (form.getLocalContext().getSelectedParentInstanceIsNotNull()) { populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdPneumatic().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment()); } form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) { GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getSelectedRow().getParentRow(); populateParentInstanceControls((ElectrotherapyPneumaticVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((ElectrotherapyPneumaticVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((ElectrotherapyPneumaticTreatmentVo) form.grdPneumatic().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(form.getLocalContext().getSelectedParentInstanceIsNotNull() ? new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())): false); updateControlsState(); }
private ElectrotherapyPneumaticVo getParentFromDomain(ElectrotherapyPneumaticShortVo voElectrotherapyPneumaticShort) { //return domain.getElectrotheraphyPneumaticVoByClinicalContact(voElectrotherapyPneumaticShort.getClinicalContact()); return domain.getElectrotheraphyPneumatic(voElectrotherapyPneumaticShort);// WDEV-13588 }
private void updateContextMenusState() { if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { if(form.getLocalContext().getGoldenInstanceSelectedIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().booleanValue()) { if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Pneumatic Detail"); form.getContextMenus().getGenericGridAddItem().setText("Add Pneumatic Detail"); form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdPneumatic().getSelectedRowIndex()>=0 && form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) || (form.getMode().equals(FormMode.EDIT) && form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo && ((ElectrotherapyPneumaticTreatmentVo)form.grdPneumatic().getValue()).getID_ElectrotherapyPneumaticTreatment() == null)); } else { if (Boolean.TRUE.equals(form.getLocalContext().getGoldenInstanceFound())) //WDEV-14292 { form.getContextMenus().hideAllGenericGridMenuItems(); return; } else { form.getContextMenus().getGenericGridAddItem().setText("New Pneumatic Therapy"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo && ((ElectrotherapyPneumaticTreatmentVo)form.grdPneumatic().getValue()).getID_ElectrotherapyPneumaticTreatment() == null); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }