protected void onFormDialogClosed(ims.framework.FormName formName, ims.framework.enumerations.DialogResult result) throws ims.framework.exceptions.PresentationLogicException { if (formName.equals(form.getForms().Core.QuestionAnswerType) && result.equals(DialogResult.OK)) { QuestionAnswerTypeVo voAnswType = form.getGlobalContext().Core.getQuestionAnswerType(); if (voAnswType != null) { DynamicGridRow row = null; if(voAnswType.getID_QuestionAnswerTypeIsNotNull()) row = getDynamicRowByValue(voAnswType); else if (form.getLocalContext().getIsNewAnwerTypeIsNotNull()) if (form.getLocalContext().getIsNewAnwerType()) row = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().newRow(); else row = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getSelectedRow(); createDynamicGridRow(voAnswType, row); setDefaultDynamicGridCheckBox(voAnswType, true); enableContextMenu(); } } else if( formName.equals(form.getForms().Core.YesNoDialog) && result.equals(DialogResult.YES)) { save(false); } }
private void cmbAnswerTypeValueChanged() { setControlsStatus(); enableLkpControls(); enableSeparatorText(); enableChkMultiselect(); enableMultiselect(); enableChkCustomWidth(); enableCustomWidth(); hideColourColumn(); form.chkIsMandatory().setEnabled(!(form.cmbAnswerType().getValue() instanceof QuestionAnswerType && form.cmbAnswerType().getValue().equals(QuestionAnswerType.SEPARATOR))); //WDEV-13768 form.txtValidationMsg().setEnabled(!QuestionAnswerType.SEPARATOR.equals(form.cmbAnswerType().getValue()) && form.chkIsMandatory().getValue()); if(form.cmbAnswerType().getValue() instanceof QuestionAnswerType && form.cmbAnswerType().getValue().equals(QuestionAnswerType.SEPARATOR)) { form.chkIsMandatory().setValue(false); form.txtValidationMsg().setValue(null); } }
private void hideColourColumn() { QuestionType qType = form.getGlobalContext().Core.getQuestionType(); if (qType != null) { QuestionAnswerType type = form.cmbAnswerType().getValue(); if (type != null && isSingleOrMultiSelect(type)) { form.grdAnswerOption().setcolColourCaption("Colour"); setReadonlyColColour(false); } else { form.grdAnswerOption().setcolColourCaption(" "); setReadonlyColColour(true); } } }
private boolean isAnswered(AnswerDetailsVo answerDetail) { if (answerDetail == null || answerDetail.getAnswerType() == null || answerDetail.getAnswerType().getAnswerType() == null) return false; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DATE)) return answerDetail.getDateAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DECIMAL)) return answerDetail.getDecimalAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.INTEGER)) return answerDetail.getIntegerAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.MULTISELECT)) return answerDetail.getMultiSelectAnswersIsNotNull() && answerDetail.getMultiSelectAnswers().size() > 0; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PARTIALDATE)) return answerDetail.getPartialDateIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PICKLIST)) return answerDetail.getPicklistIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TEXT)) return answerDetail.getStringAnswerIsNotNull() && answerDetail.getStringAnswer().trim().length() > 0; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TIME)) return answerDetail.getTimeAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.YESNO)) return answerDetail.getBoolValueAnswerIsNotNull(); return false; }
private void setCellTooltip(DynamicGridCell cell, QuestionAnswerTypeVo configAnswer, boolean readOnlyBecauseUserHasNoRoles) { if(readOnlyBecauseUserHasNoRoles)//wdev-3709 { cell.setTooltip("Role permissions do not allow you answer this question"); return; } //WDEV-17363 if (Boolean.TRUE.equals(form.dyngrdAnswers().isReadOnly())) return; if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.DATE)) cell.setTooltip("Select date"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL)) cell.setTooltip("Enter decimal value"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER)) cell.setTooltip("Enter numeric value"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE)) cell.setTooltip("Enter partial date"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.TEXT)) cell.setTooltip("Enter text"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.TIME)) cell.setTooltip("Enter time"); }
private DynamicCellType getCellAnswerType(ims.core.vo.lookups.QuestionAnswerType answerType) { if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE)) return DynamicCellType.DATE; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL)) return DynamicCellType.DECIMAL; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER)) return DynamicCellType.INT; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT)) return DynamicCellType.MULTISELECT; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE)) return DynamicCellType.PARTIALDATE; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST)) return DynamicCellType.ENUMERATION; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)) return DynamicCellType.DYNAMICLABEL; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT)) return DynamicCellType.WRAPTEXT; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME)) return DynamicCellType.TIME; else if (answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO)) return DynamicCellType.ANSWER; return DynamicCellType.EMPTY; }
private void setCellTooltip(DynamicGridCell cell, Question_AnswerTypeVo configAnswer, boolean readOnlyBecauseUserHasNoRoles) { if(readOnlyBecauseUserHasNoRoles)//wdev-3709 { cell.setTooltip("Role permissions do not allow you answer this question"); return; } if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.DATE)) cell.setTooltip("Select date"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL)) cell.setTooltip("Enter decimal value"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER)) cell.setTooltip("Enter numeric value"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE)) cell.setTooltip("Enter partial date"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.TEXT)) cell.setTooltip("Enter text"); else if (configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.TIME)) cell.setTooltip("Enter time"); }
private boolean isAnswered(Answer_DetailsVo answerDetail) { if (answerDetail == null || answerDetail.getAnswerType() == null || answerDetail.getAnswerType().getAnswerType() == null) return false; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DATE)) return answerDetail.getDateAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DECIMAL)) return answerDetail.getDecimalAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.INTEGER)) return answerDetail.getIntegerAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.MULTISELECT)) return answerDetail.getMultiSelectAnswersIsNotNull() && answerDetail.getMultiSelectAnswers().size() > 0; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PARTIALDATE)) return answerDetail.getPartialDateIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PICKLIST)) return answerDetail.getPicklistIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TEXT)) return answerDetail.getStringAnswerIsNotNull() && answerDetail.getStringAnswer().trim().length() > 0; if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TIME)) return answerDetail.getTimeAnswerIsNotNull(); if (answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.YESNO)) return answerDetail.getBoolValueAnswerIsNotNull(); return false; }
private boolean isAnswered(AnswerDetailsVo answerDetail) { if(answerDetail == null || answerDetail.getAnswerType() == null || answerDetail.getAnswerType().getAnswerType() == null) return false; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DATE)) return answerDetail.getDateAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DECIMAL)) return answerDetail.getDecimalAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.INTEGER)) return answerDetail.getIntegerAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.MULTISELECT)) return answerDetail.getMultiSelectAnswersIsNotNull() && answerDetail.getMultiSelectAnswers().size() > 0; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PARTIALDATE)) return answerDetail.getPartialDateIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PICKLIST)) return answerDetail.getPicklistIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TEXT)) return answerDetail.getStringAnswerIsNotNull() && answerDetail.getStringAnswer().trim().length() > 0; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TIME)) return answerDetail.getTimeAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.YESNO)) return answerDetail.getBoolValueAnswerIsNotNull(); return false; }
private static String getPreviousSeparatorIfExists(AssessmentQuestionVo assessmentQuestion, QuestionAnswerTypeVo ansType) { if(assessmentQuestion == null || ansType == null) return null; if(assessmentQuestion.getQuestion() == null || assessmentQuestion.getQuestion().getAnswerTypes() == null) return null; for (int i = 0; i < assessmentQuestion.getQuestion().getAnswerTypes().size(); i++) { QuestionAnswerTypeVo voQuestionAnswerType = assessmentQuestion.getQuestion().getAnswerTypes().get(i); if(voQuestionAnswerType != null && voQuestionAnswerType.equals(ansType)) { if(i > 0) { QuestionAnswerTypeVo voPrevAnswerType = assessmentQuestion.getQuestion().getAnswerTypes().get(i-1); if(voPrevAnswerType != null && voPrevAnswerType.getAnswerTypeIsNotNull() && voPrevAnswerType.getAnswerType().equals(QuestionAnswerType.SEPARATOR)) return voPrevAnswerType.getSeparatorText(); } } } return null; }
private DynamicCellType getCellAnswerType(ims.core.vo.lookups.QuestionAnswerType answerType) { if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DATE)) return DynamicCellType.DATE; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.DECIMAL)) return DynamicCellType.DECIMAL; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.INTEGER)) return DynamicCellType.INT; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT)) return DynamicCellType.MULTISELECT; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PARTIALDATE)) return DynamicCellType.PARTIALDATE; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST)) return DynamicCellType.ENUMERATION; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)) return DynamicCellType.DYNAMICLABEL; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TEXT)) return DynamicCellType.WRAPTEXT; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.TIME)) return DynamicCellType.TIME; else if(answerType.equals(ims.core.vo.lookups.QuestionAnswerType.YESNO)) return DynamicCellType.ANSWER; return DynamicCellType.EMPTY; }
private boolean isAnswered(Answer_DetailsVo answerDetail) { if(answerDetail == null || answerDetail.getAnswerType() == null || answerDetail.getAnswerType().getAnswerType() == null) return false; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DATE)) return answerDetail.getDateAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.DECIMAL)) return answerDetail.getDecimalAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.INTEGER)) return answerDetail.getIntegerAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.MULTISELECT)) return answerDetail.getMultiSelectAnswersIsNotNull() && answerDetail.getMultiSelectAnswers().size() > 0; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PARTIALDATE)) return answerDetail.getPartialDateIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.PICKLIST)) return answerDetail.getPicklistIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TEXT)) return answerDetail.getStringAnswerIsNotNull() && answerDetail.getStringAnswer().trim().length() > 0; if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.TIME)) return answerDetail.getTimeAnswerIsNotNull(); if(answerDetail.getAnswerType().getAnswerType().equals(QuestionAnswerType.YESNO)) return answerDetail.getBoolValueAnswerIsNotNull(); return false; }
private void setAnswerCellValue(DynamicGridCell cell, QuestionAnswerTypeVo configAnswer) { if(configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)) { cell.setTextColor(DEFAULT_SEPARATOR_CELL_TEXT_COLOR); cell.setValue(" " + (configAnswer.getSeparatorTextIsNotNull() ? configAnswer.getSeparatorText() : "") + " "); } else if(configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.YESNO)) { cell.getItems().clear(); cell.getItems().newItem(this.optionYes); cell.getItems().newItem(this.optionNo); } else if(configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.PICKLIST)) { setAnswerCellOptions(configAnswer, cell); } else if(configAnswer.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.MULTISELECT)) { setAnswerCellOptions(configAnswer, cell); if(configAnswer.getMaxMultiselectAllowedIsNotNull()) { cell.setMaxCheckedItemsForMultiSelect(configAnswer.getMaxMultiselectAllowed()); } } }