private void expandParentNode(grdSummaryRow selectedRow) { if (selectedRow.getValue() instanceof StandingSessionShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StandingSessionShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; StandingSessionVo 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.getFrameExercise() != null || voParentInstance.getTiltTableExercise() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(StandingSessionVo voStandingSession) { if (form.grdSummary().getValue() == null) return; if (voStandingSession.getFrameExercise() == null) voStandingSession.setFrameExercise(new FrameExerciseVoCollection()); if(voStandingSession.getTiltTableExercise() == null) voStandingSession.setTiltTableExercise(new TiltExerciseVoCollection()); GenForm.grdSummaryRow parentRow = form.grdSummary().getValue() instanceof StandingSessionShortVo || form.grdSummary().getValue() instanceof StandingSessionVo ? form.grdSummary().getSelectedRow() : form.grdSummary().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) { voStandingSession.getTiltTableExercise().clear(); voStandingSession.getFrameExercise().clear(); } for (int i=0; i < parentRow.getRows().size(); i++) { if(parentRow.getRows().get(i).getValue() instanceof TiltExerciseVo) voStandingSession.getTiltTableExercise().add((TiltExerciseVo) parentRow.getRows().get(i).getValue()); if(parentRow.getRows().get(i).getValue() instanceof FrameExerciseVo) voStandingSession.getFrameExercise().add((FrameExerciseVo) parentRow.getRows().get(i).getValue()); } }
private void populateParentNode(StandingSessionShortVo voStandingSessionShort) { GenForm.grdSummaryRow parRow = form.grdSummary().getRows().newRow(); parRow.setColDateSupportType(voStandingSessionShort.getAuthoringDateTime().toString()+ " - " + voStandingSessionShort.getAuthoringCP().toString()); parRow.setValue(voStandingSessionShort); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && voStandingSessionShort.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())) { form.grdSummary().setValue(voStandingSessionShort); expandParentNode(parRow); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdSummary().getValue() instanceof StandingSessionShortVo) form.ctnStand().lyrParent().showtabHeader(); else if (form.grdSummary().getValue() instanceof StandingSessionVo) form.ctnStand().lyrParent().showtabHeader(); else if (form.grdSummary().getValue() instanceof FrameExerciseVo) form.ctnStand().lyrParent().showtabDetails(); else if (form.grdSummary().getValue() instanceof TiltExerciseVo) form.ctnStand().lyrParent().showtabDetails(); enableParentControls(false); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnStand().lyrParent().showtabHeader(); else form.ctnStand().lyrParent().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_StandingSessionIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private boolean newParentNode(StandingSessionVo voNewParent) { if (voNewParent == null) return true; StandingSessionShortVo voParentShort = new StandingSessionShortVo(); voParentShort.setAuthoringCP(form.ctnStand().lyrParent().tabHeader().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnStand().lyrParent().tabHeader().dtimAuthoringDateTime().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.grdSummaryRow parentRow = form.grdSummary().getRows().newRow(); if(voParentShort.getAuthoringCPIsNotNull()) parentRow.setColDateSupportType(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdSummary().setValue(voParentShort); return true; }
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.grdSummary().getValue() instanceof StandingSessionVo) { populateParentInstanceControls((StandingSessionVo) form.grdSummary().getValue()); } if(form.grdSummary().getValue() instanceof StandingSessionShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StandingSessionShortVo) form.grdSummary().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdSummary().getSelectedRow(),form.getLocalContext().getSelectedParentInstance()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdSummary().getValue() instanceof FrameExerciseVo ||form.grdSummary().getValue() instanceof TiltExerciseVo) { GenForm.grdSummaryRow parentRow = form.grdSummary().getSelectedRow().getParentRow(); form.getLocalContext().setSelectedParentInstance((StandingSessionVo) parentRow.getValue()); if(form.grdSummary().getValue() instanceof FrameExerciseVo) form.getLocalContext().setSelectedChildInstance(form.grdSummary().getValue()); if(form.grdSummary().getValue() instanceof TiltExerciseVo) form.getLocalContext().setSelectedChildInstance(form.grdSummary().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 StandingSessionVo getParentFromDomain(StandingSessionShortVo voStandingShort) { // WDEV-13649return domain.getStandingSessionByClinicalContact(voStandingShort.getClinicalContact()); return domain.getStanding(voStandingShort); }
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.grdSummary().getValue() instanceof StandingSessionShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdSummary().getValue() instanceof FrameExerciseVo || form.grdSummary().getValue() instanceof TiltExerciseVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Standing Detail"); // If the golden node is selected we can now only add child nodes so set the menu text accordingly. form.getContextMenus().getGenericGridAddItem().setText("Add Standing Detail"); // Only show the update menu if the user has selected an item to update. form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW)&& form.grdSummary().getSelectedRowIndex()>=0 && (form.grdSummary().getValue() instanceof TiltExerciseVo || form.grdSummary().getValue() instanceof FrameExerciseVo)) || (form.getMode().equals(FormMode.EDIT) && ((form.grdSummary().getValue() instanceof TiltExerciseVo && ((TiltExerciseVo)form.grdSummary().getValue()).getID_TiltExercise() == null)||form.grdSummary().getValue() instanceof FrameExerciseVo && ((FrameExerciseVo)form.grdSummary().getValue()).getID_FrameExercise() == 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 Standing Session"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && ((form.grdSummary().getValue() instanceof TiltExerciseVo && ((TiltExerciseVo)form.grdSummary().getValue()).getID_TiltExercise() == null)||form.grdSummary().getValue() instanceof FrameExerciseVo && ((FrameExerciseVo)form.grdSummary().getValue()).getID_FrameExercise() == null)); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }