protected void onBtnMoveSelectedClick() throws PresentationLogicException { //Flag the Actions form.getLocalContext().setMoveRecords(new Boolean(true)); QuestionInformationShortVoCollection voColl = getCheckedListedQuestions(); grdSelectedQuestionsRow row; for (int i = 0; voColl != null && i < voColl.size(); i++) { if(isQuestionAdded(voColl.get(i)) == false) { row = form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().newRow(); row.setReadOnly(false); row.setcolSelect(true); setRowData(row, voColl.get(i)); } } //Code to deal with the Selected Questions displayed hierarchical /*ArrayList dataColl = getSelectedQuestions(); for (int i = 0; i < dataColl.size(); i++) addSelectedItem((SelectData)dataColl.get(i));*/ form.getLocalContext().setMoveRecords(new Boolean(false)); }
private void displayQuestions(QuestionInformationShortVoCollection collection) { QuestionClassificationCollection parents = new QuestionClassificationCollection(); //gather all the parents for(int i=0; i<collection.size(); i++) getParents(parents, collection.get(i).getClassification()); //Display all the parents buildParentNodes(parents); //Build Parent Data for(int i=0; i<collection.size(); i++) buildParentData(collection.get(i), collection.get(i).getClassification()); //Display all the children for(int i=0; i<collection.size(); i++) buildChildrenNodes(collection.get(i).getClassification()); //Build Child Data for(int i=0; i<collection.size(); i++) buildChildData(collection.get(i), collection.get(i).getClassification()); }
private void loadSelectedData() { if(isDialog()) { form.getLocalContext().setMoveRecords(new Boolean(true)); QuestionInformationShortVoCollection voColl = form.getGlobalContext().Admin.getSelectedQuestions(); grdSelectedQuestionsRow row; for (int i = 0; voColl != null && i < voColl.size(); i++) { row = form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().newRow(); row.setReadOnly(true); //The preselected should be unchecked //row.setcolSelect(true); setRowData(row, voColl.get(i)); } form.getLocalContext().setMoveRecords(new Boolean(false)); } else { //Load the Selected Question if any if(engine.getPreviousNonDialogFormName().equals(form.getForms().Core.QuestionAnswer)) { refreshSelectedQuestion(); } } }
protected void onBtnAddToListClick() throws PresentationLogicException { QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); boolean deleted = true; while (deleted) { deleted = false; for (int i = 0; i < form.lyrTabs().tabSearchQuestion().grdAvailable().getRows().size(); i++) { if (form.lyrTabs().tabSearchQuestion().grdAvailable().getRows().get(i).getcolSelect()) { voColl.add(form.lyrTabs().tabSearchQuestion().grdAvailable().getRows().get(i).getValue()); form.lyrTabs().tabSearchQuestion().grdAvailable().getRows().remove(i); deleted = true; break; } } } addSelectedQuestions(voColl); enableContextMenu(); //WDEV-12365 }
protected void onBtnOkClick() throws PresentationLogicException { QuestionInformationShortVoCollection voColl = getSelectedQuestions(); if(isUserAssessmentQuestion()) { AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection(); for(int i=0; voColl != null && i<voColl.size(); i++) { AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo(); voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation())); voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText()); voAssmntColl.add(voAssmntQ); } form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl); closeDialog(DialogResult.OK); } else { form.getGlobalContext().Admin.setSelectedQuestions(voColl); closeDialog(DialogResult.OK); } }
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 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; }
protected void onBtnSelectClick() throws PresentationLogicException { QuestionInformationShortVoCollection voColl = getSelectedData(); if(voColl == null || voColl.size() == 0) { engine.showMessage("Please select a question"); return; } form.getGlobalContext().Admin.setSelectedQuestions(voColl); engine.close(DialogResult.OK); }
private QuestionInformationShortVoCollection getSelectedData() { QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); QuestionInformationShortVo voQI; for (int i = 0; i < form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().size(); i++) { voQI = form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().get(i).getValue(); //avoid adding duplicates if(voColl.indexOf(voQI) < 0) voColl.add(voQI); } return voColl; }
private void setSelectedQuestions() { QuestionInformationVo voQInfo = form.getLocalContext().getVoQuestionInformation(); QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); voColl.add(voQInfo); form.getGlobalContext().Admin.setSelectedQuestions(voColl); }
private QuestionInformationShortVoCollection getSelectedQuestions() { QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); for(int i=0; i<form.lyrTabs().tabSearchQuestion().grdSelected().getRows().size(); i++) { if(form.lyrTabs().tabSearchQuestion().grdSelected().getRows().get(i).getcolSelect()) voColl.add(form.lyrTabs().tabSearchQuestion().grdSelected().getRows().get(i).getValue()); } return voColl; }
private void addSelectedQuestions(QuestionInformationShortVoCollection voColl) { QuestionInformationShortVo voQIshort; for (int i = 0; voColl != null && i < voColl.size(); i++) { voQIshort = voColl.get(i); grdSelectedRow row = form.lyrTabs().tabSearchQuestion().grdSelected().getRowByValue(voQIshort); if (row == null) row = form.lyrTabs().tabSearchQuestion().grdSelected().getRows().newRow(); setSelectedQuestion(row, voQIshort); } }
public QuestionInformationShortVoCollection listQuestion(String text) { StringBuffer hql = new StringBuffer(" from QuestionInformation QI"); DomainFactory factory = getDomainFactory(); if(text != null) { hql.append(" where upper(QI.text) like :qText "); List qInfoList = factory.find(hql.toString(), "qText", ("%" + text + "%")); return QuestionInformationShortVoAssembler.createQuestionInformationShortVoCollectionFromQuestionInformation(qInfoList); } return null; }
public QuestionInformationShortVoCollection listQuestion(QuestionClassification classification) { DomainFactory factory = getDomainFactory(); if(classification != null) { String hql = "select distinct QI from QuestionInformation QI where :classItem in elements(QI.classification)"; List qInfoList = factory.find(hql, "classItem", getDomLookup(classification)); return QuestionInformationShortVoAssembler.createQuestionInformationShortVoCollectionFromQuestionInformation(qInfoList); } return null; }
protected void onBtnSaveClick() throws PresentationLogicException { if (isDialog()) { //Select the questions QuestionInformationShortVoCollection voColl = new QuestionInformationShortVoCollection(); for (int i = 0; i < form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().size(); i++) { DynamicGridCell cellSelect = form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().get(i).getCells().get(getQuestionDynColumn(COLQUESTIONSELECT)); if (cellSelect != null) { Object objValue = cellSelect.getValue(); if (objValue instanceof Boolean && ((Boolean) (objValue)).booleanValue()) { Object value = form.lyrFindings().tabView().dyngrdAssocQuestions().getRows().get(i).getValue(); if (value != null && value instanceof DrawingGraphicFindingQuestionVo) { DrawingGraphicFindingQuestionVo voDGFindingQuestion = (DrawingGraphicFindingQuestionVo) value; if (voDGFindingQuestion.getQuestionIsNotNull()) voColl.add(voDGFindingQuestion.getQuestion()); } } } } form.getGlobalContext().Admin.setSelectedQuestions(voColl); engine.close(DialogResult.OK); } else { if (save() == false) return; refreshFindings(); } }
private void addQuestionWithStages(QuestionInformationShortVoCollection voColl) { for (int i = 0; i < voColl.size(); i++) { grdFindingQuestionsWithStageRow questionRow = getFindingQuestionRowByQuestionWithStages(voColl.get(i)); if (questionRow == null) { questionRow = form.lyrDetails().tabFindingsWithStages().grdFindingQuestionsWithStage().getRows().newRow(); } else { // Duplicate question continue; } GraphicAssessmentFindingQuestionVo voGAFQ = new GraphicAssessmentFindingQuestionVo(); voGAFQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation())); voGAFQ.setActiveStatus(PreActiveActiveInactiveStatus.ACTIVE); voGAFQ.setSequence(new Integer(form.lyrDetails().tabFindings().grdFindingQuestions().getRows().size()-1)); displayQuestionWithStagesRow(questionRow, voGAFQ); FindingStageQuestionsVo findingStageQuestionsVo = (FindingStageQuestionsVo) form.lyrDetails().tabFindingsWithStages().dyngrdFindingWithStage().getValue(); if(findingStageQuestionsVo.getAssociatedQuestions() == null) { findingStageQuestionsVo.setAssociatedQuestions(new GraphicAssessmentFindingQuestionVoCollection()); } findingStageQuestionsVo.getAssociatedQuestions().add(voGAFQ); } }
/** * @param voCollQuestion */ private void addQuestionsToGrid(QuestionInformationShortVoCollection voCollQuestion) { GenForm.lyrInvestigationsLayer.tabQuestionsContainer.grdQuestionsRow qRow = null; for (int i = 0; i < voCollQuestion.size(); i++) { boolean isFound = false; for (int j = 0; j < form.lyrInvestigations().tabQuestions().grdQuestions().getRows().size(); j++) { if (form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(j).getValue() != null && form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(j).getValue().getQuestionIsNotNull() && form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(j).getValue().getQuestion().equals(voCollQuestion.get(i))) { isFound = true; break; } } if (!isFound) { qRow = form.lyrInvestigations().tabQuestions().grdQuestions().getRows().newRow(); qRow.setcolQuestionText(voCollQuestion.get(i).getShortText()); qRow.setcolImage(getQuestionImage(voCollQuestion.get(i).getIsQuestion())); InvestigationQuestionVo voInvQuestion = new InvestigationQuestionVo(); voInvQuestion.setQuestion(voCollQuestion.get(i)); qRow.setTooltip(voCollQuestion.get(i).getTooltip()); qRow.setValue(voInvQuestion); //WDEV-5066 if(!voCollQuestion.get(i).getIsQuestion()) qRow.setcolMandatoryReadOnly(true); } } }
private void linkQuestions() { // Get selected questions as they will be preselected in the parent QuestionInformationShortVoCollection voCollQuestion = new QuestionInformationShortVoCollection(); for (int i = 0; i < form.lyrInvestigations().tabQuestions().grdQuestions().getRows().size(); i++) { if (form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(i).getValue() != null && form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(i).getValue().getQuestionIsNotNull()) voCollQuestion.add(form.lyrInvestigations().tabQuestions().grdQuestions().getRows().get(i).getValue().getQuestion()); } form.getGlobalContext().Admin.setSelectedQuestions(voCollQuestion); form.getGlobalContext().Core.setQuestionType(ims.core.vo.lookups.QuestionType.PRIMARY); engine.open(form.getForms().Core.QuestionSelectNew, "Question/Information"); }