private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdActivity().getValue() instanceof RemedialShortVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if(form.grdActivity().getValue() instanceof RemedialVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if (form.grdActivity().getValue() instanceof RemedialActivityVo) form.ctnRemedial().lyrRemedial().showtabDetails(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnRemedial().lyrRemedial().showtabHeader(); else form.ctnRemedial().lyrRemedial().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_RemedialIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private void setDetailsTabVisibility() { if (form.getMode().equals(FormMode.VIEW)) { form.ctnRemedial().lyrRemedial().tabDetails().setHeaderVisible(form.grdActivity().getValue() instanceof RemedialActivityVo); } else { form.ctnRemedial().lyrRemedial().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void populateChildNode(grdActivityRow childRow, RemedialActivityVo voRemedialActivity) { if (voRemedialActivity == null) return; if(voRemedialActivity.getActivity() != null) childRow.setColActivity(voRemedialActivity.getActivity().toString()); if(voRemedialActivity.getSequence() != null) childRow.setColSequence(voRemedialActivity.getSequence().toString()); if(voRemedialActivity.getPatientPosition() != null) childRow.setColPatientPosition(voRemedialActivity.getPatientPosition().toString()); if(voRemedialActivity.getActivityPosition() != null) childRow.setColActivityPosition(voRemedialActivity.getActivityPosition().toString()); if(voRemedialActivity.getDuration() != null) childRow.setColDuration(voRemedialActivity.getDuration().toString()); childRow.setValue(voRemedialActivity); //if not saved then set the colour if(voRemedialActivity.getID_RemedialActivity() == null) childRow.setTextColor(Color.Red); }
private boolean newChildNode(RemedialActivityVo voRemedialActivity) { if (form.getLocalContext().getSelectedChildInstance() != null) return true; if (voRemedialActivity.countFieldsWithValue() >= 1) { String strErrors[] = voRemedialActivity.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voRemedialActivity); clearChildInstanceControls(); loadLookupsIntoGrid(); } return false; }
private void populateChildCollectionFromGrid(RemedialVo voRemedial) { if (form.grdActivity().getValue() == null) return; if (voRemedial.getRemedialActivity() == null) voRemedial.setRemedialActivity(new RemedialActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RemedialShortVo || form.grdActivity().getValue() instanceof RemedialVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRemedial.getRemedialActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRemedial.getRemedialActivity().add((RemedialActivityVo) parentRow.getRows().get(i).getValue()); } }
private void setUpdatedChild() { if (form.grdActivity().getValue() instanceof RemedialActivityVo) { form.getLocalContext().setUpdatedChild((RemedialActivityVo) form.grdActivity().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getRemedialActivity().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getRemedialActivity().get( form.getLocalContext().getSelectedParentInstance().getRemedialActivity().size() - 1)); } } }
private void newInstance() { if (form.grdActivity().getValue() == null || ((form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().equals(Boolean.FALSE)))) { newParentInstance(); } // New instance has been invoked with a child node selected. if (form.grdActivity().getValue() instanceof RemedialActivityVo) { newChildInstance(); } form.setMode(FormMode.EDIT); }
private void getSelectedInstance() { if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdActivity().getValue() instanceof RemedialVo) { populateParentInstanceControls((RemedialVo) form.grdActivity().getValue()); } else if(form.grdActivity().getValue() instanceof RemedialShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RemedialShortVo)form.grdActivity().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdActivity().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getRemedialActivity()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdActivity().getValue() instanceof RemedialActivityVo) { GenForm.grdActivityRow parentRow = form.grdActivity().getSelectedRow().getParentRow(); populateParentInstanceControls((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((RemedialActivityVo) form.grdActivity().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 setAddApplyCaption() { form.ctnRemedial().lyrRemedial().tabDetails().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdActivity().getValue() instanceof RemedialActivityVo)) form.ctnRemedial().lyrRemedial().tabDetails().btnOk().setText("Apply"); }
private void promoteChild(RemedialActivityVo voRemedialActivity) { if (voRemedialActivity == null) return; GenForm.grdActivityRow childRow = null; form.grdActivity().setValue(form.getLocalContext().getSelectedParentInstance()); if(form.grdActivity().getValue() != null) { if(form.grdActivity().getSelectedRow().getValue() instanceof RemedialActivityVo) childRow = form.grdActivity().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdActivity().getSelectedRow().getRows().newRow(); } populateChildNode(childRow, voRemedialActivity); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdActivity().getValue() instanceof RemedialShortVo)); form.setMode(FormMode.EDIT); if (form.grdActivity().getValue() instanceof RemedialActivityVo) { RemedialActivityVo voCachedChild = (RemedialActivityVo) form.grdActivity().getValue(); if ( voCachedChild.getID_RemedialActivity() == null) { populateChildInstanceControls(voCachedChild); } } }