private void expandParentNode(gridDetailsRow selectedRow) { if (selectedRow.getValue() instanceof BobathShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((BobathShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; BobathVo 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(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getBobathTreatment() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getBobathTreatment()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(BobathVo voBobath) { if (form.gridDetails().getValue() == null) return; if (voBobath.getBobathTreatment() == null) voBobath.setBobathTreatment(new BobathTreatmentVoCollection()); GenForm.gridDetailsRow parentRow = form.gridDetails().getValue() instanceof BobathVo || form.gridDetails().getValue() instanceof BobathShortVo ? form.gridDetails().getSelectedRow() : form.gridDetails().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voBobath.getBobathTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voBobath.getBobathTreatment().add((BobathTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.gridDetails().getValue() instanceof BobathShortVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathTreatmentVo) form.ctnDetail().lyrBoBath().showtabAreaDetail(); enableParentControls(false); } else { if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_BobathIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnDetail().lyrBoBath().showtabBoBath(); else form.ctnDetail().lyrBoBath().showtabAreaDetail(); } }
private void populateParentNode(BobathShortVo voBobathShort) { GenForm.gridDetailsRow parRow = form.gridDetails().getRows().newRow(); parRow.setColAreaTreated(voBobathShort.getAuthoringDateTime().toString()+ " - " + voBobathShort.getAuthoringHCP().toString()); parRow.setValue(voBobathShort); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && voBobathShort.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { form.gridDetails().setValue(voBobathShort); form.getLocalContext().setUpdatingParentInstance(voBobathShort); expandParentNode(parRow); } }
private BobathVo getParentFromDomain(BobathShortVo voBoBathShort) { if( engine.isRIEMode()) return domain.getBoBathById(voBoBathShort); //wdev-13807 else return domain.getBoBath(voBoBathShort.getClinicalContact()); }
private boolean newParentNode(BobathVo voNewParent) { if (voNewParent == null) return true; BobathShortVo voParentShort = new BobathShortVo(); voParentShort.setAuthoringHCP(form.ctnDetail().lyrBoBath().tabBoBath().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnDetail().lyrBoBath().tabBoBath().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.gridDetailsRow parentRow = form.gridDetails().getRows().newRow(); parentRow.setColAreaTreated(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringHCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); form.getLocalContext().setUpdatingParentInstance(voParentShort); parentRow.setExpanded(true); form.gridDetails().setValue(voParentShort); return true; }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.gridDetails().getValue() instanceof BobathShortVo)); form.setMode(FormMode.EDIT); if (form.gridDetails().getValue() instanceof BobathTreatmentVo) { BobathTreatmentVo voCachedChild = (BobathTreatmentVo) form.gridDetails().getValue(); if ( voCachedChild.getID_BobathTreatment() == null) { populateChildInstanceControls(voCachedChild); } } }
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; } if(form.gridDetails().getValue() instanceof BobathVo) { form.getLocalContext().setSelectedChildInstance(null); //WDEV-13808 clearChildInstanceControls(); //WDEV-13808 populateParentInstanceControls((BobathVo) form.gridDetails().getValue()); } if(form.gridDetails().getValue() instanceof BobathShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((BobathShortVo) form.gridDetails().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); //add children if not added already populateChildNodes(form.gridDetails().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getBobathTreatment()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.gridDetails().getValue() instanceof BobathTreatmentVo) { GenForm.gridDetailsRow parentRow = form.gridDetails().getSelectedRow().getParentRow(); populateParentInstanceControls((BobathVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((BobathVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((BobathTreatmentVo) form.gridDetails().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); }
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.gridDetails().getValue() instanceof BobathShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.gridDetails().getValue() instanceof BobathTreatmentVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Bobath 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 Bobath 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.gridDetails().getSelectedRowIndex()>=0) && form.gridDetails().getValue() instanceof BobathTreatmentVo || (form.getMode().equals(FormMode.EDIT) && form.gridDetails().getValue() instanceof BobathTreatmentVo && ((BobathTreatmentVo)form.gridDetails().getValue()).getID_BobathTreatment() == 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 Bobath"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.gridDetails().getValue() instanceof BobathTreatmentVo && ((BobathTreatmentVo)form.gridDetails().getValue()).getID_BobathTreatment() == null); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }