Package org.olat.core.gui.components.tree

Examples of org.olat.core.gui.components.tree.TreeNode


      this.myPortal.setIsEditMode(ureq, Boolean.TRUE);
      welcome.contextPut("portalEditMode", Boolean.TRUE);
    } else if (source == olatMenuTree) {
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
        // process menu commands
        TreeNode selTreeNode = olatMenuTree.getSelectedNode();
        // test for extension commands
        Object uObj = selTreeNode.getUserObject();
        activateContent(ureq, uObj, null);
      } else { // FIXME:fj:b what is this...the action was not allowed anymore
        content.setContent(null); // display an empty field (empty panel)
      }
    } else {
View Full Code Here


 
  protected void adjustState(ControllerState cstate, UserRequest ureq) {
    String cmd = cstate.getSerializedState();
    doActivate(cmd, ureq, null);
    // adjust the menu
    TreeNode tn = TreeHelper.findNodeByUserObject(cmd, olatMenuTree.getTreeModel().getRootNode());
    olatMenuTree.setSelectedNode(tn);
  }
View Full Code Here

      viewIdentifier = viewIdentifier.substring(0,firstDot);
    }
       
    // find the menu node that has the user object that represents the
    // viewIdentifyer
    TreeNode rootNode = this.olatMenuTree.getTreeModel().getRootNode();
    TreeNode activatedNode = TreeHelper.findNodeByUserObject(viewIdentifier, rootNode);
    if (activatedNode != null) {
      this.olatMenuTree.setSelectedNodeId(activatedNode.getIdent());
      activateContent(ureq, activatedNode.getUserObject(), subViewIdentifier);
    } else {
      // not found, activate the root node
      this.olatMenuTree.setSelectedNodeId(rootNode.getIdent());
      activateContent(ureq, rootNode.getUserObject(), subViewIdentifier);
    }
View Full Code Here

    return ((Boolean) accesses.get(capabilityName)).booleanValue();
  }

  public void addNodeEvaluationChild(NodeEvaluation chdNodeEval) {
    addChild(chdNodeEval);
    TreeNode chTn = chdNodeEval.getTreeNode();
    gtn.addChild(chTn);
  }
View Full Code Here

          needsRebuildAfterRunDone = false;
          updateTreeAndContent(ureq, currentCourseNode, null);
        }
      } else if (event instanceof TreeNodeEvent) {
        TreeNodeEvent tne = (TreeNodeEvent) event;
        TreeNode newCpTreeNode = tne.getChosenTreeNode();
        luTree.setSelectedNodeId(newCpTreeNode.getIdent());
      } else if (event == Event.CHANGED_EVENT) {
        updateTreeAndContent(ureq, currentCourseNode, null);
      }

    } else if (source == toolC) {
View Full Code Here

   
    SelectionTreeComponent stc = (SelectionTreeComponent)source;
    Map<String,Component> checkboxes = stc.getSubComponents();
   
    TreeModel tm = stc.getTreeModel();
    TreeNode rootNode = tm.getRootNode();
   
    sb.append("<div class=\"b_selectiontree\">");   
    renderRootNode(rootNode, sb);
    renderChildNodes(rootNode, "", stc.hashCode(), sb, renderer, checkboxes, args);   
    sb.append("</div>");
View Full Code Here

    String newIndent = indent + imgDots;

    // extract directories
    int childcnt = root.getChildCount();
    for (int i = 0; i < childcnt; i++) {
      TreeNode child = (TreeNode) root.getChildAt(i);
      // BEGIN  of choice div
      sb.append("\n<div class=\"b_selectiontree_item\">");
      // render all icons first
      // indent and dots-images
      sb.append(indent);
      if (i < childcnt - 1) {
        sb.append(imgDots_nt);
      } else {
        sb.append(imgDots_nl);
      }
      // custom icon if available
      renderNodeIcon(sb, child);
      sb.append("<div class=\"b_selectiontree_content\">");
     
      // append radio or checkbox if selectable
      if (child.isAccessible()) {
         // render radioboxes
        // StaticTextElement or CheckboxElementComponent
        renderer.render(sb, checkboxes.get(child.getIdent()), args);
      } else {
        // node title (using css if available)
        String cssClass = child.getCssClass();
        if (cssClass != null) sb.append("<span class=\"").append(cssClass).append("\">");
        if (!child.isAccessible()) {
          sb.append("<span class=\"b_disabled\">");
          sb.append(StringEscapeUtils.escapeHtml(child.getTitle()));                     
          sb.append("</span>");
        } else {
          if (child.getAltText() != null) {
//            sb.append("<span ");
//            sb.append(" onmouseover=\"o_showEventDetails(' ', '");
//            sb.append(child.getAltText());
//            sb.append("');\" onmouseout=\"return nd();\" onclick=\"return nd();\">");
            sb.append("<span>");
            sb.append(StringEscapeUtils.escapeHtml(child.getTitle()));           
            sb.append("</span>");
          } else {
            sb.append(StringEscapeUtils.escapeHtml(child.getTitle()));           
          }
        }
        if (cssClass != null) sb.append("</span>");
      }
      // END of choice div
View Full Code Here

    LoggingResourceable nodeInfo = null;
    if (activateFirstPage) {
      // set content to first accessible child or root node if no children
      // available
      TreeNode node = ctm.getRootNode();
      if (node == null) throw new OLATRuntimeException(CPDisplayController.class, "root node of content packaging was null, file:"
          + rootContainer, null);
      while (node != null && !node.isAccessible()) {
        if (node.getChildCount() > 0) {
          node = (TreeNode) node.getChildAt(0);
        } else node = null;
      }
      if (node != null) { // node.isAccessible
        String nodeUri = (String) node.getUserObject();
        if (cpContentCtr != null) cpContentCtr.setCurrentURI(nodeUri);
        if (cpComponent != null) cpComponent.setCurrentURI(nodeUri);
        if (showMenu) cpTree.setSelectedNodeId(node.getIdent());
        // activate the selected node in the menu (skips the root node that is
        // empty anyway and saves one user click)
        selNodeId = node.getIdent();

        nodeInfo = LoggingResourceable.wrapCpNode(nodeUri);
      }
    } else if (initialUri != null) {
      // set page
      if (cpContentCtr != null) cpContentCtr.setCurrentURI(initialUri);
      if (cpComponent != null) cpComponent.setCurrentURI(initialUri);
      // update menu
      TreeNode newNode = ctm.lookupTreeNodeByHref(initialUri);
      if (newNode != null) { // user clicked on a link which is listed in the
                              // toc
        if (cpTree != null) {
          cpTree.setSelectedNodeId(newNode.getIdent());
        } else {
          selNodeId = newNode.getIdent();
        }
      }
      nodeInfo = LoggingResourceable.wrapCpNode(initialUri);
    }
    // Note: the ores has a typename of ICourse - see
View Full Code Here

   * adjust the cp menu tree with the page selected with a link clicked in the content
   * @param ureq
   * @param newUri
   */
  public void selectTreeNode(UserRequest ureq, String newUri) {
    TreeNode newNode = ctm.lookupTreeNodeByHref(newUri);
    if (newNode != null) { // user clicked on a link which is listed in the
      // toc
      if (cpTree != null) {
        cpTree.setSelectedNodeId(newNode.getIdent());
      } else {
        // for the case the tree is outside this controller (e.g. in the
        // course), we fire an event with the chosen node)
        fireEvent(ureq, new TreeNodeEvent(newNode));
      }
View Full Code Here

    // if (!te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) throw
    // new AssertException("error");

    // switch to the new page
    String nodeId = te.getNodeId();
    TreeNode tn = ctm.getNodeById(nodeId);
    String identifierRes = (String) tn.getUserObject();
   
    // security check
    if (identifierRes.indexOf("../") != -1) throw new AssertException("a non-normalized url encountered in a manifest item:"
        + identifierRes);
   
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.tree.TreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.