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 setDefaultDynamicGridCheckBox(QuestionAnswerTypeVo voAnswType, boolean selectFirst) { if (selectFirst && countDynRowBoolean() > 1) return; if (isScoringAssessmentQuestion() && isSingleOrMultiSelect(voAnswType.getAnswerType())) { for (int i = 0; i < form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().size(); i++) { DynamicGridRow row = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().get(i); for (int j = 0; j < form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().size(); j++) { DynamicGridCell cell = row.getCells().get(form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().get(j)); if (cell != null && cell.getType() == DynamicCellType.BOOL) { cell.setValue(new Boolean(true)); return; } } } } }
protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if(formName.equals(form.getForms().Core.TaxonomySearch) && result.equals(DialogResult.OK)) { TaxonomyMap voTaxonomy = form.getGlobalContext().Core.getTaxonomyMap(); if(voTaxonomy != null) { //Check for duplicates if(form.grdTaxonomy().getValues().indexOf(voTaxonomy) < 0) setTaxonomyGridRowData(form.grdTaxonomy().getRows().newRow(true), form.getGlobalContext().Core.getTaxonomyMap()); } } if(formName.equals(form.getForms().Core.QuestionAnswerType) && result.equals(DialogResult.OK)) { QuestionAnswerTypeVo voAnswType = form.getGlobalContext().Core.getQuestionAnswerType(); if(voAnswType != null) { GenForm.grdAnswerTypeRow row = form.grdAnswerType().getRowByValue(voAnswType); if(row == null) row = form.grdAnswerType().getRows().newRow(true); setAnswerGridRowData(row, voAnswType); enableContextMenu(); } } }
private void addAnswerType() { QuestionAnswerTypeVo voQAnswer = new QuestionAnswerTypeVo(); voQAnswer.setActiveStatus(new Boolean(true)); form.getGlobalContext().Core.setQuestionAnswerType(voQAnswer); form.getLocalContext().setIsNewAnwerType(new Boolean(true)); engine.open(form.getForms().Core.QuestionAnswerType); /* if(form.qmbLookupType().getValue() == null) { engine.showMessage("Please select a Lookup Type first"); form.qmbLookupType().setFocus(); return; }*/ /*grdAnswerTypeRow row = form.grdAnswerType().getRows().newRow(true); form.grdAnswerType().setEnabled(true); form.grdAnswerType().setReadOnly(false); row.setReadOnly(false); enableContextMenu();*/ }
private QuestionAnswerTypeVoCollection getAnswerTypes() { //Get the active ones - from the grid QuestionAnswerTypeVoCollection voColl = form.grdAnswerType().getValues(); //Add the inactive ones QuestionAnswerTypeVoCollection voInactiveColl = form.getLocalContext().getInactiveAnswerTypes(); QuestionAnswerTypeVo voQAnswType; if(voInactiveColl != null) { for (int i = 0; i < voInactiveColl.size(); i++) { voQAnswType = voInactiveColl.get(i); voColl.add(voQAnswType); } } return voColl; }
protected QuestionAnswerTypeVo copy(QuestionAnswerTypeVo answer) { try { ByteArrayOutputStream baostream = new ByteArrayOutputStream(); ObjectOutputStream oostream = new ObjectOutputStream(baostream); oostream.writeObject(answer); oostream.flush(); oostream.close(); ByteArrayInputStream baistream = new ByteArrayInputStream(baostream.toByteArray()); ObjectInputStream oistream = new ObjectInputStream(baistream); QuestionAnswerTypeVo auxAnswer = (QuestionAnswerTypeVo)oistream.readObject(); oistream.close(); return auxAnswer; } catch(Throwable t) { String error[]={t.getMessage()}; engine.showErrors(error); return null; } }
private void open() { QuestionAnswerTypeVo voQAnswerType = form.getGlobalContext().Core.getQuestionAnswerType(); if (voQAnswerType != null) { populateScreenFromData(voQAnswerType); populateAnswerOptions(voQAnswerType); } setAnswerTypeInitialValue(); form.setMode(isDialogViewMode() ? FormMode.VIEW : FormMode.EDIT); cmbAnswerTypeValueChanged(); setGridAnswerOptionStat(); customizeScoringAssessment(); enableContextMenu(); }
private DynamicGridCell findCell(DynamicGridRow questionRow, QuestionAnswerTypeVo answerType) { if (questionRow == null) return null; if (answerType == null) return null; for (int x = 0; x < this.grid.getColumns().size(); x++) { DynamicGridCell cell = questionRow.getCells().get(this.grid.getColumns().get(x)); if (cell != null && cell.getIdentifier() != null) { if (cell.getIdentifier() instanceof QuestionAnswerTypeVo && cell.getIdentifier().equals(answerType)) return cell; else if (cell.getIdentifier() instanceof AnswerCellData && ((AnswerCellData) cell.getIdentifier()).getConfigData().equals(answerType)) return cell; } } return null; }
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType) { if (instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null) return null; for (int x = 0; x < instQuestion.getPatientAnswers().size(); x++) { PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x); if (answer != null && answer.getAnswerDetails() != null) { for (int y = 0; y < answer.getAnswerDetails().size(); y++) { if (answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType)) { return answer.getAnswerDetails().get(y); } } } } return null; }
private AnswerDetailsVo getInstAnswerType(PatientAssessmentAnswerVoCollection patientAnswers, QuestionAnswerTypeVo configAnswerType) { if (patientAnswers == null || patientAnswers.size() == 0 || configAnswerType == null) return null; for (int i = 0; i < patientAnswers.size(); i++) { PatientAssessmentAnswerVo voPatAssAnswerVo = patientAnswers.get(i); for (int j = 0; voPatAssAnswerVo != null && j < voPatAssAnswerVo.getAnswerDetails().size(); j++) { if (voPatAssAnswerVo.getAnswerDetails().get(j).getAnswerTypeIsNotNull() && voPatAssAnswerVo.getAnswerDetails().get(j).getAnswerType().equals(configAnswerType)) { return voPatAssAnswerVo.getAnswerDetails().get(j); } } } return null; }
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 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 DynamicGridCell findCell(DynamicGridRow questionRow, QuestionAnswerTypeVo answerType) { if(questionRow == null) return null; if(answerType == null) return null; for(int x = 0; x < this.grid.getColumns().size(); x++) { DynamicGridCell cell = questionRow.getCells().get(this.grid.getColumns().get(x)); if(cell != null && cell.getIdentifier() != null) { if(cell.getIdentifier() instanceof QuestionAnswerTypeVo && cell.getIdentifier().equals(answerType)) return cell; else if(cell.getIdentifier() instanceof AnswerCellData && ((AnswerCellData)cell.getIdentifier()).getConfigData().equals(answerType)) return cell; } } return null; }
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType) { if(instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null) return null; for(int x = 0; x < instQuestion.getPatientAnswers().size(); x++) { PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x); if(answer != null && answer.getAnswerDetails() != null) { for(int y = 0; y < answer.getAnswerDetails().size(); y++) { if(answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType)) { return answer.getAnswerDetails().get(y); } } } } return null; }
private AnswerDetailsVo getInstAnswerType(PatientAssessmentAnswerVoCollection patientAnswers, QuestionAnswerTypeVo configAnswerType) { if(patientAnswers == null || patientAnswers.size() == 0 || configAnswerType == null) return null; for (int i = 0; i < patientAnswers.size(); i++) { PatientAssessmentAnswerVo voPatAssAnswerVo = patientAnswers.get(i); for (int j = 0; voPatAssAnswerVo != null && j < voPatAssAnswerVo.getAnswerDetails().size(); j++) { if(voPatAssAnswerVo.getAnswerDetails().get(j).getAnswerTypeIsNotNull() && voPatAssAnswerVo.getAnswerDetails().get(j).getAnswerType().equals(configAnswerType)) { return voPatAssAnswerVo.getAnswerDetails().get(j); } } } return null; }
private DynamicGridCell addAnswerCell(DynamicGridRow row, DynamicGridColumn column, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer, boolean readOnly) throws PresentationLogicException { checkDataIntegrity(configAnswer); DynamicCellType cellAnswerType = getCellAnswerType(configAnswer.getAnswerType()); DynamicGridCell cell = row.getCells().newCell(column, cellAnswerType); cell.setWidth(getCellAnswerWidth(configAnswer, instAnswer)); cell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS); cell.setIdentifier(configAnswer); cell.setReadOnly(readOnly); setAnswerCellValue(cell, configAnswer, instAnswer); setCellTooltip(cell, configAnswer); if(isDPP && cellAnswerType != null && cellAnswerType.equals(DynamicCellType.MULTISELECT)) { cell.setAutoPostBack(true); } return cell; }
private DynamicGridCell addAnswerCell(DynamicGridRow row, DynamicGridColumn column, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer, boolean readOnly) throws PresentationLogicException { checkDataIntegrity(configAnswer); DynamicCellType cellAnswerType = getCellAnswerType(configAnswer.getAnswerType()); DynamicGridCell cell = row.getCells().newCell(column, cellAnswerType); cell.setWidth(getCellAnswerWidth(configAnswer, instAnswer)); cell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS); cell.setIdentifier(configAnswer); cell.setReadOnly(readOnly); setAnswerCellValue(cell, configAnswer, instAnswer); setCellAnswer(cell, instAnswer); if (instAnswer == null) { setCellTooltip(cell, configAnswer); } else //WDEV-16927 { setCellAnswerTooltip(cell, instAnswer); } return cell; }
private DynamicGridCell findCell(DynamicGridRow questionRow, QuestionAnswerTypeVo answerType) { if(questionRow == null) return null; if(answerType == null) return null; for(int x = 0; x < this.gridQuestions.getColumns().size(); x++) { DynamicGridCell cell = questionRow.getCells().get(this.gridQuestions.getColumns().get(x)); if(cell != null && cell.getIdentifier() != null && cell.getIdentifier() instanceof QuestionAnswerTypeVo) { if(cell.getIdentifier().equals(answerType)) return cell; } } return null; }
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()); } } }
private DynamicGridCell addAnswerCell(DynamicGridRow row, DynamicGridColumn column, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer, boolean readOnly) { DynamicCellType cellAnswerType = getCellAnswerType(configAnswer.getAnswerType()); DynamicGridCell cell = row.getCells().newCell(column, cellAnswerType); cell.setWidth(getCellAnswerWidth(configAnswer, instAnswer)); cell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS); cell.setIdentifier(configAnswer); cell.setReadOnly(readOnly); setAnswerCellValue(cell, configAnswer, instAnswer); setCellAnswer(cell, instAnswer); if (instAnswer == null) { setCellTooltip(cell, configAnswer); } else { setCellAnswerTooltip(cell, instAnswer); } return cell; }