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 setDetailsTabVisibility() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode, make the details tab visible if a detail instance is selected in the hierarchy grid. form.ctnGait().lyrGait().tabDetail().setHeaderVisible(form.grdGait().getValue() instanceof GaitTreatmentVo); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnGait().lyrGait().tabDetail().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void populateChildNode(grdGaitRow childRow, GaitTreatmentVo voGaitTreat) { if (voGaitTreat == null) return; if(voGaitTreat.getEnvironment() != null) childRow.setColEnvironment(voGaitTreat.getEnvironment().toString()); if(voGaitTreat.getGaitTechnique() != null) childRow.setColTechnique(voGaitTreat.getGaitTechnique().toString()); if(voGaitTreat.getOrthosis() != null) childRow.setColOrthosis(voGaitTreat.getOrthosis().toString()); if(voGaitTreat.getSupervisionLevel() != null) childRow.setColSupervision(voGaitTreat.getSupervisionLevel().toString()); if(voGaitTreat.getGaitSummary() != null) childRow.setColSummary(voGaitTreat.getGaitSummary()); childRow.setValue(voGaitTreat); //if not saved then set the colour if(voGaitTreat.getID_GaitTreatment() == null) childRow.setTextColor(Color.Red); }
private boolean newChildNode(GaitTreatmentVo voGaitTreatment) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voGaitTreatment.countFieldsWithValue() >= 1) { String strErrors[] = voGaitTreatment.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voGaitTreatment); clearChildInstanceControls(); } return false; }
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 setAddApplyCaption() { form.ctnGait().lyrGait().tabDetail().bOkDetails().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdGait().getValue() instanceof GaitTreatmentVo)) form.ctnGait().lyrGait().tabDetail().bOkDetails().setText("Apply"); }
private void populateChildInstanceControls(GaitTreatmentVo voGaitTreat) { if (voGaitTreat == null ) return; form.ctnGait().lyrGait().tabDetail().cmbEnvironment().setValue(voGaitTreat.getEnvironment()); form.ctnGait().lyrGait().tabDetail().cmboGaitTech().setValue(voGaitTreat.getGaitTechnique()); form.ctnGait().lyrGait().tabDetail().cmbOrthosis().setValue(voGaitTreat.getOrthosis()); form.ctnGait().lyrGait().tabDetail().cmbSupervision().setValue(voGaitTreat.getSupervisionLevel()); form.ctnGait().lyrGait().tabDetail().txtGaitPractice().setValue(voGaitTreat.getGaitPractice()); form.ctnGait().lyrGait().tabDetail().txtStairPractice().setValue(voGaitTreat.getStairPractice()); form.ctnGait().lyrGait().tabDetail().txtSummary().setValue(voGaitTreat.getGaitSummary()); form.ctnGait().lyrGait().tabDetail().intWalkTest().setValue(voGaitTreat.getWalkTestTime()); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if (form.grdGait().getSelectedRow() == null) throw new CodingRuntimeException("No Row Selected"); if (form.grdGait().getSelectedRow().getValue() != null && form.grdGait().getSelectedRow().getValue() instanceof GaitTreatmentVo && form.grdGait().getSelectedRow().getParentRow() != null && form.grdGait().getSelectedRow().getParentRow().getValue() != null) form.grdGait().setValue(form.grdGait().getSelectedRow().getParentRow().getValue()); }
private void populateChildInstanceData(GaitTreatmentVo voGaitTreatment) { voGaitTreatment.setEnvironment(form.ctnGait().lyrGait().tabDetail().cmbEnvironment().getValue()); voGaitTreatment.setGaitPractice(form.ctnGait().lyrGait().tabDetail().txtGaitPractice().getValue()); voGaitTreatment.setGaitSummary(form.ctnGait().lyrGait().tabDetail().txtSummary().getValue()); voGaitTreatment.setGaitTechnique(form.ctnGait().lyrGait().tabDetail().cmboGaitTech().getValue()); voGaitTreatment.setOrthosis(form.ctnGait().lyrGait().tabDetail().cmbOrthosis().getValue()); voGaitTreatment.setStairPractice(form.ctnGait().lyrGait().tabDetail().txtStairPractice().getValue()); voGaitTreatment.setSupervisionLevel(form.ctnGait().lyrGait().tabDetail().cmbSupervision().getValue()); voGaitTreatment.setWalkTestTime(form.ctnGait().lyrGait().tabDetail().intWalkTest().getValue()); }
private void setUpdatedChild() { // Straight child update - Select the currently being updated child as the one so show - post save if (form.grdGait().getValue() instanceof GaitTreatmentVo) { form.getLocalContext().setUpdatedChild((GaitTreatmentVo) form.grdGait().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { if (form.getLocalContext().getSelectedParentInstance() != null && form.getLocalContext().getSelectedParentInstance().getGaitTreatment() != null) { form.getLocalContext().getSelectedParentInstance().getGaitTreatment().sort(); if (form.getLocalContext().getSelectedParentInstance().getGaitTreatment().size() > 0) { form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getGaitTreatment().get( form.getLocalContext().getSelectedParentInstance().getGaitTreatment().size() - 1)); } } } } }