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

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


        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();
View Full Code Here


   * @see org.olat.ims.qti.editor.beecom.IParser#parse(org.dom4j.Element)
   */
  public Object parse(Element element) {
    //assert element.getName().equalsIgnoreCase("selection_ordering");
         
    SelectionOrdering selectionOrdering = new SelectionOrdering();

    // Set correct selection of items. To select all is the default value (represented
    // by a non existing 'selection_number' element. Otherwhise the exact number given
    // in the 'selection_number' element is taken')
    List el_selections = element.selectNodes("selection");
    if(el_selections.size()>1){
      //error
      throw new OLATRuntimeException(SelectionOrderingParser.class, "more then one selection element", new IllegalStateException());
    }
    if (el_selections.size() != 0){
      Element el_selection = ((Element)el_selections.get(0));
      Element selection_number = (Element)el_selection.selectSingleNode("selection_number");
     
      if (selection_number != null) selectionOrdering.setSelectionNumber(Integer.parseInt(selection_number.getText()));
    }
    // else use default value
   
    // Set correct order type. Use sequential ordering als default if none defined
    Element order = (Element)element.selectSingleNode("//order");
    if (order != null) {
      String order_type = order.attributeValue(SelectionOrdering.ORDER_TYPE);
      if (order_type != null && order_type.equals(SelectionOrdering.RANDOM)) selectionOrdering.setOrderType(SelectionOrdering.RANDOM);
      // else use default value
    }

    return selectionOrdering;
  }
View Full Code Here

TOP

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

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.