use of uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun in project OpenOLAT by OpenOLAT.
the class AssessmentHtmlBuilderTest method serializer.
@Test
public void serializer() {
AssessmentItem item = new AssessmentItem();
SimpleChoice helper = new SimpleChoice(item);
P p = new P(helper);
TextRun text = new TextRun(p, "Hello world");
p.getInlines().add(text);
helper.getFlowStatics().add(p);
String content = new AssessmentHtmlBuilder().flowStaticString(helper.getFlowStatics());
Assert.assertTrue(content.contains(">Hello world<"));
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method getParagraph.
public static P getParagraph(QtiNode parent, String content) {
P paragraph = new P(parent);
TextRun text = new TextRun(paragraph, content);
paragraph.getInlines().add(text);
return paragraph;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendTextEntryInteraction.
public static TextEntryInteraction appendTextEntryInteraction(ItemBody itemBody, Identifier responseDeclarationId) {
P paragraph = new P(itemBody);
TextRun text = new TextRun(paragraph, "New text");
paragraph.getInlines().add(text);
TextEntryInteraction textInteraction = new TextEntryInteraction(paragraph);
textInteraction.setResponseIdentifier(responseDeclarationId);
paragraph.getInlines().add(textInteraction);
itemBody.getBlocks().add(paragraph);
return textInteraction;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendHottext.
public static Hottext appendHottext(P parent, Identifier responseId, String text) {
Hottext hottext = new Hottext(parent);
hottext.setIdentifier(responseId);
hottext.getInlineStatics().add(new TextRun(hottext, text));
parent.getInlines().add(hottext);
return hottext;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun in project openolat by klemens.
the class HottextAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, String text, String hottext) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.hottext, title);
// define correct answer
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
Identifier correctResponseId = IdentifierGenerator.newAsIdentifier("ht");
List<Identifier> correctResponseIds = new ArrayList<>();
correctResponseIds.add(correctResponseId);
ResponseDeclaration responseDeclaration = createHottextCorrectResponseDeclaration(assessmentItem, responseDeclarationId, correctResponseIds);
assessmentItem.getNodeGroups().getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
// the single choice interaction
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
HottextInteraction hottextInteraction = appendHottextInteraction(itemBody, responseDeclarationId, 0);
P p = new P(itemBody);
p.getInlines().add(new TextRun(p, text));
appendHottext(p, correctResponseId, hottext);
hottextInteraction.getBlockStatics().add(p);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
Aggregations