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

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


  @Override
  protected void event(UserRequest ureq, Component source, Event event) {
    if (source == olatMenuTree) {
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
        // process menu commands
        TreeNode selTreeNode = olatMenuTree.getSelectedNode();
        // cleanup old content controller (never null)
        removeAsListenerAndDispose(contentCtr);
       
        // create new content controller
        // Following cases:
        // 1a) Simple Action Extension using only ureq and windowControl -> handled by default implementation of createController
        // 1b) Specialised Action Extension which needs some more internals -> handled by the class extending GenericMainController, by overwriting createController
        // 2)  uobject is something special which needs evaluation by class extending GenericMainController
        Object uobject = selTreeNode.getUserObject();
        contentCtr = getContentCtr(uobject, ureq);
        listenTo(contentCtr);
        Component resComp = contentCtr.getInitialComponent();
        content.setContent(resComp);
      } else { // the action was not allowed anymore
View Full Code Here


   */
  public static TreeNode findNodeByUserObject(Object userObject, TreeNode node) {
    if (node.getUserObject().equals(userObject)) return node;
    int childcnt = node.getChildCount();
    for (int i = 0; i < childcnt; i++) {
      TreeNode child = (TreeNode) node.getChildAt(i);
      TreeNode result = findNodeByUserObject(userObject, child);
      if (result != null) return result;
    }
    return null;
  }
View Full Code Here

  }

  public static TreeNode resolveTreeNode(String treePath, TreeModel treeModel) {
    // even for the root node, our parameter may not be the empty string, therefore the prefix to be chopped here
    treePath =  treePath.substring(1);
    TreeNode cur = treeModel.getRootNode();
    if (!treePath.equals("")) { // if we are not the root node       
      String[] res = treePath.split("_");
      for (int i = res.length -1; i >= 0; i--) {
        String spos = res[i];
        Integer chdPos = Integer.parseInt(spos);
        TreeNode chd = (TreeNode) cur.getChildAt(chdPos);
        if (chd == null) throw new AssertException("cannot find: "+treePath);
        cur = chd;
      }
    }
    return cur;
View Full Code Here

    // if in load performance mode -> generate the treeposition and include it as param,
    // since the nodeid itself is random and thus not replayable
    StringBuilder conPath = new StringBuilder();
    // we need at least one char in the var, even if we click the root node
    conPath.append('_');
    TreeNode cur = node;
    TreeNode par = (TreeNode) cur.getParent();
    while (par != null) {
      int cpos = cur.getPosition();
      conPath.append(cpos).append('_');
      cur = par;
      par = (TreeNode) cur.getParent();
View Full Code Here

    //add node
    outNodeList.add(node);
    int childcnt = node.getChildCount();
    for (int i = 0; i < childcnt; i++) {
      //add all subnodes.
      TreeNode child = (TreeNode) node.getChildAt(i);
      makeTreeFlat(child, outNodeList);
    }
  }
View Full Code Here

    TreeHelper.makeTreeFlat(treemodel.getRootNode(), flatModel);
    keys = new String[flatModel.size()];
    values = new String[keys.length];
    int i = 0;
    for (Iterator iterator = flatModel.iterator(); iterator.hasNext();) {
      TreeNode treeNode = (TreeNode) iterator.next();
      keys[i] = treeNode.getIdent();
      values[i] = treeNode.getTitle();
      i++;
    }
    component = new SelectionTreeComponent(name, getTranslator(), this, treemodel);
  }
View Full Code Here

    }
    // keys,values initialized
    // create and add radio elements
    Map<String, Component> checkboxitems = new HashMap<String, Component>();
    for (int i = 0; i < keys.length; i++) {
      TreeNode tn = treemodel.getNodeById(keys[i]);
      if(selectableFilter.accept(tn)){
        CheckboxElementComponent ssec = new CheckboxElementComponent(getName()+"_"+keys[i], translator, this, i, null);
        checkboxitems.put(keys[i], ssec);
      }else{
        StaticTextElement ste = new StaticTextElementImpl(keys[i], tn.getTitle());
        ste.setRootForm(this.getRootForm());
        checkboxitems.put(keys[i], new StaticTextElementComponent(ste));
      }
    }
    component.setComponents(checkboxitems);
View Full Code Here

      iframectr.getInitialComponent().setVisible(false);
      getWindowControl().setInfo(translate("scorm.course.completed"));
     
    } else {
      scormAdapter.olatLaunchSahs(bootId);
      TreeNode bootnode = treeModel.getNodeByScormItemId(bootId);

      iframectr.setCurrentURI((String) bootnode.getUserObject());
      menuTree.setSelectedNodeId(bootnode.getIdent());
     
      updateNextPreviousButtons(bootId);
    }
   
    myContent.put("contentpackage", iframectr.getInitialComponent());
View Full Code Here

  /**
   * @param itemId
   * @return an uri that points to the ressource identified by a flat id
   */
  public TreeNode getNodeByScormItemId(String itemId) {
    TreeNode node = (TreeNode)scormIdToNode.get(itemId);
    return node;
  }
View Full Code Here

   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == olatMenuTree) {
      // process menu commands
      if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
        TreeNode selTreeNode = olatMenuTree.getSelectedNode();
        String cmd = (String) selTreeNode.getUserObject();
        if (cmd.equals("root") || cmd.equals("guestwelcome")) {
          welcome.setPage(VELOCITY_ROOT + "/guestwelcome.html");
        } else if (cmd.equals("guestinfo")) {
          welcome.setPage(VELOCITY_ROOT + "/guestinfo.html");
        }
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.