Java Code Examples for ims.core.vo.QuestionAnswerTypeVo

The following are top voted examples for showing how to use ims.core.vo.QuestionAnswerTypeVo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
				}
			}
		}
	}
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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();
		}
	}
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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();*/
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
    } 
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 11
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
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");
}
 
Example 12
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 13
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 14
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 15
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 16
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 17
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 18
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 19
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 20
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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());
		}								
	}
}
 
Example 21
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 22
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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();
		}
	}
}
 
Example 23
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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");
}
 
Example 24
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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();*/
}
 
Example 25
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 26
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 27
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 28
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 29
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 30
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 31
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 32
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 33
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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());
		}								
	}
}
 
Example 34
Project: openmaxims-linux   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 35
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 36
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 37
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 38
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
				}
			}
		}
	}
}
 
Example 39
Project: openMAXIMS   File: UserAssessmentInstHelper.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 40
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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");
}
 
Example 41
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 42
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
    } 
}
 
Example 43
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
    } 
}
 
Example 44
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 45
Project: openmaxims-linux   File: MyOrderQuestionsPopulation.java   Source Code and License 6 votes vote down vote up
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());
		}								
	}
}
 
Example 46
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
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;
				}
			}
		}
	}
}
 
Example 47
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void updateAnswerType()
{
	Object objQAT = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getValue();
	form.getGlobalContext().Core.setQuestionAnswerType(objQAT instanceof QuestionAnswerTypeVo ? (QuestionAnswerTypeVo) objQAT : null);
	form.getLocalContext().setIsNewAnwerType(new Boolean(false));
	engine.open(form.getForms().Core.QuestionAnswerType);
}
 
Example 48
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 49
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private DynamicGridRow getDynamicRowByValue(QuestionAnswerTypeVo voAnswType)
{
	for (int i = 0; i < form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().size(); i++)
	{
		if (voAnswType.equals(form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().get(i).getValue()))
			return form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().get(i);
	}
	return null;
}
 
Example 50
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void deactivateAnswerType()
{
	QuestionAnswerTypeVo voQAnsType = form.grdAnswerType().getValue();
	//Add it to the Inactive only if was saved
	if(voQAnsType != null && voQAnsType.getID_QuestionAnswerTypeIsNotNull())
	{
		voQAnsType.setActiveStatus(new Boolean(false));
		addLookupToInactiveList(voQAnsType);
	}
	form.grdAnswerType().removeSelectedRow();			
	enableContextMenu();
}
 
Example 51
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void setAnswerGridRowData(grdAnswerTypeRow row, QuestionAnswerTypeVo vo) 
{
	if(row != null && vo != null)
	{
		row.setColAnswerType(vo.getAnswerTypeIsNotNull()?vo.getAnswerType().toString():"");
		row.setColMandatory(vo.getIsMandatoryIsNotNull() && vo.getIsMandatory().booleanValue()?"Yes":"No");
		if(vo.getActiveStatus() == null || vo.getActiveStatus().booleanValue() == false)
			row.setBackColor(Color.LightSalmon);
		row.setValue(vo);
	}
}
 
Example 52
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onBtnOkClick() throws PresentationLogicException
{
	QuestionAnswerTypeVo voQAnswerType=null;
	
	if (form.getGlobalContext().Core.getQuestionAnswerTypeIsNotNull())
	{
		voQAnswerType = this.copy(form.getGlobalContext().Core.getQuestionAnswerType());	
	}
	for (int i=0;i<form.grdAnswerOption().getRows().size();i++)
	{
		if ((form.grdAnswerOption().getRows().get(i).getcolExtCodeType()!=null && (form.grdAnswerOption().getRows().get(i).getcolCode() == null || form.grdAnswerOption().getRows().get(i).getcolCode().length() == 0))
				|| (form.grdAnswerOption().getRows().get(i).getcolExtCodeType()==null && form.grdAnswerOption().getRows().get(i).getcolCode() != null && form.grdAnswerOption().getRows().get(i).getcolCode().length() != 0))
		{
			String errors[]={"Both fields of Taxonomy Mappings are Mandatory"};
			engine.showErrors(errors);
			return;
		}
	}
	populateDataFromScreen(voQAnswerType);
	populateDataFromAnswerOptions(voQAnswerType);
	if (isDataValid(voQAnswerType) == false)
	{
		return;
	}

	form.getGlobalContext().Core.setQuestionAnswerType(voQAnswerType);
	engine.close(DialogResult.OK);
}
 
Example 53
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 54
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateAnswerOptions(QuestionAnswerTypeVo voQAnswerType)
{
	form.grdAnswerOption().getRows().clear();
	for (int i = 0; voQAnswerType.getOptionsIsNotNull() && i < voQAnswerType.getOptions().size(); i++)
	{
		grdAnswerOptionRow row = form.grdAnswerOption().getRows().newRow();
		if (isScoringAssessmentQuestion() == false)
			row.setcolScoreReadOnly(true);
		setRowData(voQAnswerType.getOptions().get(i), row);
	}
}
 
Example 55
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private boolean isDataValid(QuestionAnswerTypeVo voQAnswerType)
{
	String[] uiErrors = getUiErrors();
	String[] errors = voQAnswerType.validate(uiErrors);
	ArrayList <String> errorss=new ArrayList<String>();
	
	if (errors != null)
	{
		if (errors.length>1)
		{
			for (int i=0;i<errors.length;i++)
			{
				errorss.add(errors[i]);
			}
			for (int j=0;j<errorss.size();j++)
			{
				if (errorss.get(j).equals("TaxonomyName is mandatory")||errorss.get(j).equals("TaxonomyCode is mandatory"))
				{
					errorss.remove(j);
					j--;
				}
			}	
				
			if (errorss.size()==0)
				return true;
			else
			{
				engine.showErrors(errorss.toArray(new String[0]));
				return false;
			}
		}
		else
		{
			engine.showErrors(errors);
			return false;
		}
	}

	return true;
}
 
Example 56
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void populateScreenFromData(QuestionAnswerTypeVo voQAnswerType)
{
	if (voQAnswerType.getMaxMultiselectAllowedIsNotNull())
		form.chkMaxMultiselect().setValue(true);
	if (voQAnswerType.getAnswerWidthIsNotNull())
		form.chkCustomWidth().setValue(true);
	super.populateScreenFromData(voQAnswerType);
}
 
Example 57
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private DynamicGridCell addAnswerCell(DynamicGridRow row, DynamicGridColumn column, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer, boolean readOnly, boolean readOnlyBecauseUserHasNoRoles) throws PresentationLogicException
{
	checkDataIntegrity(configAnswer);

	DynamicGridCell cell = row.getCells().newCell(column, getCellAnswerType(configAnswer.getAnswerType()));

	cell.setWidth(getCellAnswerWidth(configAnswer, instAnswer));
	cell.setDecoratorType(DynamicCellDecoratorMode.ALWAYS);
	cell.setIdentifier(configAnswer);
	cell.setReadOnly(readOnly);
	setAnswerCellValue(cell, configAnswer, instAnswer);
	setCellTooltip(cell, configAnswer, readOnlyBecauseUserHasNoRoles);//wdev-3709

	return cell;
}
 
Example 58
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void setAnswerCellValue(DynamicGridCell cell, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer)
{
	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, this.optionYes.getIItemImage());
		cell.getItems().newItem(this.optionNo, this.optionNo.getIItemImage());
	}
	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, instAnswer);

		if (instAnswer != null)
		{
			if (instAnswer.getMaxMultiselectAllowedIsNotNull())
			{
				cell.setMaxCheckedItemsForMultiSelect(instAnswer.getMaxMultiselectAllowed());
			}
		}
		else
		{
			if (configAnswer.getMaxMultiselectAllowedIsNotNull())
			{
				cell.setMaxCheckedItemsForMultiSelect(configAnswer.getMaxMultiselectAllowed());
			}
		}
	}
}
 
Example 59
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void checkDataIntegrity(QuestionAnswerTypeVo answer) throws PresentationLogicException
{
	if (answer == null)
		throw new PresentationLogicException("Invalid user assessment question answer");
	if (answer.getAnswerType() == null)
		throw new PresentationLogicException("Invalid user assessment question answer type");
}
 
Example 60
Project: AvoinApotti   File: UserAssessmentInstHelper.java   Source Code and License 5 votes vote down vote up
private void setAnswerCellValue(DynamicGridCell cell, QuestionAnswerTypeVo configAnswer, AnswerDetailsVo instAnswer) 
{
	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, this.optionYes.getIItemImage());
		cell.getItems().newItem(this.optionNo, this.optionNo.getIItemImage());
	}
	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, instAnswer);
		
		if(instAnswer != null)
		{
			if(instAnswer.getMaxMultiselectAllowedIsNotNull())
			{
				cell.setMaxCheckedItemsForMultiSelect(instAnswer.getMaxMultiselectAllowed());						
			}
		}
		else
		{
			if(configAnswer.getMaxMultiselectAllowedIsNotNull())
			{
				cell.setMaxCheckedItemsForMultiSelect(configAnswer.getMaxMultiselectAllowed());
			}
		}							
	}
}