Search in sources :

Example 96 with TreeNode

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

the class AssessmentCourseTreeController method switchToUsersView.

/**
 * Switch to the user list
 *
 * @param ureq
 * @param stateOfUserList Optional
 */
protected void switchToUsersView(UserRequest ureq, StateEntry stateOfUserList) {
    view = View.users;
    TreeNode treeNode = menuTree.getSelectedNode();
    CourseNode courseNode = (CourseNode) treeNode.getUserObject();
    Controller ctrl = doSelectCourseNode(ureq, treeNode, courseNode);
    if (ctrl instanceof Activateable2) {
        ((Activateable2) ctrl).activate(ureq, null, stateOfUserList);
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) TreeNode(org.olat.core.gui.components.tree.TreeNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController)

Example 97 with TreeNode

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

the class CourseInternalLinkTreeModel method findNode.

/**
 * Depth-first traversal.
 *
 * @param nodeId
 * @param node
 * @return the treenode with the node id or null if not found
 */
private TreeNode findNode(String nodeId, TreeNode node) {
    if (node.getIdent().equals(nodeId))
        return node;
    int childcnt = node.getChildCount();
    for (int i = 0; i < childcnt; i++) {
        TreeNode child = (TreeNode) node.getChildAt(i);
        TreeNode result = findNode(nodeId, child);
        if (result != null)
            return result;
    }
    return null;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 98 with TreeNode

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

the class QTI12PrintController method initView.

private void initView(UserRequest ureq, QTIStatisticResourceResult resourceResult) {
    StatisticResourceNode rootNode = (StatisticResourceNode) resourceResult.getSubTreeModel().getRootNode();
    ICourse course = CourseFactory.loadCourse(resourceResult.getCourseOres());
    mainVC.contextPut("courseTitle", course.getCourseTitle());
    String testTitle = resourceResult.getQTIRepositoryEntry().getDisplayname();
    mainVC.contextPut("testTitle", testTitle);
    int count = 0;
    List<String> pageNames = new ArrayList<>();
    Controller assessmentCtrl = resourceResult.getController(ureq, getWindowControl(), null, rootNode, true);
    String pageName = "page" + count++;
    mainVC.put(pageName, assessmentCtrl.getInitialComponent());
    pageNames.add(pageName);
    for (int i = 0; i < rootNode.getChildCount(); i++) {
        INode sectionNode = rootNode.getChildAt(i);
        for (int j = 0; j < sectionNode.getChildCount(); j++) {
            TreeNode itemNode = (TreeNode) sectionNode.getChildAt(j);
            Controller itemCtrl = resourceResult.getController(ureq, getWindowControl(), null, itemNode, true);
            String itemPageName = "page" + count++;
            mainVC.put(itemPageName, itemCtrl.getInitialComponent());
            pageNames.add(itemPageName);
        }
    }
    mainVC.contextPut("pageNames", pageNames);
}
Also used : INode(org.olat.core.util.nodes.INode) TreeNode(org.olat.core.gui.components.tree.TreeNode) StatisticResourceNode(org.olat.course.statistic.StatisticResourceNode) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController)

Example 99 with TreeNode

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

the class QTI12StatisticsToolController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry entry = entries.get(0);
    if (entry.getOLATResourceable() != null && entry.getOLATResourceable().getResourceableTypeName() != null) {
        String nodeId = entry.getOLATResourceable().getResourceableTypeName();
        TreeNode nclr = courseTree.getTreeModel().getNodeById(nodeId);
        if (nclr != null) {
            String selNodeId = nclr.getIdent();
            courseTree.setSelectedNodeId(selNodeId);
            doSelectNode(ureq, nclr);
        }
    }
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 100 with TreeNode

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

the class QTI12StatisticsToolController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (courseTree == source) {
        if (event instanceof TreeEvent) {
            TreeEvent te = (TreeEvent) event;
            if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
                String ident = te.getNodeId();
                TreeNode selectedNode = courseTree.getTreeModel().getNodeById(ident);
                doSelectNode(ureq, selectedNode);
            }
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Aggregations

TreeNode (org.olat.core.gui.components.tree.TreeNode)296 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)146 ArrayList (java.util.ArrayList)44 CourseNode (org.olat.course.nodes.CourseNode)38 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)32 ContextEntry (org.olat.core.id.context.ContextEntry)30 Controller (org.olat.core.gui.control.Controller)28 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)24 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 INode (org.olat.core.util.nodes.INode)20 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)20 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)20 ICourse (org.olat.course.ICourse)18 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)16 OLATResourceable (org.olat.core.id.OLATResourceable)16 List (java.util.List)14 TreeModel (org.olat.core.gui.components.tree.TreeModel)14 WindowControl (org.olat.core.gui.control.WindowControl)14 AssertException (org.olat.core.logging.AssertException)14