Search in sources :

Example 36 with GenericTreeNode

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

the class ScormAPIandDisplayController method switchToPage.

/**
 * @param te is an Event fired by clicking a node in a tree
 */
public void switchToPage(TreeEvent te) {
    // switch to the new page
    String nodeId = te.getNodeId();
    GenericTreeNode tn = (GenericTreeNode) treeModel.getNodeById(nodeId);
    if (te.getCommand().equals(MenuTree.COMMAND_TREENODE_EXPANDED)) {
        iframectr.getInitialComponent().setVisible(false);
        // update the view
        myContent.setDirty(true);
    } else {
        iframectr.getInitialComponent().setVisible(true);
        String scormId = String.valueOf(treeModel.lookupScormNodeId(tn));
        updateNextPreviousButtons(scormId);
        displayMessages(scormId, (String) tn.getUserObject());
    }
    updateMenuTreeIconsAndMessages();
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Example 37 with GenericTreeNode

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

the class ScormCPManifestTreeModel method buildNode.

private GenericTreeNode buildNode(Element item) {
    GenericTreeNode treeNode = new GenericTreeNode();
    // extract title
    String title = item.elementText("title");
    if (title == null)
        title = item.attributeValue("identifier");
    treeNode.setAltText(title);
    treeNode.setTitle(title);
    if (item.getName().equals("organization")) {
        treeNode.setIconCssClass("o_scorm_org");
        treeNode.setAccessible(false);
    } else if (item.getName().equals("item")) {
        scormIdToNode.put(new Integer(nodeId).toString(), treeNode);
        nodeToId.put(treeNode, new Integer(nodeId));
        // set node images according to scorm sco status
        String itemStatusDesc = itemStatus.get(Integer.toString(nodeId));
        treeNode.setIconCssClass("o_scorm_item");
        if (itemStatusDesc != null && !"not_attempted".equals(itemStatusDesc)) {
            // add icon decorator for current status
            String decorator = "o_scorm_" + itemStatusDesc;
            treeNode.setIconDecorator1CssClass(decorator);
        }
        nodeId++;
        // set resolved file path directly
        String identifierref = item.attributeValue("identifierref");
        XPath meta = rootElement.createXPath("//ns:resource[@identifier='" + identifierref + "']");
        meta.setNamespaceURIs(nsuris);
        String href = resources.get(identifierref);
        if (href != null) {
            treeNode.setUserObject(href);
            // allow lookup of a treenode given a href so we can quickly adjust the menu if the user clicks on hyperlinks within the text
            hrefToTreeNode.put(href, treeNode);
        } else
            treeNode.setAccessible(false);
    }
    List<Element> chds = item.elements("item");
    int childcnt = chds.size();
    for (int i = 0; i < childcnt; i++) {
        Element childitem = chds.get(i);
        GenericTreeNode gtnchild = buildNode(childitem);
        treeNode.addChild(gtnchild);
    }
    return treeNode;
}
Also used : XPath(org.dom4j.XPath) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) Element(org.dom4j.Element)

Example 38 with GenericTreeNode

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

the class ScormCPManifestTreeModel method buildTreeNodes.

private GenericTreeNode buildTreeNodes(List<Element> organizations) {
    GenericTreeNode gtn = new GenericTreeNode();
    // 0 is a valid index since List is testet be be not empty above
    String rootNode = organizations.get(0).getParent().elementText("default");
    // if only one organization avoid too much hierarchy levels...
    if (organizations.size() == 1) {
        return buildNode(organizations.get(0));
    }
    // FIXME: localize "Content:"
    gtn.setTitle((rootNode == null) ? "Content:" : rootNode);
    gtn.setIconCssClass("o_scorm_org");
    gtn.setAccessible(false);
    for (int i = 0; i < organizations.size(); ++i) {
        GenericTreeNode gtnchild = buildNode(organizations.get(i));
        gtn.addChild(gtnchild);
    }
    return gtn;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Example 39 with GenericTreeNode

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

the class WikiMainController method getAndUseExternalTree.

public GenericTreeModel getAndUseExternalTree() {
    final String resId = ores.getResourceableId().toString();
    Wiki wiki = getWiki();
    wikiMenuModel = new GenericTreeModel();
    String root = "wiki-" + resId;
    GenericTreeNode rootNode = new GenericTreeNode(root);
    wikiMenuModel.setRootNode(rootNode);
    // Index
    String navMainItem = "nav-main-item-" + resId;
    navMainPageNode = new GenericTreeNode(navMainItem, translate("navigation.mainpage"), navMainItem);
    rootNode.addChild(navMainPageNode);
    // Wiki-Menu
    String wikiMenuTitle = translate("navigation.menu");
    String wikiMenuItem = "menu-item-" + resId;
    wikiMenuNode = new GenericTreeNode(wikiMenuItem, wikiMenuTitle, wikiMenuItem);
    rootNode.addChild(wikiMenuNode);
    String navAZItem = "nav-az-item-" + resId;
    navAZNode = new GenericTreeNode(navAZItem, translate("navigation.a-z"), navAZItem);
    rootNode.addChild(navAZNode);
    String navChangesItem = "nav-changes-item-" + resId;
    navChangesNode = new GenericTreeNode(navChangesItem, translate("navigation.changes"), navChangesItem);
    rootNode.addChild(navChangesNode);
    updateWikiMenu(wiki);
    navigationDropdown.setVisible(false);
    wikiMenuDropdown.setVisible(false);
    navigationContent.contextPut("navigationEnabled", Boolean.FALSE);
    return wikiMenuModel;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel)

Example 40 with GenericTreeNode

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

the class EPTOCController method reloadTreeModel.

private void reloadTreeModel(PortfolioStructure struct) {
    EPTOCTreeModel model = (EPTOCTreeModel) treeCtr.getTreeModel();
    if (struct != null) {
        GenericTreeNode node = (GenericTreeNode) TreeHelper.findNodeByUserObject(struct, model.getRootNode());
        if (node != null) {
            node.setTitle(struct.getTitle());
            node.setUserObject(struct);
            model.loadChildNode(struct, node);
        }
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Aggregations

GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)124 TreeNode (org.olat.core.gui.components.tree.TreeNode)30 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)24 CourseNode (org.olat.course.nodes.CourseNode)10 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)10 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)10 HashMap (java.util.HashMap)8 INode (org.olat.core.util.nodes.INode)8 ArrayList (java.util.ArrayList)6 Element (org.dom4j.Element)6 XPath (org.dom4j.XPath)6 ExtManager (org.olat.core.extensions.ExtManager)6 Extension (org.olat.core.extensions.Extension)6 CatalogEntry (org.olat.repository.CatalogEntry)6 ActionExtension (org.olat.core.extensions.action.ActionExtension)4 GenericActionExtension (org.olat.core.extensions.action.GenericActionExtension)4 CourseNodeConfiguration (org.olat.course.nodes.CourseNodeConfiguration)4 QTI21QuestionType (org.olat.ims.qti21.model.QTI21QuestionType)4 Taxonomy (org.olat.modules.taxonomy.Taxonomy)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)4