private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) form.ctnDetails().lyrTENS().showtabHeader(); else if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) form.ctnDetails().lyrTENS().showtabDetails(); else form.ctnDetails().lyrTENS().showtabEmpty1(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnDetails().lyrTENS().showtabHeader(); else form.ctnDetails().lyrTENS().showtabDetails(); } }
private void expandParentNode(grdTENSRow selectedRow) { if (selectedRow.getValue() instanceof ElectrotherapyTENSShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyTENSShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; ElectrotherapyTENSVo 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.getTensTreatmentsIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getTensTreatments()); } populateParentInstanceControls(voParentInstance); }
private void newParentNode(ElectrotherapyTENSVo voNewParent) { if (voNewParent == null) return; ElectrotherapyTENSShortVo voParentShort = new ElectrotherapyTENSShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdTENSRow parentRow = form.grdTENS().getRows().newRow(); if(voParentShort.getAuthoringCP() != null) parentRow.setcolAreaParent(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdTENS().setValue(voParentShort); }
private void populateChildCollectionFromGrid(ElectrotherapyTENSVo voTENS) { if (form.grdTENS().getValue() == null) return; if (voTENS.getTensTreatments() == null) voTENS.setTensTreatments(new ElectrotherapyTensTreatmentVoCollection()); GenForm.grdTENSRow parentRow = form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo ? form.grdTENS().getSelectedRow() : form.grdTENS().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voTENS.getTensTreatments().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voTENS.getTensTreatments().add((ElectrotherapyTensTreatmentVo) parentRow.getRows().get(i).getValue()); } }
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.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyTENSShortVo) form.grdTENS().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); //add activities if not added already populateChildNodes(form.grdTENS().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getTensTreatments()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) { form.getLocalContext().setSelectedChildInstance((ElectrotherapyTensTreatmentVo) form.grdTENS().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if (form.getGlobalContext().Core.getCurrentClinicalContact() == null) form.getLocalContext().setGoldenInstanceSelected(new Boolean(false)); else form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { form.btnNew().setVisible(false); form.btnUpdate().setVisible(false); } }
private void populateParentNode(ElectrotherapyTENSShortVo voTENS) { GenForm.grdTENSRow parRow = form.grdTENS().getRows().newRow(); parRow.setcolAreaParent(voTENS.getAuthoringDateTime().toString()); parRow.setValue(voTENS); form.grdTENS().setValue(voTENS); expandParentNode(parRow); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if (form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) form.grdTENS().setValue(form.grdTENS().getSelectedRow().getValue()); else if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) form.grdTENS().setValue(form.grdTENS().getSelectedRow().getParentRow().getValue()); }
private void removeChild() { ElectrotherapyTENSShortVo voParent = (ElectrotherapyTENSShortVo) form.grdTENS().getSelectedRow().getParentRow().getValue(); form.grdTENS().removeSelectedRow(); form.grdTENS().setValue(voParent); updateContextMenusState(); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo)); form.setMode(FormMode.EDIT); if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) { ElectrotherapyTensTreatmentVo voChild = (ElectrotherapyTensTreatmentVo) form.grdTENS().getValue(); if ( voChild.getID_ElectrotherapyTensTreatment() == null) { populateChildInstanceControls(voChild); } } disableHeaderInfo(); }
private ElectrotherapyTENSVo getParentFromDomain(ElectrotherapyTENSShortVo voTENSShort) { //return domain.getElectrotherapyTens(voTENSShort.getClinicalContact()); return domain.getElectrotherapyTensByRef(voTENSShort);// WDEV-13592 }
private void updateContextMenusState() { if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { 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.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit TENS Treatment Details"); // If the golden node is selected we can now only add child nodes so set the menu text accordingly. form.getContextMenus().getGenericGridAddItem().setText("Add TENS Treatment Details"); // Only show the update menu if the user has selected an item to update. form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdTENS().getSelectedRowIndex()>=0) && form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo || (form.getMode().equals(FormMode.EDIT) && form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo && ((ElectrotherapyTensTreatmentVo)form.grdTENS().getValue()).getID_ElectrotherapyTensTreatment() == 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 TENS Record"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo && ((ElectrotherapyTensTreatmentVo)form.grdTENS().getValue()).getID_ElectrotherapyTensTreatment() == null); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }