private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdGait().getValue() instanceof GaitShortVo) form.ctnGait().lyrGait().showtabHeader(); else if (form.grdGait().getValue() instanceof GaitTreatmentVo) form.ctnGait().lyrGait().showtabDetail(); else form.ctnGait().lyrGait().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnGait().lyrGait().showtabHeader(); else form.ctnGait().lyrGait().showtabDetail(); } }
private void populateParentNode(GaitShortVo voGaitParent) { GenForm.grdGaitRow parRow = form.grdGait().getRows().newRow(); parRow.setColEnvironment(voGaitParent.getAuthoringDateTime().toString()+ " - " + voGaitParent.getAuthoringHCP().toString()); parRow.setValue(voGaitParent); if (form.getGlobalContext().Core.getCurrentClinicalContact() != null && voGaitParent.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { form.grdGait().setValue(voGaitParent); } expandParentNode(parRow); }
private void newParentNode(GaitVo voNewParent) { if (voNewParent == null) return; GaitShortVo voParentShort = new GaitShortVo(); voParentShort.setAuthoringHCP(voNewParent.getAuthoringHCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact((ClinicalContactShortVo) voNewParent.getClinicalContact()); GenForm.grdGaitRow parentRow = form.grdGait().getRows().newRow(); if(voParentShort.getAuthoringHCPIsNotNull() && voParentShort.getAuthoringDateTimeIsNotNull()) parentRow.setColEnvironment(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringHCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdGait().setValue(voParentShort); }
private void populateChildCollectionFromGrid(GaitVo voGait) { if (form.grdGait().getValue() == null) return; if (voGait.getGaitTreatment() == null) voGait.setGaitTreatment(new GaitTreatmentVoCollection()); GenForm.grdGaitRow parentRow = form.grdGait().getValue() instanceof GaitShortVo ? form.grdGait().getSelectedRow() : form.grdGait().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voGait.getGaitTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voGait.getGaitTreatment().add((GaitTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdGait().getValue() instanceof GaitShortVo)); if (form.grdGait().getValue() instanceof GaitTreatmentVo) { GaitTreatmentVo voCachedChild = (GaitTreatmentVo) form.grdGait().getValue(); if ( voCachedChild.getID_GaitTreatment() == null) { populateChildInstanceControls(voCachedChild); } form.getLocalContext().setSelectedChildInstance(voCachedChild); } form.setMode(FormMode.EDIT); disableHeaderInfo(); }
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; } GenForm.grdGaitRow parentRow = null; //expand the selected parent if(form.grdGait().getValue() instanceof GaitShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((GaitShortVo) form.grdGait().getValue())); parentRow = form.grdGait().getSelectedRow(); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdGait().getValue() instanceof GaitTreatmentVo) { form.getLocalContext().setSelectedChildInstance((GaitTreatmentVo) form.grdGait().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); form.getLocalContext().setSelectedParentInstance(getParentFromDomain((GaitShortVo) form.grdGait().getSelectedRow().getParentRow().getValue())); parentRow = form.grdGait().getSelectedRow().getParentRow(); } if (form.getGlobalContext().Core.getCurrentClinicalContact() == null) form.getLocalContext().setGoldenInstanceSelected(new Boolean(false)); else { GaitShortVo voGaitShort = (GaitShortVo)parentRow.getValue(); form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact(). equals(voGaitShort.getClinicalContact().getID_ClinicalContact()))); } updateControlsState(); }
private void expandParentNode(grdGaitRow selectedRow) { if (selectedRow.getValue() instanceof GaitShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((GaitShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; GaitVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if (form.getGlobalContext().Core.getCurrentClinicalContact() != null && 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.getGaitTreatment() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getGaitTreatment()); } populateParentInstanceControls(voParentInstance); }
private void removeChild() { GaitShortVo voParent = (GaitShortVo) form.grdGait().getSelectedRow().getParentRow().getValue(); form.grdGait().removeSelectedRow(); form.grdGait().setValue(voParent); updateContextMenusState(); }
private GaitVo getParentFromDomain(GaitShortVo voGaitShort) { return domain.getGait(voGaitShort.getClinicalContact()); }
private void updateContextMenusState() { boolean bByClinicalContact = 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.grdGait().getValue() instanceof GaitShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdGait().getValue() instanceof GaitTreatmentVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit gait 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 Gait Treatment"); form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdGait().getSelectedRowIndex()>=0) && form.grdGait().getValue() instanceof GaitTreatmentVo || (form.getMode().equals(FormMode.EDIT) && form.grdGait().getValue() instanceof GaitTreatmentVo && ((GaitTreatmentVo)form.grdGait().getValue()).getID_GaitTreatment() == 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 Gait"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW) && bByClinicalContact); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && bByClinicalContact && form.grdGait().getValue() instanceof GaitTreatmentVo && ((GaitTreatmentVo)form.grdGait().getValue()).getID_GaitTreatment() == null); }