Search in sources :

Example 16 with TemplateDeclaration

use of uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration in project openolat by klemens.

the class AssessmentItemComponentRenderer method renderPrintedVariable.

@Override
protected void renderPrintedVariable(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, ResolvedAssessmentItem resolvedAssessmentItem, ItemSessionState itemSessionState, PrintedVariable printedVar) {
    Identifier identifier = printedVar.getIdentifier();
    Value templateValue = itemSessionState.getTemplateValues().get(identifier);
    Value outcomeValue = itemSessionState.getOutcomeValues().get(identifier);
    sb.append("<span class='printedVariable'>");
    if (outcomeValue != null) {
        OutcomeDeclaration outcomeDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getOutcomeDeclaration(identifier);
        renderPrintedVariable(renderer, sb, printedVar, outcomeDeclaration, outcomeValue);
    } else if (templateValue != null) {
        TemplateDeclaration templateDeclaration = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful().getTemplateDeclaration(identifier);
        renderPrintedVariable(renderer, sb, printedVar, templateDeclaration, templateValue);
    } else {
        sb.append("(variable ").append(identifier.toString()).append(" was not found)");
    }
    sb.append("</span>");
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) Value(uk.ac.ed.ph.jqtiplus.value.Value) TemplateDeclaration(uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Aggregations

TemplateDeclaration (uk.ac.ed.ph.jqtiplus.node.item.template.declaration.TemplateDeclaration)16 URL (java.net.URL)8 Test (org.junit.Test)8 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)8 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)8 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)8 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)4 Value (uk.ac.ed.ph.jqtiplus.value.Value)4 Expression (uk.ac.ed.ph.jqtiplus.node.expression.Expression)2 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)2 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)2 SetCorrectResponse (uk.ac.ed.ph.jqtiplus.node.item.template.processing.SetCorrectResponse)2 ComplexReferenceIdentifier (uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier)2 BaseType (uk.ac.ed.ph.jqtiplus.value.BaseType)2 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)2