private void addSuperSections(
      ISIXmlSection currentSection,
      ISIXmlSection rootSection,
      RepeatingView superSectionRepeater,
      SectionIconFactory iconFactory) {
    // We do have supersections
    for (XmlSection ss : rootSection.getChildren()) {
      ISIXmlSection superSection = (ISIXmlSection) ss;
      WebMarkupContainer superSectionContainer =
          new WebMarkupContainer(superSectionRepeater.newChildId());
      superSectionRepeater.add(superSectionContainer);

      superSectionContainer.add(new Label("superSectionTitle", superSection.getTitle()));

      List<XmlSection> sections;
      // Use Supersection children, or supersection itself if there are no children.
      if (!superSection.hasChildren()) {
        sections = new ArrayList<XmlSection>();
        sections.add(superSection);
      } else {
        sections = superSection.getChildren();
      }

      superSectionContainer.add(
          new SectionRepeater("sectionRepeater", sections, currentSection, iconFactory));
    }
  }
  /**
   * Construct nav bar based on a certain page that is currently being displayed.
   *
   * @param id
   * @param mCurrentPage - model of the XmlSection that is the current page.
   * @param teacher if true, a version of the nav bar appropriate for the teacher is produced.
   */
  public DefaultNavBar(String id, IModel<XmlSection> mCurrentPage, boolean teacher) {
    super(id, mCurrentPage);
    setOutputMarkupId(true);
    iconFactory = SectionIconFactory.getIconFactory(teacher);

    if (mCurrentPage == null) {
      setModel(new XmlSectionModel(ISIApplication.get().getPageNum(1)));
    }

    ISIXmlSection rootSection = ISIXmlSection.getRootSection(getCurrentSection());

    // Current Section's Page Repeater with prev/next
    PageNavPanel pageNavPanelTop = new PageNavPanel("pageNavPanelTop", getModel());
    add(pageNavPanelTop);

    /** ******* Other * ******* */
    // Jump to a certain page
    add(new QuickFlipForm("quickFlipForm", true));

    // Chapter Title (xml level 1)
    add(new Label("title", rootSection.getTitle()));
  }