private void editQuestion() { Object objQInfo; if(isDialog()) objQInfo = form.lyrTrees().tabPageSelect().grdListedQuestions().getValue(); else objQInfo = form.lyrTrees().tabPageSearch().grdQuestions().getValue(); if(objQInfo == null || (objQInfo instanceof QuestionInformationShortVo == false)) { engine.showMessage("Please select a record"); return; } form.getGlobalContext().Admin.setIsNewQuestion(new Boolean(false)); QuestionInformationVo voSelectedQuestion = domain.getQuestion(((QuestionInformationShortVo)objQInfo).getID_QuestionInformation()); form.getGlobalContext().Admin.setSelectedQuestion(voSelectedQuestion); engine.open(form.getForms().Core.QuestionAnswer); }
private void enableUpdateContextMenu(boolean bValue) { if(isParentTestEdit()) return; Object val = null; if(isDialog()) val = form.lyrTrees().tabPageSelect().grdListedQuestions().getValue(); else val = form.lyrTrees().tabPageSearch().grdQuestions().getValue(); if(val instanceof QuestionInformationShortVo) { QuestionInformationShortVo voQI = (QuestionInformationShortVo)val; String qInfoTxt = voQI.getIsQuestionIsNotNull() && voQI.getIsQuestion().booleanValue()?"Question":"Information"; form.getContextMenus().getGenericGridUpdateItem().setText("Edit " + qInfoTxt); form.getContextMenus().getGenericGridViewItem().setText("View " + qInfoTxt); } form.getContextMenus().getGenericGridUpdateItem().setVisible(bValue); form.getContextMenus().getGenericGridViewItem().setVisible(bValue); }
private void loadNewGridNodes(QuestionInformationShortVo voQInfo) { QuestionClassificationCollection classification = voQInfo.getClassification(); if(classification != null) { //Get the Parents QuestionClassificationCollection parents = new QuestionClassificationCollection(); getParents(parents, classification); //Add the parents to the grid buildParentNodes(parents); //Add the QuestionInformationVo in the built up tree buildParentData(voQInfo, classification); //Add the children to the grid buildChildrenNodes(classification); //Add the QuestionInformationVo in the built up tree buildChildData(voQInfo, classification); } }
private void setSelectedQuestion(grdSelectedRow row, QuestionInformationShortVo voQIshort) { if(row == null || voQIshort == null) return; if (form.getLocalContext().getIsShortTextIsNotNull()) row.setcolQuestionText(voQIshort.getShortText()); // if (form.getLocalContext().getIsShortText()) // row.setcolQuestionText(voQIshort.getShortText()); // else // row.setcolQuestionText(voQIshort.getText()); row.setcolStatus(voQIshort.getStatusIsNotNull()?voQIshort.getStatus().toString():""); row.setTooltip(voQIshort.getTooltip()); row.setcolSelect(true); row.setValue(voQIshort); }
private void editQuestion(QuestionInformationShortVo voQInfoShort) { QuestionInformationVo voQInfo = null; if (voQInfoShort != null && voQInfoShort.getID_QuestionInformationIsNotNull()) { voQInfo = domain.getQuestion(voQInfoShort.getID_QuestionInformation()); form.getLocalContext().setVoQuestionInformation(voQInfo); } clearQuestionControls(); populateControlsFromData(voQInfo); setIsNewQuestion(new Boolean(false)); enableTabNewQuestion(true); boolean isPrimaryQuestion = voQInfo != null && voQInfo .getQuestionTypeIsNotNull() && voQInfo .getQuestionType().equals(QuestionType.PRIMARY)?true:false; if(isDialog()) enableTabSearchQuestion(false); else { enableTabListQuestion(false); showClassificationTree(isPrimaryQuestion); } showTabNewQuestion(); form.setMode(FormMode.EDIT); }
private DynamicGridRow getCurrentQuestionRow(QuestionInformationShortVo voQInfoShort) { DynamicGridRow row = null; for (int i = 0; i < form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().size(); i++) { DrawingGraphicFindingQuestionVo voDGFinding = getRowValue(form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().get(i)); if (voDGFinding != null && voDGFinding.getQuestionIsNotNull() && voDGFinding.getQuestion().equals(voQInfoShort)) return form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().get(i); } if (row == null) { row = form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().newRow(); //Check to see if we have the same question in an inactive DrawingGraphicFindingQuestionVo DrawingGraphicFindingQuestionVo voDGFindingQuestion = getInactiveRecord(voQInfoShort); if (voDGFindingQuestion != null) row.setValue(voDGFindingQuestion); } return row; }
private DrawingGraphicFindingQuestionVo getInactiveRecord(QuestionInformationShortVo voQInfoShort) { DrawingGraphicFindingQuestionVoCollection voColl = form.getLocalContext().getInactiveFindingQuestions(); for (int i = 0; voColl != null && i < voColl.size(); i++) { if (voColl.get(i).getQuestionIsNotNull() && voColl.get(i).getQuestion().equals(voQInfoShort)) { DrawingGraphicFindingQuestionVo voDrawingGraphicFindingQuestion = voColl.get(i); voColl.remove(voDrawingGraphicFindingQuestion); form.getLocalContext().setInactiveFindingQuestions(voColl); return voDrawingGraphicFindingQuestion; } } return null; }
private void refreshEditedQuestions() { ims.core.vo.QuestionInformationVoCollection editedQuestions = form.getGlobalContext().Core.getEditedQuestions(); if (editedQuestions == null || editedQuestions.size() == 0) return; for (int i = 0; i < form.lyrInvestigations().tabQuestions().grdQuestions().getRows().size(); i++) { InvestigationQuestionVo voInvestigationQuestion = form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(i).getValue(); if (voInvestigationQuestion != null) { QuestionInformationShortVo question = voInvestigationQuestion.getQuestion(); int index = getQuestionIndex(editedQuestions, question); if (index >= 0) { voInvestigationQuestion.setQuestion(editedQuestions.get(index)); form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(i).setValue(voInvestigationQuestion); } } } form.getGlobalContext().Core.setEditedQuestions(null); }
private PatientAssessmentAnswerVoCollection getPatientAnswers(GeneralQuestionAnswerVoCollection categoryQA, QuestionInformationShortVo question) { if (categoryQA == null || categoryQA.size() == 0) return null; if (question == null) return null; for (GeneralQuestionAnswerVo answer : categoryQA) { if (question.equals(answer.getQuestion())) return answer.getPatientAnswers(); } return null; }
private PatientAssessmentAnswerVoCollection getPatientAnswers(InvestigationQuestionAnswerVoCollection questions, QuestionInformationShortVo question) { if (questions == null || questions.size() == 0) return null; if (question == null) return null; for (InvestigationQuestionAnswerVo investigationQuestion : questions) { if (investigationQuestion.getInvestigationQuestionAnswersIsNotNull()) { for (GeneralQuestionAnswerVo answer : investigationQuestion.getInvestigationQuestionAnswers()) { if (question.equals(answer.getQuestion())) return answer.getPatientAnswers(); } } } return null; }
private void addQuestions(QuestionInformationShortVoCollection questions) { if (questions == null) return; for (QuestionInformationShortVo question : questions) { grdQuestionsRow questionRow = form.lyrMain().tabPageService().grdQuestions().getRows().newRow(); questionRow.setColQuestion(question.getText()); if (question.getAnswerTypes() != null) questionRow.setColAnswerType(question.getAnswerTypes().get(0).getAnswerType().getText()); questionRow.setColMandatory(false); AssessmentQuestionServiceVo serviceQuestion = new AssessmentQuestionServiceVo(); serviceQuestion.setQuestion(question); serviceQuestion.setIsMandatory(Boolean.FALSE); serviceQuestion.setActiveStatus(PreActiveActiveInactiveStatus.ACTIVE); serviceQuestion.setSequence(form.lyrMain().tabPageService().grdQuestions().getRows().size()); questionRow.setValue(serviceQuestion); } }
private void refreshSelectedQuestion() { QuestionInformationShortVo voQInfo = form.getGlobalContext().Admin.getSelectedQuestion(); if(form.getGlobalContext().Admin.getIsNewQuestionIsNotNull() && form.getGlobalContext().Admin.getIsNewQuestion().booleanValue()) { clearGrids(); loadNewGridNodes(voQInfo); } else { if(isSearchCriteriaEntered()) { //do a search again onImbSearchTextAndClass(); } else { //Refresh only the things changed if(isDialog()) refreshRow(form.lyrTrees().tabPageSelect().grdListedQuestions(), voQInfo); else refreshRow(form.lyrTrees().tabPageSearch().grdQuestions(), voQInfo); } enableUpdateContextMenu(true); } }
private boolean isQuestionAdded(QuestionInformationShortVo vo) { QuestionInformationShortVoCollection voColl = form.lyrTrees().tabPageSelect().grdSelectedQuestions().getValues(); if(voColl != null && voColl.indexOf(vo) >= 0) return true; return false; }
private QuestionInformationShortVoCollection getCheckedListedQuestions() { QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); grdListedQuestionsRow rowParent, rowChild; Object value; //Get the parents first (as it's a requirement to be displayed first) for(int i=0; i<form.lyrTrees().tabPageSelect().grdListedQuestions().getRows().size(); i++) { for(int j=0; j<form.lyrTrees().tabPageSelect().grdListedQuestions().getRows().get(i).getRows().size(); j++) { rowParent = form.lyrTrees().tabPageSelect().grdListedQuestions().getRows().get(i).getRows().get(j); if(rowParent.getcolSelect()) { value = rowParent.getValue(); if(value instanceof QuestionInformationShortVo) voColl.add((QuestionInformationShortVo)value); } for (int k = 0; k < rowParent.getRows().size(); k++) { rowChild = rowParent.getRows().get(k); if(rowChild.getcolSelect()) { value = rowChild.getValue(); if(value instanceof QuestionInformationShortVo) voColl.add((QuestionInformationShortVo)value); } } } } return voColl; }