private AnswerOptionVoCollection getCellMultiAnswer(DynamicGridCell cell) { if (!cell.getType().equals(DynamicCellType.MULTISELECT)) throw new CodingRuntimeException("Multiple answer should be collected only for multiselect cells"); AnswerOptionVoCollection result = new AnswerOptionVoCollection(); for (int x = 0; x < cell.getItems().size(); x++) { if (cell.getItems().get(x).isChecked()) { result.add((AnswerOptionVo) cell.getItems().get(x).getIdentifier()); } } return result; }
private AnswerOptionVoCollection getCellMultiAnswer(DynamicGridCell cell) { if(!cell.getType().equals(DynamicCellType.MULTISELECT)) throw new CodingRuntimeException("Multiple answer should be collected only for multiselect cells"); AnswerOptionVoCollection result = new AnswerOptionVoCollection(); for(int x = 0; x < cell.getItems().size(); x++) { if(cell.getItems().get(x).isChecked()) { result.add((AnswerOptionVo)cell.getItems().get(x).getIdentifier()); } } return result; }
private void populateDataFromAnswerOptions(QuestionAnswerTypeVo voQAnswerType) { AnswerOptionVoCollection voColl = new AnswerOptionVoCollection(); for (int i = 0; i < form.grdAnswerOption().getRows().size(); i++) { grdAnswerOptionRow row = form.grdAnswerOption().getRows().get(i); AnswerOptionVo voAnswerOption = row.getValue() != null ? row.getValue() : new AnswerOptionVo(); voAnswerOption.setOptionText(row.getcolOptionText()); voAnswerOption.setOptionDescription(row.getcolOptionDesc()); voAnswerOption.setScore(row.getcolScore()); Object objCol = row.getcolColour(); if (objCol instanceof Color) voAnswerOption.setColour((Color) objCol); else voAnswerOption.setColour(null); NonUniqueTaxonomyMapVoCollection voTaxonomyColl = new NonUniqueTaxonomyMapVoCollection(); NonUniqueTaxonomyMapVo voTaxonomyMap = new NonUniqueTaxonomyMapVo(); if (row.getcolExtCodeType()==null&&(row.getcolCode()==null||row.getcolCode().equals(""))) voAnswerOption.setTaxonomyMappings(null); else { voTaxonomyMap.setTaxonomyName(row.getcolExtCodeType()); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyColl.add(voTaxonomyMap); voAnswerOption.setTaxonomyMappings(voTaxonomyColl); } voColl.add(voAnswerOption); } voQAnswerType.setOptions(voColl); }
private void setCellMultiAnswer(DynamicGridCell cell, AnswerOptionVoCollection items) { if (!cell.getType().equals(DynamicCellType.MULTISELECT)) throw new CodingRuntimeException("Multiple answer should be collected only for multiselect cells"); if (cell.getItems() != null) { for (int x = 0; x < cell.getItems().size(); x++) { boolean checked = false; if (items != null) { for (int y = 0; y < items.size(); y++) { if (cell.getItems().get(x).getIdentifier() != null && cell.getItems().get(x).getIdentifier().equals(items.get(y))) { checked = true; break; } } } cell.getItems().get(x).setChecked(checked); } if(displayAnsweredOnly) //WDEV-12349 { for (int a = cell.getItems().size() -1; a >=0; a--) { if(cell.getItems().get(a) != null && !cell.getItems().get(a).isChecked()) cell.getItems().remove(cell.getItems().get(a)); } } } }
private void setCellMultiAnswer(DynamicGridCell cell, AnswerOptionVoCollection items) { if(!cell.getType().equals(DynamicCellType.MULTISELECT)) throw new CodingRuntimeException("Multiple answer should be collected only for multiselect cells"); if(cell.getItems() != null) { for(int x = 0; x < cell.getItems().size(); x++) { boolean checked = false; if(items != null) { for(int y = 0; y < items.size(); y++) { if(cell.getItems().get(x).getIdentifier() != null && cell.getItems().get(x).getIdentifier().equals(items.get(y))) { checked = true; break; } } } cell.getItems().get(x).setChecked(checked); } } }
private void setCellMultiAnswer(DynamicGridCell cell, AnswerOptionVoCollection items) { if (!cell.getType().equals(DynamicCellType.MULTISELECT)) throw new CodingRuntimeException("Multiple answer should be collected only for multiselect cells"); if (cell.getItems() != null) { for (int x = 0; x < cell.getItems().size(); x++) { boolean checked = false; if (items != null) { for (int y = 0; y < items.size(); y++) { if (cell.getItems().get(x).getIdentifier() != null && cell.getItems().get(x).getIdentifier().equals(items.get(y))) { checked = true; break; } } } cell.getItems().get(x).setChecked(checked); } } }
private void cloneQuestion(QuestionInformationShortVo voQInfoShort) { clearQuestionControls(); initialiseNewQuestion(); enableTabNewQuestion(true); enableTabListQuestion(false); showClassificationTree(true); form.getGlobalContext().Core.setQuestionType(QuestionType.PRIMARY); form.lyrTabs().tabNewQuestion().setCaption(ADD_QUESTION); QuestionInformationVo voQInfo = null; if (voQInfoShort != null && voQInfoShort.getID_QuestionInformationIsNotNull()) { voQInfo = domain.getQuestion(voQInfoShort.getID_QuestionInformation()); voQInfo.clearIDAndVersion(); //WDEV-17026 if (voQInfo.getTaxonomyMap() == null) { voQInfo.setTaxonomyMap(new TaxonomyMapCollection()); } voQInfo.setKeywords(new KeywordVoCollection()); if (voQInfo.getKeywords() == null) { voQInfo.setTaxonomyMap(new TaxonomyMapCollection()); } if(voQInfo.getAnswerTypes() != null) { QuestionAnswerTypeVoCollection answers = new QuestionAnswerTypeVoCollection(); for(int x = 0; x < voQInfo.getAnswerTypes().size(); x++) { QuestionAnswerTypeVo answer = voQInfo.getAnswerTypes().get(x); answer.clearIDAndVersion(); if(answer.getOptions() != null) { AnswerOptionVoCollection options = new AnswerOptionVoCollection(); for(int y = 0; y < answer.getOptions().size(); y++) { AnswerOptionVo option = answer.getOptions().get(y); if(option != null) { option.clearIDAndVersion(); options.add(option); } } answer.setOptions(options); } answers.add(answer); } voQInfo.setAnswerTypes(answers); } voQInfo.setID_QuestionInformation(-1); voQInfo.setStatus(PreActiveActiveInactiveStatus.PREACTIVE); form.getLocalContext().setVoQuestionInformation(voQInfo); populateControlsFromData(voQInfo); this.form.lyrTabs().tabNewQuestion().cmbStatus().setValue(PreActiveActiveInactiveStatus.PREACTIVE); } enableContextMenu(); }