private String getChildTooltip(AnswerOptionVo voAnswerOption) { if (voAnswerOption != null) { StringBuffer sb = new StringBuffer(); if (voAnswerOption.getOptionDescriptionIsNotNull()) { sb.append("*Description: *"); sb.append(voAnswerOption.getOptionDescription()); sb.append(CR); } if (isScoringAssessmentQuestion() && voAnswerOption.getScoreIsNotNull()) { sb.append("*Score: *"); sb.append(voAnswerOption.getScore()); sb.append(CR); } return new Textile().process(sb.toString()); } return ""; }
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 boolean isYellowOrRedColourCellsSelected(DynamicGridRow row) { DynamicGridCell answerCell = getDppAnswerCell(row); if (answerCell != null) { AnswerDetailsVo answerDetail = getCellAnswer(answerCell); if (answerDetail != null && answerDetail.getMultiSelectAnswers() != null) { for (int i = 0; i < answerDetail.getMultiSelectAnswers().size(); i++) { AnswerOptionVo voAnswerOption = answerDetail.getMultiSelectAnswers().get(i); //WDEV-3916 Float score = voAnswerOption.getScore(); if (score != null && (score.intValue() == getYellowScore() || score.intValue() == getRedScore())) return true; } } } return false; }
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 setRowData(AnswerOptionVo voAnswerOption, GenForm.grdAnswerOptionRow newRow) { if (voAnswerOption != null) { newRow.setcolOptionText(voAnswerOption.getOptionText()); newRow.setcolOptionDesc(voAnswerOption.getOptionDescription()); newRow.setcolScore(voAnswerOption.getScore()); newRow.setcolColour(voAnswerOption.getColour()); if (voAnswerOption.getTaxonomyMappingsIsNotNull() && voAnswerOption.getTaxonomyMappings().size() > 0) { setColTaxonomy(newRow, voAnswerOption.getTaxonomyMappings().get(0)); } newRow.setValue(voAnswerOption); } }
/** * @param newRow * @param voAnswerOption */ private void setColTaxonomy(GenForm.grdAnswerOptionRow newRow, NonUniqueTaxonomyMapVo voTaxonomyMap) { if (newRow != null && voTaxonomyMap != null) { newRow.setcolExtCodeType(voTaxonomyMap.getTaxonomyName()); newRow.setcolCode(voTaxonomyMap.getTaxonomyCode()); AnswerOptionVo voAnswerOption = newRow.getValue() != null ? newRow.getValue() : new AnswerOptionVo(); NonUniqueTaxonomyMapVoCollection voTaxonomyColl = new NonUniqueTaxonomyMapVoCollection(); voTaxonomyColl.add(voTaxonomyMap); voAnswerOption.setTaxonomyMappings(voTaxonomyColl); newRow.setValue(voAnswerOption); } }
private void addNewAnswerOption() { GenForm.grdAnswerOptionRow row = form.grdAnswerOption().getRows().newRow(true); row.setReadOnly(false); row.setcolScoreReadOnly(!isScoringAssessmentQuestion()); row.setcolColourReadOnly(!isColorColumnVisible()); row.setValue(new AnswerOptionVo()); }
private Integer getRowIndex(grdAnswerOptionRow row) { for (int i = 0; i < form.grdAnswerOption().getRows().size(); i++) { AnswerOptionVo voAnswerOption = form.grdAnswerOption().getRows().get(i).getValue(); if (voAnswerOption != null && voAnswerOption.equals(row.getValue())) return new Integer(i); } return null; }
private boolean isNotAnswered(AnswerOptionVo answerItem, AnswerDetailsVo instAnswer) { if (answerItem == null || instAnswer == null) return false; return instAnswer.getMultiSelectAnswers().indexOf(answerItem) < 0; }
private void setAnswerCellOptions(QuestionAnswerTypeVo answer, DynamicGridCell cell, AnswerDetailsVo instAnswer) { cell.getItems().clear(); // WDEV-3617 cell.setAutoWrapForMultiSelect(true); int maxVisibleItems = 0; if(answer.getOptionsIsNotNull()) { for(int x = 0; x < answer.getOptions().size(); x++) { AnswerOptionVo answerItem = answer.getOptions().get(x); if(answerItem != null) { //WDEV-1631 - When Viewing an Instantiated Assessment i simply want to see all the question and answered given, in edit mode i want to see all the questions and answer options. if(displayAnsweredOnly && isNotAnswered(answerItem, instAnswer)) continue; DynamicGridCellItem item = cell.getItems().newItem(answerItem); item.setIdentifier(answerItem); maxVisibleItems++; if(answerItem.getColourIsNotNull() && answer.getAnswerTypeIsNotNull() && answer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT)) { item.setMarkerColor(answerItem.getColour()); } } } } cell.setMaxVisibleItemsForMultiSelect(0); // This line is no longer needed, the answer is going to be wrapped. // MM - WDEV-3617 //cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems == 0 ? 1 : maxVisibleItems + 1); }
private boolean isNotAnswered(AnswerOptionVo answerItem, AnswerDetailsVo instAnswer) { if(answerItem == null || instAnswer == null) return false; return instAnswer.getMultiSelectAnswers().indexOf(answerItem) < 0; }
private void setAnswerCellOptions(QuestionAnswerTypeVo answer, DynamicGridCell cell) { cell.getItems().clear(); int maxVisibleItems = 0; if(answer.getOptionsIsNotNull()) { for(int x = 0; x < answer.getOptions().size(); x++) { AnswerOptionVo answerItem = answer.getOptions().get(x); if(answerItem != null) { /* //WDEV-1631 - When Viewing an Instantiated Assessment i simply want to see all the question and answered given, in edit mode i want to see all the questions and answer options. if(displayAnsweredOnly && isNotAnswered(answerItem, instAnswer)) continue;*/ DynamicGridCellItem item = cell.getItems().newItem(answerItem); item.setIdentifier(answerItem); maxVisibleItems++; if(answerItem.getColourIsNotNull() && answer.getAnswerTypeIsNotNull() && answer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT)) { item.setMarkerColor(answerItem.getColour()); } } } } cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems == 0?1:maxVisibleItems); }
private void setAnswerCellOptions(QuestionAnswerTypeVo answer, DynamicGridCell cell) { cell.getItems().clear(); int maxVisibleItems = 0; if (answer.getOptionsIsNotNull()) { for (int x = 0; x < answer.getOptions().size(); x++) { AnswerOptionVo answerItem = answer.getOptions().get(x); if (answerItem != null) { DynamicGridCellItem item = cell.getItems().newItem(answerItem); item.setIdentifier(answerItem); maxVisibleItems++; if (answerItem.getColourIsNotNull() && ims.core.vo.lookups.QuestionAnswerType.MULTISELECT.equals(answer.getAnswerType())) { item.setMarkerColor(answerItem.getColour()); } } } } cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems == 0 ? 1 : maxVisibleItems); }