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

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


   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == menuTree) {
      disposeChildControllerAndReleaseLocks(); // first cleanup old locks
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
        TreeNode selTreeNode = menuTree.getSelectedNode();
        String cmd = (String) selTreeNode.getUserObject();
        // reset helper variables
        this.currentCourseNode = null;
        this.currentGroup = null;
        this.isFiltering = true;
        if (cmd.equals(CMD_INDEX)) {
View Full Code Here


    }

  }

  private void handleMenuCommands(UserRequest ureq) {
    TreeNode selTreeNode = olatMenuTree.getSelectedNode();
    String cmd = (String) selTreeNode.getUserObject();

    releaseAdminLockAndGroupMUE();
    if (cmd.equals(CMD_OVERVIEW)) {
      doOverview(ureq);
    } else if (cmd.equals(CMD_EDITCONTEXT)) {
View Full Code Here

   * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == olatMenuTree) {
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
        TreeNode selTreeNode = olatMenuTree.getSelectedNode();
        Object userObject = selTreeNode.getUserObject();
        Component resComp = initComponentFromMenuCommand(userObject, ureq);
        content.setContent(resComp);
      } else { // the action was not allowed anymore
        content.setContent(null); // display an empty field (empty panel)
      }
View Full Code Here

  }
 
  public void activate(UserRequest ureq, String viewIdentifier) {
    if(viewIdentifier.startsWith("notifications")) {
      GenericTreeModel tm = (GenericTreeModel)olatMenuTree.getTreeModel();
      TreeNode node = tm.findNodeByUserObject("created.newUsersNotification");
      olatMenuTree.setSelectedNode(node);
      Component resComp = initComponentFromMenuCommand("created.newUsersNotification", ureq);
      content.setContent(resComp);
    }
  }
View Full Code Here

   *      org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == menuTree) {
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) { // goto
        TreeNode selTreeNode = menuTree.getSelectedNode();
        String cmd = (String) selTreeNode.getUserObject();
        main.setContent(createComponent(ureq, cmd, chosenIdentity));
      }
    }
    // no events from main
    // no events from intro
View Full Code Here

   */
  public NodeClickedRef evaluateJumpToTreeNode(UserRequest ureq, WindowControl wControl, TreeModel treeModel, TreeEvent treeEvent,
      ControllerEventListener listeningController, String nodecmd) {
    NodeClickedRef ncr;
    String treeNodeId = treeEvent.getNodeId();
    TreeNode selTN = treeModel.getNodeById(treeNodeId);
    if (selTN == null) throw new AssertException("no treenode found:" + treeNodeId);

    // check if appropriate for subtreemodelhandler
    Object userObject = selTN.getUserObject();
    if (!(userObject instanceof NodeEvaluation)) {
      // yes, appropriate
      if (subtreemodelListener == null) throw new AssertException("no handler for subtreemodelcall!");
      if (log.isDebug()){
        log.debug("delegating to handler: treeNodeId = " + treeNodeId);
      }
      // null as controller source since we are not a controller
      subtreemodelListener.dispatchEvent(ureq, null, treeEvent);
      // no node construction result indicates handled
      ncr = new NodeClickedRef(null, true, null, null, null);
    } else {
      // normal dispatching to a coursenode.
      // get the courseNode that was called
      NodeEvaluation prevEval = (NodeEvaluation) selTN.getUserObject();
      if (!prevEval.isVisible()) throw new AssertException("clicked on a node which is not visible: treenode=" + selTN.getIdent() + ", "
          + selTN.getTitle());
      CourseNode calledCourseNode = prevEval.getCourseNode();
      ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(calledCourseNode));
      ncr = doEvaluateJumpTo(ureq, wControl, calledCourseNode, listeningController, nodecmd);
    }
    return ncr;
View Full Code Here

    // build the new treemodel by evaluating the preconditions
    TreeEvaluation treeEval = new TreeEvaluation();
    GenericTreeModel treeModel = new GenericTreeModel();
    CourseNode rootCn = userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();
    NodeEvaluation rootNodeEval = rootCn.eval(userCourseEnv.getConditionInterpreter(), treeEval);
    TreeNode treeRoot = rootNodeEval.getTreeNode();
    treeModel.setRootNode(treeRoot);

    // find the treenode that corresponds to the node (!= selectedTreeNode since
    // we built the TreeModel anew in the meantime
    TreeNode newCalledTreeNode = treeEval.getCorrespondingTreeNode(courseNode);
    if (newCalledTreeNode == null) {
      // the clicked node is not visible anymore!
      // if the new calculated model does not contain the selected node anymore
      // (because of visibility changes of at least one of the ancestors
      // -> issue an user infomative msg
      // nclr: the new treemodel, not visible, no selected nodeid, no
      // calledcoursenode, no nodeconstructionresult
      nclr = new NodeClickedRef(treeModel, false, null, null, null);
    } else {
      // calculate the NodeClickedRef
      // 1. get the correct (new) nodeevaluation
      NodeEvaluation nodeEval = (NodeEvaluation) newCalledTreeNode.getUserObject();
      if (nodeEval.getCourseNode() != courseNode) throw new AssertException("error in structure");
      if (!nodeEval.isVisible()) throw new AssertException("node eval not visible!!");
      // 2. start with the current NodeEvaluation, evaluate overall accessiblity
      // per node bottom-up to see if all ancestors still grant access to the
      // desired node
      boolean mayAccessWholeTreeUp = mayAccessWholeTreeUp(nodeEval);
      String newSelectedNodeId = newCalledTreeNode.getIdent();
      if (!mayAccessWholeTreeUp) {
        // we cannot access the node anymore (since e.g. a time constraint
        // changed), so give a (per-node-configured) explanation why and what
        // the access conditions would be (a free form text, should be
        // nontechnical).
View Full Code Here

  private void addSubTreeModel(TreeNode parent, TreeModel modelToAppend) {
    // ignore root and directly add children.
    // need to clone children so that are not detached from their original
    // parent (which is the cp treemodel)
    // parent.addChild(modelToAppend.getRootNode());
    TreeNode root = modelToAppend.getRootNode();
    int chdCnt = root.getChildCount();
   
    // full cloning of ETH webclass energie takes about 4/100 of a second
    for (int i = chdCnt; i > 0; i--) {
      TreeNode chd = (TreeNode) root.getChildAt(i-1);
      TreeNode chdc = (TreeNode) XStreamHelper.xstreamClone(chd);
      // always insert before already existing course building block children
      parent.insert(chdc, 0);
    }
  }
View Full Code Here

  public InsertTreeModel(CourseEditorTreeModel cetm) {
    // build InsertModel (copy of this Structure with all possible
    // insert-positions)
    CourseEditorTreeNode cnRoot = (CourseEditorTreeNode) cetm.getRootNode();
    nodeCnt = 1;//one rootnode at least
    TreeNode ctn = buildNode(cnRoot);
    setRootNode(ctn);
  }
View Full Code Here

          gtn.setAccessible(true);
          gtn.setTitle("");
          gtn.setAltText("");
          gtn.setUserObject(new TreePosition(ctn, i));
          ctn.addChild(gtn);
          TreeNode ctchild = buildNode(cchild);
          ctn.addChild(ctchild);
        }
      }
      // last insert position
      GenericTreeNode gtn = new GenericTreeNode();
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.