Java Code Examples for ims.core.vo.QuestionAnswerTypeVo.getOptionsIsNotNull()

The following are Jave code examples for showing how to use getOptionsIsNotNull() of the ims.core.vo.QuestionAnswerTypeVo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 5 votes
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 2
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 5 votes
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);
}
 
Example 3
Project: AvoinApotti   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
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);
	}
 
Example 4
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
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 5
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 5 votes
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);
}
 
Example 6
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
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);
	}
 
Example 7
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
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);
}
 
Example 8
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
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 9
Project: openMAXIMS   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
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);
	}
 
Example 10
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 5 votes
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 11
Project: openmaxims-linux   File: MyOrderQuestionsPopulation.java   View Source Code Vote up 5 votes
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);
	}
 
Example 12
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private void createDynamicGridRow(QuestionAnswerTypeVo voQAT, DynamicGridRow row)
{
	DynamicGridColumn colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLANSWERTYPE);
	if (colAnswerType == null)
	{
		colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Answer Type", COLANSWERTYPE);
		colAnswerType.setWidth(650);
	}

	DynamicGridColumn colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLSCORANSWER);
	if (colScorAnswer == null)
	{
		colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Scoring Answer", COLSCORANSWER);
		colScorAnswer.setWidth(isScoringAssessmentQuestion() ? -1 : 0);
		colScorAnswer.setAlignment(Alignment.CENTER);
	}

	if (voQAT != null)
	{
		DynamicGridRow parentRow = row != null ? row : form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().newRow();
		if (voQAT.getAnswerTypeIsNotNull())
		{
			parentRow.setExpandedImage(voQAT.getAnswerType().getImage());
			parentRow.setCollapsedImage(voQAT.getAnswerType().getImage());
		}
		parentRow.setSelectable(true);
		parentRow.setValue(voQAT);
		parentRow.setExpanded(true);
		parentRow.getRows().clear();

		DynamicGridCell parentCell = parentRow.getCells().get(getDynamicColumn(COLANSWERTYPE));
		if (parentCell == null)
			parentCell = parentRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
		parentCell.setValue(voQAT.getAnswerTypeIsNotNull() ? voQAT.getAnswerType().toString() : "");
		parentCell.setTooltip(getParentTooltip(voQAT));
		parentCell.setReadOnly(true);

		// Checkbox
		if (isScoringAssessmentQuestion() && isSingleOrMultiSelect(voQAT.getAnswerType()))
		{
			DynamicGridCell boolCell = parentRow.getCells().newCell(colScorAnswer, DynamicCellType.BOOL);
			boolCell.setReadOnly(form.getMode().equals(FormMode.VIEW));
			boolCell.setAutoPostBack(true);
		}
		// Children
		for (int i = 0; voQAT.getOptionsIsNotNull() && i < voQAT.getOptions().size(); i++)
		{
			DynamicGridRow childRow = parentRow.getRows().newRow();
			childRow.setSelectable(false);

			DynamicGridCell childCell = childRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
			childCell.setValue(voQAT.getOptions().get(i).toString());
			childCell.setTooltip(getChildTooltip(voQAT.getOptions().get(i)));
			childCell.setReadOnly(true);
		}
	}
}
 
Example 13
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 14
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
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);
				// WDEV-3708
				item.setTooltip(answerItem.getOptionDescription() != null ? answerItem.getOptionDescription() : "");
				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);

	// cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems ==
	// 0?1:maxVisibleItems);
}
 
Example 15
Project: AvoinApotti   File: StructuredAssessmentsHelper.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 16
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private void createDynamicGridRow(QuestionAnswerTypeVo voQAT, DynamicGridRow row)
{
	DynamicGridColumn colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLANSWERTYPE);
	if (colAnswerType == null)
	{
		colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Answer Type", COLANSWERTYPE);
		colAnswerType.setWidth(650);
	}

	DynamicGridColumn colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLSCORANSWER);
	if (colScorAnswer == null)
	{
		colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Scoring Answer", COLSCORANSWER);
		colScorAnswer.setWidth(isScoringAssessmentQuestion() ? -1 : 0);
		colScorAnswer.setAlignment(Alignment.CENTER);
	}

	if (voQAT != null)
	{
		DynamicGridRow parentRow = row != null ? row : form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().newRow();
		if (voQAT.getAnswerTypeIsNotNull())
		{
			parentRow.setExpandedImage(voQAT.getAnswerType().getImage());
			parentRow.setCollapsedImage(voQAT.getAnswerType().getImage());
		}
		parentRow.setSelectable(true);
		parentRow.setValue(voQAT);
		parentRow.setExpanded(true);
		parentRow.getRows().clear();

		DynamicGridCell parentCell = parentRow.getCells().get(getDynamicColumn(COLANSWERTYPE));
		if (parentCell == null)
			parentCell = parentRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
		parentCell.setValue(voQAT.getAnswerTypeIsNotNull() ? voQAT.getAnswerType().toString() : "");
		parentCell.setTooltip(getParentTooltip(voQAT));
		parentCell.setReadOnly(true);

		// Checkbox
		if (isScoringAssessmentQuestion() && isSingleOrMultiSelect(voQAT.getAnswerType()))
		{
			DynamicGridCell boolCell = parentRow.getCells().newCell(colScorAnswer, DynamicCellType.BOOL);
			boolCell.setReadOnly(form.getMode().equals(FormMode.VIEW));
			boolCell.setAutoPostBack(true);
		}
		// Children
		for (int i = 0; voQAT.getOptionsIsNotNull() && i < voQAT.getOptions().size(); i++)
		{
			DynamicGridRow childRow = parentRow.getRows().newRow();
			childRow.setSelectable(false);

			DynamicGridCell childCell = childRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
			childCell.setValue(voQAT.getOptions().get(i).toString());
			childCell.setTooltip(getChildTooltip(voQAT.getOptions().get(i)));
			childCell.setReadOnly(true);
		}
	}
}
 
Example 17
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
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);
				// WDEV-3708
				item.setTooltip(answerItem.getOptionDescription() != null ? answerItem.getOptionDescription() : "");
				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);

	// cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems ==
	// 0?1:maxVisibleItems);
}
 
Example 19
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 20
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private void createDynamicGridRow(QuestionAnswerTypeVo voQAT, DynamicGridRow row)
{
	DynamicGridColumn colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLANSWERTYPE);
	if (colAnswerType == null)
	{
		colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Answer Type", COLANSWERTYPE);
		colAnswerType.setWidth(650);
	}

	DynamicGridColumn colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLSCORANSWER);
	if (colScorAnswer == null)
	{
		colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Scoring Answer", COLSCORANSWER);
		colScorAnswer.setWidth(isScoringAssessmentQuestion() ? -1 : 0);
		colScorAnswer.setAlignment(Alignment.CENTER);
	}

	if (voQAT != null)
	{
		DynamicGridRow parentRow = row != null ? row : form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().newRow();
		if (voQAT.getAnswerTypeIsNotNull())
		{
			parentRow.setExpandedImage(voQAT.getAnswerType().getImage());
			parentRow.setCollapsedImage(voQAT.getAnswerType().getImage());
		}
		parentRow.setSelectable(true);
		parentRow.setValue(voQAT);
		parentRow.setExpanded(true);
		parentRow.getRows().clear();

		DynamicGridCell parentCell = parentRow.getCells().get(getDynamicColumn(COLANSWERTYPE));
		if (parentCell == null)
			parentCell = parentRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
		parentCell.setValue(voQAT.getAnswerTypeIsNotNull() ? voQAT.getAnswerType().toString() : "");
		parentCell.setTooltip(getParentTooltip(voQAT));
		parentCell.setReadOnly(true);

		// Checkbox
		if (isScoringAssessmentQuestion() && isSingleOrMultiSelect(voQAT.getAnswerType()))
		{
			DynamicGridCell boolCell = parentRow.getCells().newCell(colScorAnswer, DynamicCellType.BOOL);
			boolCell.setReadOnly(form.getMode().equals(FormMode.VIEW));
			boolCell.setAutoPostBack(true);
		}
		// Children
		for (int i = 0; voQAT.getOptionsIsNotNull() && i < voQAT.getOptions().size(); i++)
		{
			DynamicGridRow childRow = parentRow.getRows().newRow();
			childRow.setSelectable(false);

			DynamicGridCell childCell = childRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
			childCell.setValue(voQAT.getOptions().get(i).toString());
			childCell.setTooltip(getChildTooltip(voQAT.getOptions().get(i)));
			childCell.setReadOnly(true);
		}
	}
}
 
Example 21
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 22
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
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);
				// WDEV-3708
				item.setTooltip(answerItem.getOptionDescription() != null ? answerItem.getOptionDescription() : "");
				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);

	// cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems ==
	// 0?1:maxVisibleItems);
}
 
Example 23
Project: openmaxims-linux   File: StructuredAssessmentsHelper.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 24
Project: openMAXIMS   File: StructuredAssessmentsHelper.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 25
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 4 votes
private void createDynamicGridRow(QuestionAnswerTypeVo voQAT, DynamicGridRow row)
{
	DynamicGridColumn colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLANSWERTYPE);
	if (colAnswerType == null)
	{
		colAnswerType = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Answer Type", COLANSWERTYPE);
		colAnswerType.setWidth(650);
	}

	DynamicGridColumn colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().getByIdentifier(COLSCORANSWER);
	if (colScorAnswer == null)
	{
		colScorAnswer = form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getColumns().newColumn("Scoring Answer", COLSCORANSWER);
		colScorAnswer.setWidth(isScoringAssessmentQuestion() ? -1 : 0);
		colScorAnswer.setAlignment(Alignment.CENTER);
	}

	if (voQAT != null)
	{
		DynamicGridRow parentRow = row != null ? row : form.lyrTabs().tabNewQuestion().dyngrdAnswerTypes().getRows().newRow();
		if (voQAT.getAnswerTypeIsNotNull())
		{
			parentRow.setExpandedImage(voQAT.getAnswerType().getImage());
			parentRow.setCollapsedImage(voQAT.getAnswerType().getImage());
		}
		parentRow.setSelectable(true);
		parentRow.setValue(voQAT);
		parentRow.setExpanded(true);
		parentRow.getRows().clear();

		DynamicGridCell parentCell = parentRow.getCells().get(getDynamicColumn(COLANSWERTYPE));
		if (parentCell == null)
			parentCell = parentRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
		parentCell.setValue(voQAT.getAnswerTypeIsNotNull() ? voQAT.getAnswerType().toString() : "");
		parentCell.setTooltip(getParentTooltip(voQAT));
		parentCell.setReadOnly(true);

		// Checkbox
		if (isScoringAssessmentQuestion() && isSingleOrMultiSelect(voQAT.getAnswerType()))
		{
			DynamicGridCell boolCell = parentRow.getCells().newCell(colScorAnswer, DynamicCellType.BOOL);
			boolCell.setReadOnly(form.getMode().equals(FormMode.VIEW));
			boolCell.setAutoPostBack(true);
		}
		// Children
		for (int i = 0; voQAT.getOptionsIsNotNull() && i < voQAT.getOptions().size(); i++)
		{
			DynamicGridRow childRow = parentRow.getRows().newRow();
			childRow.setSelectable(false);

			DynamicGridCell childCell = childRow.getCells().newCell(colAnswerType, DynamicCellType.STRING);
			childCell.setValue(voQAT.getOptions().get(i).toString());
			childCell.setTooltip(getChildTooltip(voQAT.getOptions().get(i)));
			childCell.setReadOnly(true);
		}
	}
}
 
Example 26
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 4 votes
private String getQuestionTooltip(AssessmentQuestionVo assessmentQuestionVo)
{
	if(assessmentQuestionVo == null)
		return "";
	
	StringBuffer sb = new StringBuffer();
	
	if(assessmentQuestionVo.getQuestionIsNotNull())
	{
		sb.append("<b>Short text: &nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : "");
		sb.append(CR);
		sb.append("<b>Text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getText() : "");
		sb.append(CR);
	}
	
	if(assessmentQuestionVo.getQuestionIsNotNull() && assessmentQuestionVo.getQuestion().getAnswerTypesIsNotNull())
	{
		sb.append("<b>Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>");
		sb.append(assessmentQuestionVo.getQuestion().getStatusIsNotNull() ? assessmentQuestionVo.getQuestion().getStatus().toString() : "");
		sb.append(CR);
		
		sb.append("<b>Answer Types: &nbsp;&nbsp;</b>");
		for (int i = 0; i < assessmentQuestionVo.getQuestion().getAnswerTypes().size(); i++)
		{
			QuestionAnswerTypeVo answerType = assessmentQuestionVo.getQuestion().getAnswerTypes().get(i);
			if(answerType.getActiveStatusIsNotNull() && answerType.getActiveStatus().booleanValue())
			{
				sb.append(CR);
				sb.append("&nbsp;&nbsp;&nbsp;");
				sb.append(i+1);
				sb.append(")");
				sb.append("&nbsp;&nbsp;");
				sb.append(answerType.getAnswerType().getText());
				String separator = answerType.getAnswerTypeIsNotNull() && answerType.getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)?" - " + answerType.getSeparatorText():"";
				sb.append(separator);
				if(answerType.getOptionsIsNotNull())
				{
					for (int j = 0; j < answerType.getOptions().size(); j++)
					{
						AnswerOptionVo option = answerType.getOptions().get(j);
						sb.append(CR);
						sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->&nbsp;");
						sb.append(option.getOptionText());
						
						if(option.getScoreIsNotNull())
						{
							sb.append("&nbsp;&nbsp; (Score: ");
							sb.append(option.getScore().toString());
							sb.append(")");
						}
					}
				}
				sb.append("</li>");
			}
		}
	}
	return sb.toString();
}
 
Example 27
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 4 votes
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);
				// WDEV-3708
				item.setTooltip(answerItem.getOptionDescription() != null ? answerItem.getOptionDescription() : "");
				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);

	// cell.setMaxVisibleItemsForMultiSelect(maxVisibleItems ==
	// 0?1:maxVisibleItems);
}