use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project openolat by klemens.
the class SimpleChoiceAssessmentItemBuilder method getQuestionBlocks.
/**
* @return A copy of the list of blocks which make the question.
* The list is a copy and modification will not be persisted.
*/
public List<Block> getQuestionBlocks() {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
List<Block> questionBlocks = new ArrayList<>(blocks.size());
for (Block block : blocks) {
if (block instanceof ChoiceInteraction) {
break;
} else if (block != null) {
questionBlocks.add(block);
}
}
return questionBlocks;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project openolat by klemens.
the class SingleChoiceAssessmentItemBuilder method buildItemBody.
@Override
protected void buildItemBody() {
// remove current blocks
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
blocks.clear();
// add question
getHtmlHelper().appendHtml(assessmentItem.getItemBody(), question);
// add interaction
ChoiceInteraction singleChoiceInteraction = AssessmentItemFactory.createSingleChoiceInteraction(assessmentItem, responseIdentifier, orientation, cssClass);
singleChoiceInteraction.setShuffle(isShuffle());
blocks.add(singleChoiceInteraction);
List<SimpleChoice> choiceList = getChoices();
singleChoiceInteraction.getSimpleChoices().addAll(choiceList);
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project openolat by klemens.
the class UploadAssessmentItemBuilder method extractExtendedTextInteraction.
private void extractExtendedTextInteraction() {
try (StringOutput sb = new StringOutput()) {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
for (Block block : blocks) {
if (block instanceof UploadInteraction) {
uploadInteraction = (UploadInteraction) block;
responseIdentifier = uploadInteraction.getResponseIdentifier();
break;
} else {
serializeJqtiObject(block, sb);
}
}
question = sb.toString();
} catch (IOException e) {
log.error("", e);
}
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project openolat by klemens.
the class DrawingAssessmentItemBuilder method getQuestionBlocks.
/**
* @return A copy of the list of blocks which make the question.
* The list is a copy and modification will not be persisted.
*/
public List<Block> getQuestionBlocks() {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
List<Block> questionBlocks = new ArrayList<>(blocks.size());
for (Block block : blocks) {
if (block instanceof DrawingInteraction) {
break;
} else {
questionBlocks.add(block);
}
}
return questionBlocks;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project openolat by klemens.
the class EssayAssessmentItemBuilder method extractExtendedTextInteraction.
private void extractExtendedTextInteraction() {
try (StringOutput sb = new StringOutput()) {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
for (Block block : blocks) {
if (block instanceof ExtendedTextInteraction) {
extendedTextInteraction = (ExtendedTextInteraction) block;
responseIdentifier = extendedTextInteraction.getResponseIdentifier();
break;
} else {
serializeJqtiObject(block, sb);
}
}
question = sb.toString();
} catch (IOException e) {
log.error("", e);
}
}
Aggregations