Search in sources :

Example 6 with PositionComparator

use of org.olat.modules.edubase.model.PositionComparator in project openolat by klemens.

the class EdubaseBookSectionListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("pane.tab.book.section.list");
    setFormContextHelp("KnowledgeTransfer#_edubase");
    String page = velocity_root + "/bookSectionList.html";
    bookSectionsCont = FormLayoutContainer.createCustomFormLayout("bookSections", getTranslator(), page);
    bookSectionsCont.setRootForm(mainForm);
    formLayout.add(bookSectionsCont);
    // BookSections
    List<BookSection> bookSections = new ArrayList<>(config.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSectionImpl.class));
    bookSections.stream().sorted(new PositionComparator()).forEach(this::wrapBookSection);
    ensureBookSectionWrappersHaveAnEntry();
    bookSectionsCont.contextPut("bookSections", bookSectionWrappers);
    recalculateUpDownLinks();
    // Submit Button
    FormLayoutContainer buttonLayout = FormLayoutContainer.createDefaultFormLayout_2_10("buttons", getTranslator());
    buttonLayout.setRootForm(mainForm);
    formLayout.add(buttonLayout);
    uifactory.addFormSubmitButton("save", buttonLayout);
}
Also used : ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) PositionComparator(org.olat.modules.edubase.model.PositionComparator) BookSection(org.olat.modules.edubase.BookSection) BookSectionImpl(org.olat.modules.edubase.model.BookSectionImpl)

Aggregations

BookSection (org.olat.modules.edubase.BookSection)6 PositionComparator (org.olat.modules.edubase.model.PositionComparator)6 Link (org.olat.core.gui.components.link.Link)4 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)4 ArrayList (java.util.ArrayList)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 BookSectionImpl (org.olat.modules.edubase.model.BookSectionImpl)2