private void newParentNode(ElectrotherapyUltrasoundVo voNewParent) { if (voNewParent == null) return; ElectrotherapyUltrasoundShortVo voParentShort = new ElectrotherapyUltrasoundShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdHierarchyRow parentRow = form.grdHierarchy().getRows().newRow(); parentRow.setColTarget(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(Boolean.TRUE); parentRow.setExpanded(true); form.grdHierarchy().setValue(voParentShort); }
private void populateParentNode(ElectrotherapyUltrasoundShortVo voUltrasoundParent) { GenForm.grdHierarchyRow parRow = form.grdHierarchy().getRows().newRow(); parRow.setColTarget(voUltrasoundParent.getAuthoringDateTime().toString()+ " - " + voUltrasoundParent.getAuthoringCP().toString()); parRow.setValue(voUltrasoundParent); if(voUltrasoundParent != null && voUltrasoundParent.getClinicalContactIsNotNull() && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && voUltrasoundParent.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { form.grdHierarchy().setValue(voUltrasoundParent); expandParentNode(parRow); } }
private void populateChildCollectionFromGrid(ElectrotherapyUltrasoundVo voElectrotherapyUltrasound) { if (form.grdHierarchy().getValue() == null) return; if (voElectrotherapyUltrasound.getUltrasoundTreatments() == null) voElectrotherapyUltrasound.setUltrasoundTreatments(new ElectrotherapyUltrasoundTreatmentVoCollection()); GenForm.grdHierarchyRow parentRow = form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo ? form.grdHierarchy().getSelectedRow() : form.grdHierarchy().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voElectrotherapyUltrasound.getUltrasoundTreatments().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voElectrotherapyUltrasound.getUltrasoundTreatments().add((ElectrotherapyUltrasoundTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo) form.ctnUltra().lyrUltra().showtabHeader(); else if (form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo) form.ctnUltra().lyrUltra().showtabDetails(); else form.ctnUltra().lyrUltra().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnUltra().lyrUltra().showtabHeader(); else form.ctnUltra().lyrUltra().showtabDetails(); } }
private void removeChild() { ElectrotherapyUltrasoundShortVo voParent = (ElectrotherapyUltrasoundShortVo) form.grdHierarchy().getSelectedRow().getParentRow().getValue(); form.grdHierarchy().removeSelectedRow(); form.grdHierarchy().setValue(voParent); updateContextMenusState(); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(Boolean.valueOf(form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo)); if (form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo) { ElectrotherapyUltrasoundTreatmentVo voCachedChild = (ElectrotherapyUltrasoundTreatmentVo) form.grdHierarchy().getValue(); if ( voCachedChild.getID_ElectrotherapyUltrasoundTreatment() == null) { populateChildInstanceControls(voCachedChild); } } form.setMode(FormMode.EDIT); }
private void getSelectedInstance() { // In update mode we can select nodes without displaying anything but the context // menus can change based on what's selected so we need to update them if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyUltrasoundShortVo) form.grdHierarchy().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo) { // form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyUltrasoundShortVo) form.grdHierarchy().getSelectedRow().getParentRow().getValue())); form.getLocalContext().setSelectedChildInstance((ElectrotherapyUltrasoundTreatmentVo) form.grdHierarchy().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } form.getLocalContext().setGoldenInstanceSelected(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() ? Boolean.valueOf(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) : Boolean.FALSE); updateControlsState(); }
/** * @calls the Domain Get for the selected node.. * */ private void expandParentNode(GenForm.grdHierarchyRow selectedRow) { if (selectedRow.getValue() instanceof ElectrotherapyUltrasoundShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyUltrasoundShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; ElectrotherapyUltrasoundVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(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(Boolean.TRUE); form.getLocalContext().setGoldenInstanceSelected(Boolean.TRUE); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getUltrasoundTreatments() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getUltrasoundTreatments()); } populateParentInstanceControls(voParentInstance); }
private void enableParentControls() { boolean boolEnabled = (form.getMode().equals(FormMode.EDIT) && form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo); form.ctnUltra().lyrUltra().tabHeader().dtimAuthoringDateTime().setEnabled(boolEnabled); form.ctnUltra().lyrUltra().tabHeader().qmbAuthoringCP().setEnabled(boolEnabled); }
private ElectrotherapyUltrasoundVo getParentFromDomain(ElectrotherapyUltrasoundShortVo voEUltraShort) { return domain.getUltrasound(voEUltraShort); }
private void updateContextMenusState() { if(form.getLocalContext().getGoldenInstanceSelected().booleanValue()) { // If the golden instance is currently selected we change the text of the update context menu // based on whether a parent or child node is selected in the grid. if (form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundShortVo) form.getContextMenus().getGenericGridUpdateItem().setText("Update Electrotherapy Ultrasound"); else if (form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo) form.getContextMenus().getGenericGridUpdateItem().setText("Update Ultrasound Treatment"); // If the golden node is selected we can now only add child nodes so set the menu text accordingly. form.getContextMenus().getGenericGridAddItem().setText("Add Ultrasound Treatment"); // Only show the update menu if the user has selected an item to update. form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdHierarchy().getSelectedRowIndex()>=0) || (form.getMode().equals(FormMode.EDIT) && form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo && ((ElectrotherapyUltrasoundTreatmentVo)form.grdHierarchy().getValue()).getID_ElectrotherapyUltrasoundTreatment() == null)); } else { // If the golden instance has been found but NOT selected hide the context menu's if (form.getLocalContext().getGoldenInstanceFound().booleanValue() == true) { form.getContextMenus().hideAllGenericGridMenuItems(); return; } else { form.getContextMenus().getGenericGridAddItem().setText("New Electrotherapy Ultrasound"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.grdHierarchy().getValue() instanceof ElectrotherapyUltrasoundTreatmentVo && ((ElectrotherapyUltrasoundTreatmentVo)form.grdHierarchy().getValue()).getID_ElectrotherapyUltrasoundTreatment() == null); }