use of uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction in project openolat by klemens.
the class AssessmentObjectVelocityRenderDecorator method isSingleChoice.
/**
* Check the maxChoices and the cardinality
* @param interaction
* @return
*/
public boolean isSingleChoice(Interaction interaction) {
if (interaction instanceof ChoiceInteraction) {
ChoiceInteraction choiceInteraction = (ChoiceInteraction) interaction;
boolean sc = choiceInteraction.getMaxChoices() == 1;
ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(choiceInteraction.getResponseIdentifier());
if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
return false;
}
return sc;
} else if (interaction instanceof HottextInteraction) {
HottextInteraction hottextInteraction = (HottextInteraction) interaction;
boolean sc = hottextInteraction.getMaxChoices() == 1;
ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(hottextInteraction.getResponseIdentifier());
if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
return false;
}
return sc;
} else if (interaction instanceof HotspotInteraction) {
HotspotInteraction hotspotInteraction = (HotspotInteraction) interaction;
ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(hotspotInteraction.getResponseIdentifier());
if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
return true;
}
return false;
}
return false;
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction in project openolat by klemens.
the class QTI21AssessmentItemStatisticsController method interactionControllerFactory.
private Component interactionControllerFactory(UserRequest ureq, Interaction interaction, StatisticsItem itemStats) {
Controller interactionCtrl = null;
if (interaction instanceof ChoiceInteraction) {
interactionCtrl = new SimpleChoiceInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (ChoiceInteraction) interaction, itemStats, resourceResult);
} else if (interaction instanceof MatchInteraction) {
String responseIdentifier = interaction.getResponseIdentifier().toString();
if (responseIdentifier.startsWith("KPRIM_") || QTI21QuestionType.hasClass(interaction, QTI21Constants.CSS_MATCH_KPRIM)) {
interactionCtrl = new KPrimStatisticsController(ureq, getWindowControl(), itemRef, item, (MatchInteraction) interaction, resourceResult);
} else {
interactionCtrl = new MatchStatisticsController(ureq, getWindowControl(), itemRef, item, (MatchInteraction) interaction, resourceResult);
}
} else if (interaction instanceof HotspotInteraction) {
interactionCtrl = new HotspotInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (HotspotInteraction) interaction, itemStats, resourceResult);
} else if (interaction instanceof HottextInteraction) {
interactionCtrl = new HottextInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (HottextInteraction) interaction, itemStats, resourceResult);
}
if (interactionCtrl == null) {
interactionCtrl = new UnsupportedInteractionController(ureq, getWindowControl(), interaction);
}
listenTo(interactionCtrl);
return interactionCtrl.getInitialComponent();
}
Aggregations