Package org.olat.ims.qti.editor.beecom.objects

Examples of org.olat.ims.qti.editor.beecom.objects.Section


   * Creates an empty section
   * @param trans
   * @return Section
   */
  public static Section createSection(Translator trans) {
    Section section = new Section();
    section.setIdent(CodeHelper.getGlobalForeverUniqueID());
    section.setTitle(trans.translate("editor.newsection"));
    return section;
  }
View Full Code Here


    List controls = null;
    if (Item.class.isAssignableFrom(object.getClass())) {
      Item item = (Item) object;
      controls = item.getItemcontrols();
    } else if (Section.class.isAssignableFrom(object.getClass())) {
      Section section = (Section) object;
      controls = section.getSectioncontrols();
    } else if (Assessment.class.isAssignableFrom(object.getClass())) {
      Assessment assessment = (Assessment) object;
      controls = assessment.getAssessmentcontrols();
    }
    for (Iterator i = controls.iterator(); i.hasNext();) {
View Full Code Here

    List<Feedback> feedbacks = null;
    if (Item.class.isAssignableFrom(object.getClass())) {
      Item item = (Item) object;
      feedbacks = item.getItemfeedbacks();
    } else if (Section.class.isAssignableFrom(object.getClass())) {
      Section section = (Section) object;
      feedbacks = section.getSectionfeedbacks();
    } else if (Assessment.class.isAssignableFrom(object.getClass())) {
      Assessment assessment = (Assessment) object;
      feedbacks = assessment.getAssessfeedbacks();
    }
    return feedbacks;
View Full Code Here

    //sections
    List sectionList = qtiDocument.getAssessment().getSections();
    Iterator sectionIterator = sectionList.iterator();
    while(sectionIterator.hasNext()) {
      //section
      Section section = (Section)sectionIterator.next();
      List itemList = section.getItems();
      Iterator listIterator = itemList.iterator();
      while(listIterator.hasNext()) {
        //item
        Item item = (Item)listIterator.next();       
        if((filterOut && thisItem.getIdent().equals(item.getIdent())) || (!filterOut && !thisItem.getIdent().equals(item.getIdent()))) {
View Full Code Here

public class SectionParser implements IParser {
    private ParserManager parserManager = new ParserManager();
   
    public Object parse(Element element) {
      //assert element.getName().equalsIgnoreCase("questestinterop");
      Section section = new Section();
    
      // attributes
      section.setIdent(element.attribute("ident").getValue());
      section.setTitle(element.attribute("title").getValue());
   
      // elements

      // DURATION
      QTIObject duration =
      (QTIObject) parserManager.parse(element.element("duration"));
      section.setDuration(duration);
     
      List sectioncontrolsXML = element.elements("sectioncontrol");
      List sectioncontrols = new ArrayList();
      for(Iterator i= sectioncontrolsXML.iterator();i.hasNext();) {
        sectioncontrols.add(parserManager.parse((Element)i.next()));
      }
      if (sectioncontrols.size() == 0) {
        sectioncontrols.add(new Control());
      }
      section.setSectioncontrols(sectioncontrols);
   
      // SELECTION ORDERING
      SelectionOrdering selectionOrdering = (SelectionOrdering)parserManager.parse(element.element("selection_ordering"));
      if (selectionOrdering != null){
        section.setSelection_ordering(selectionOrdering);
      } else {
        section.setSelection_ordering(new SelectionOrdering());
      }

      //SECTIONS
      List sectionsXML = element.elements("section");
      List sections = new ArrayList();
      for(Iterator i = sectionsXML.iterator();i.hasNext();) {
        sections.add(parserManager.parse((Element)i.next()))
      }
      section.setSections(sections);

   
      //ITEMS
      List itemsXML = element.elements("item");
      List items = new ArrayList();
      for(Iterator i = itemsXML.iterator();i.hasNext();) {
        items.add(parserManager.parse((Element)i.next()))
      }
      section.setItems(items);
     
      //OBJECTIVES
      Element mattext = (Element)element.selectSingleNode("./objectives/material/mattext");
      if (mattext != null)
        section.setObjectives(mattext.getTextTrim());
     
      //FEEDBACKS
      List feedbacksXML = element.elements("sectionfeedback");
      List feedbacks = new ArrayList();
      for(Iterator i = feedbacksXML.iterator();i.hasNext();) {
        QTIObject tmp = (QTIObject)parserManager.parse((Element)i.next());
        feedbacks.add(tmp);
      }
      section.setSectionfeedbacks(feedbacks);
      
      // OUTCOMES_PROCESSING
      // TODO: maybe we should use the OutcomesProcessing object and parser here? Same as on
      // assessment level?
      QTIObject outcomes_processing = (QTIObject)parserManager.parse(element.element("outcomes_processing"));
      section.setOutcomes_processing(outcomes_processing);
     
    return section;
  }
View Full Code Here

    // create new qti document
    translator = new PackageTranslator("org.olat.ims.qti", locale);
    qtiDocument = new QTIDocument();
    Assessment assessment = QTIEditHelper.createAssessment(title, type);
    qtiDocument.setAssessment(assessment);
    Section section = QTIEditHelper.createSection(translator);
    List sectionList = new ArrayList();
    sectionList.add(section);
    assessment.setSections(sectionList);
    List itemList = new ArrayList();
    itemList.add(QTIEditHelper.createSCItem(translator));
    section.setItems(itemList);
    // initialize package
    packageSubDir = CodeHelper.getGlobalForeverUniqueID();
    packageDir = new File(getTmpBaseDir(), packageSubDir);
    packageDir.mkdirs();
    getMediaBaseDir().mkdirs();
View Full Code Here

    this.setRootNode(rootNode);
    //Sections with their Items
    List sections = ass.getSections();
    for (int i=0; i < sections.size(); i++) {
      //get section data
      Section elem = (Section)sections.get(i);
      GenericQtiNode sectionNode = new SectionNode(elem, qtiPackage);
      List items = elem.getItems();
      for (int j=0; j < items.size(); j++) {
        //get item data
        Item elem2 = (Item)items.get(j);
        GenericQtiNode itemNode = new ItemNode(elem2, qtiPackage);
        //add item to its parent section
View Full Code Here

        listenTo(cmc);
       
      } else if (cmd.startsWith(CMD_TOOLS_ADD_PREFIX)) { // add new object
        // fetch new object
        if (cmd.equals(CMD_TOOLS_ADD_SECTION)) {
          Section newSection = QTIEditHelper.createSection(getTranslator());
          Item newItem = QTIEditHelper.createSCItem(getTranslator());
          newSection.getItems().add(newItem);
          SectionNode scNode = new SectionNode(newSection, qtiPackage);
          ItemNode itemNode = new ItemNode(newItem, qtiPackage);
          scNode.addChild(itemNode);
          insertObject = scNode;
        } else if (cmd.equals(CMD_TOOLS_ADD_SINGLECHOICE)) insertObject = new ItemNode(QTIEditHelper.createSCItem(getTranslator()), qtiPackage);
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.editor.beecom.objects.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.