Search in sources :

Example 1 with PromptGroup

use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method appendHottextInteraction.

public static HottextInteraction appendHottextInteraction(ItemBody itemBody, Identifier responseDeclarationId, int maxChoices) {
    HottextInteraction hottextInteraction = new HottextInteraction(itemBody);
    hottextInteraction.setMaxChoices(maxChoices);
    hottextInteraction.setResponseIdentifier(responseDeclarationId);
    itemBody.getBlocks().add(hottextInteraction);
    PromptGroup prompts = new PromptGroup(hottextInteraction);
    hottextInteraction.getNodeGroups().add(prompts);
    return hottextInteraction;
}
Also used : PromptGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup) HottextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction)

Example 2 with PromptGroup

use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method appendMatchInteraction.

public static MatchInteraction appendMatchInteraction(ItemBody itemBody, Identifier responseDeclarationId) {
    MatchInteraction matchInteraction = new MatchInteraction(itemBody);
    matchInteraction.setResponseIdentifier(responseDeclarationId);
    matchInteraction.setMaxAssociations(0);
    matchInteraction.setShuffle(false);
    itemBody.getBlocks().add(matchInteraction);
    PromptGroup prompts = new PromptGroup(matchInteraction);
    matchInteraction.getNodeGroups().add(prompts);
    SimpleMatchSet sourceMatchSet = new SimpleMatchSet(matchInteraction);
    matchInteraction.getSimpleMatchSets().add(sourceMatchSet);
    String[] sources = new String[] { "A", "B" };
    for (int i = 0; i < sources.length; i++) {
        SimpleAssociableChoice sourceChoice = new SimpleAssociableChoice(sourceMatchSet);
        sourceChoice.setMatchMax(0);
        sourceChoice.setMatchMin(0);
        sourceChoice.setIdentifier(IdentifierGenerator.newNumberAsIdentifier(sources[i]));
        P question = getParagraph(sourceChoice, sources[i]);
        sourceChoice.getFlowStatics().add(question);
        sourceMatchSet.getSimpleAssociableChoices().add(sourceChoice);
    }
    SimpleMatchSet targetMatchSet = new SimpleMatchSet(matchInteraction);
    matchInteraction.getSimpleMatchSets().add(targetMatchSet);
    String[] targets = new String[] { "M", "N" };
    for (int i = 0; i < targets.length; i++) {
        SimpleAssociableChoice targetChoice = new SimpleAssociableChoice(sourceMatchSet);
        targetChoice.setMatchMax(0);
        targetChoice.setMatchMin(0);
        targetChoice.setIdentifier(IdentifierGenerator.newNumberAsIdentifier(targets[i]));
        P question = getParagraph(targetChoice, targets[i]);
        targetChoice.getFlowStatics().add(question);
        targetMatchSet.getSimpleAssociableChoices().add(targetChoice);
    }
    return matchInteraction;
}
Also used : MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) SimpleMatchSet(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet) P(uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P) SimpleAssociableChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice) PromptGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup)

Example 3 with PromptGroup

use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method createSingleChoiceInteraction.

public static ChoiceInteraction createSingleChoiceInteraction(AssessmentItem assessmentItem, Identifier responseDeclarationId, Orientation orientation, List<String> classAtrr) {
    ChoiceInteraction choiceInteraction = new ChoiceInteraction(assessmentItem.getItemBody());
    choiceInteraction.setMaxChoices(1);
    choiceInteraction.setShuffle(true);
    if (orientation != null) {
        choiceInteraction.setOrientation(orientation);
    }
    choiceInteraction.setResponseIdentifier(responseDeclarationId);
    if (classAtrr != null && classAtrr.size() > 0) {
        choiceInteraction.setClassAttr(classAtrr);
    }
    PromptGroup prompts = new PromptGroup(choiceInteraction);
    choiceInteraction.getNodeGroups().add(prompts);
    SimpleChoiceGroup singleChoices = new SimpleChoiceGroup(choiceInteraction);
    choiceInteraction.getNodeGroups().add(singleChoices);
    return choiceInteraction;
}
Also used : ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) PromptGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup) SimpleChoiceGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.choice.SimpleChoiceGroup)

Example 4 with PromptGroup

use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method appendChoiceInteraction.

public static ChoiceInteraction appendChoiceInteraction(ItemBody itemBody, Identifier responseDeclarationId, int maxChoices, boolean shuffle) {
    ChoiceInteraction choiceInteraction = new ChoiceInteraction(itemBody);
    choiceInteraction.setMaxChoices(maxChoices);
    choiceInteraction.setShuffle(shuffle);
    choiceInteraction.setResponseIdentifier(responseDeclarationId);
    itemBody.getBlocks().add(choiceInteraction);
    PromptGroup prompts = new PromptGroup(choiceInteraction);
    choiceInteraction.getNodeGroups().add(prompts);
    SimpleChoiceGroup singleChoices = new SimpleChoiceGroup(choiceInteraction);
    choiceInteraction.getNodeGroups().add(singleChoices);
    return choiceInteraction;
}
Also used : ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) PromptGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup) SimpleChoiceGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.choice.SimpleChoiceGroup)

Example 5 with PromptGroup

use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project openolat by klemens.

the class AssessmentItemFactory method appendHottextInteraction.

public static HottextInteraction appendHottextInteraction(ItemBody itemBody, Identifier responseDeclarationId, int maxChoices) {
    HottextInteraction hottextInteraction = new HottextInteraction(itemBody);
    hottextInteraction.setMaxChoices(maxChoices);
    hottextInteraction.setResponseIdentifier(responseDeclarationId);
    itemBody.getBlocks().add(hottextInteraction);
    PromptGroup prompts = new PromptGroup(hottextInteraction);
    hottextInteraction.getNodeGroups().add(prompts);
    return hottextInteraction;
}
Also used : PromptGroup(uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup) HottextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction)

Aggregations

PromptGroup (uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup)14 SimpleChoiceGroup (uk.ac.ed.ph.jqtiplus.group.item.interaction.choice.SimpleChoiceGroup)6 ChoiceInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction)6 MatchInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction)6 SimpleMatchSet (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet)6 P (uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P)4 SimpleAssociableChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)4 TextRun (uk.ac.ed.ph.jqtiplus.node.content.basic.TextRun)2 HottextInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction)2