Search in sources :

Example 41 with GenericTreeModel

use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.

the class GroupInfoMainController method buildTreeModel.

private TreeModel buildTreeModel() {
    // Builds the model for the navigation tree
    GenericTreeModel treeModel = new GenericTreeModel();
    GenericTreeNode rootNode = new GenericTreeNode();
    rootNode.setTitle(translate("main.menu.title"));
    treeModel.setRootNode(rootNode);
    GenericTreeNode childNode = new GenericTreeNode();
    childNode.setTitle(translate("main.menu.title"));
    childNode.setUserObject(COMMAND_MENU_GROUPINFO);
    childNode.setCssClass("o_sel_groupcard_infos");
    childNode.setSelected(true);
    rootNode.addChild(childNode);
    rootNode.setDelegate(childNode);
    if (calendarModule.isEnableGroupCalendar() && isCalendarEnabled()) {
        childNode = new GenericTreeNode();
        childNode.setTitle(translate("main.menu.calendar"));
        childNode.setUserObject(COMMAND_MENU_GROUPCALENDAR);
        childNode.setCssClass("o_sel_groupcard_calendar");
        rootNode.addChild(childNode);
    }
    if (businessGroup.isOwnersVisiblePublic() || businessGroup.isParticipantsVisiblePublic() || businessGroup.isWaitingListVisiblePublic()) {
        childNode = new GenericTreeNode();
        childNode.setTitle(translate("main.menu.members"));
        childNode.setUserObject(COMMAND_MENU_GROUPMEMBERS);
        childNode.setCssClass("o_sel_groupcard_members");
        rootNode.addChild(childNode);
    }
    if (isContactEnabled()) {
        childNode = new GenericTreeNode();
        childNode.setTitle(translate("main.menu.contact"));
        childNode.setUserObject(COMMAND_MENU_GROUPCONTACT);
        childNode.setCssClass("o_sel_groupcard_contact");
        rootNode.addChild(childNode);
    }
    return treeModel;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel)

Example 42 with GenericTreeModel

use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method getSubTreeModel.

/**
 * Return the tree model for a course and a specific test.
 */
@Override
public TreeModel getSubTreeModel() {
    GenericTreeModel subTreeModel = new GenericTreeModel();
    StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
    subTreeModel.setRootNode(rootTreeNode);
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
    buildRecursively(test, rootTreeNode);
    return subTreeModel;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) File(java.io.File)

Example 43 with GenericTreeModel

use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method getTreeModel.

/**
 * Return the tree model for a test learn resource.
 *
 * @return
 */
public TreeModel getTreeModel() {
    GenericTreeModel treeModel = new GenericTreeModel();
    GenericTreeNode rootTreeNode = new GenericTreeNode();
    treeModel.setRootNode(rootTreeNode);
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
    rootTreeNode.setTitle(test.getTitle());
    rootTreeNode.setUserObject(test);
    rootTreeNode.setIconCssClass("o_icon o_icon-lg o_qtiassessment_icon");
    buildRecursively(test, rootTreeNode);
    return treeModel;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) File(java.io.File)

Example 44 with GenericTreeModel

use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.

the class AssessmentHelper method assessmentTreeModel.

/**
 * @param course
 * @return
 */
public static TreeModel assessmentTreeModel(ICourse course) {
    CourseNode rootNode = course.getRunStructure().getRootNode();
    GenericTreeModel gtm = new GenericTreeModel();
    GenericTreeNode node = new GenericTreeNode();
    node.setTitle(rootNode.getShortTitle());
    node.setUserObject(rootNode);
    node.setIconCssClass(CourseNodeFactory.getInstance().getCourseNodeConfiguration(rootNode.getType()).getIconCSSClass());
    gtm.setRootNode(node);
    List<GenericTreeNode> children = addAssessableNodesToList(rootNode);
    children.forEach((child) -> node.addChild(child));
    return gtm;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Example 45 with GenericTreeModel

use of org.olat.core.gui.components.tree.GenericTreeModel in project openolat by klemens.

the class UserInfoMainController method buildTreeModel.

/**
 * Generates the archiver menu
 *
 * @return The generated menu tree model
 * @param firstLastName
 */
private GenericTreeModel buildTreeModel(String name) {
    GenericTreeNode root, gtn;
    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode();
    root.setTitle(name);
    root.setAltText(name);
    root.setAccessible(false);
    gtm.setRootNode(root);
    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.homepage"));
    gtn.setUserObject(CMD_HOMEPAGE);
    gtn.setAltText(translate("menu.homepage.alt"));
    root.addChild(gtn);
    // following user info elements are only shown for undeleted and real
    // users (not invited
    // eportfolio users)
    boolean isInvitee = invitationDao.isInvitee(chosenIdentity);
    boolean isDeleted = chosenIdentity.getStatus().equals(Identity.STATUS_DELETED);
    if (!isDeleted && !isInvitee) {
        if (calendarModule.isEnablePersonalCalendar()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.calendar"));
            gtn.setUserObject(CMD_CALENDAR);
            gtn.setAltText(translate("menu.calendar.alt"));
            gtn.setCssClass("o_visiting_card_calendar");
            root.addChild(gtn);
        }
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.folder"));
        gtn.setUserObject(CMD_FOLDER);
        gtn.setAltText(translate("menu.folder.alt"));
        gtn.setCssClass("o_visiting_card_folder");
        root.addChild(gtn);
    }
    if (!isDeleted) {
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.contact"));
        gtn.setUserObject(CMD_CONTACT);
        gtn.setAltText(translate("menu.contact.alt"));
        gtn.setCssClass("o_visiting_card_contact");
        root.addChild(gtn);
    }
    if (!isDeleted && !isInvitee) {
        PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
        if (portfolioModule.isEnabled()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.portfolio"));
            gtn.setUserObject(CMD_PORTFOLIO);
            gtn.setAltText(translate("menu.portfolio.alt"));
            gtn.setCssClass("o_visiting_card_portfolio");
            root.addChild(gtn);
        }
    }
    return gtm;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) PortfolioModule(org.olat.portfolio.PortfolioModule)

Aggregations

GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)62 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)42 TreeNode (org.olat.core.gui.components.tree.TreeNode)20 CourseNode (org.olat.course.nodes.CourseNode)12 Extension (org.olat.core.extensions.Extension)10 GenericActionExtension (org.olat.core.extensions.action.GenericActionExtension)10 AssertException (org.olat.core.logging.AssertException)10 ArrayList (java.util.ArrayList)8 ActionExtension (org.olat.core.extensions.action.ActionExtension)8 Controller (org.olat.core.gui.control.Controller)8 WindowControl (org.olat.core.gui.control.WindowControl)8 Identity (org.olat.core.id.Identity)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 STCourseNode (org.olat.course.nodes.STCourseNode)8 NodeEvaluation (org.olat.course.run.userview.NodeEvaluation)8 List (java.util.List)6 ExtManager (org.olat.core.extensions.ExtManager)6 TreeModel (org.olat.core.gui.components.tree.TreeModel)6 ControllerEventListener (org.olat.core.gui.control.ControllerEventListener)6 TitledWrapperController (org.olat.core.gui.control.generic.title.TitledWrapperController)6