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

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


    }
    return gtn;
  }

  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 = (String)itemStatus.get(Integer.toString(nodeId));
      treeNode.setIconCssClass("o_scorm_item");
      if(itemStatusDesc != null){
        // add icon decorator for current status
        treeNode.setIconDecorator1CssClass("o_scorm_"+itemStatusDesc);
      }
     
      nodeId++;
      //set resolved file path directly
      String identifierref = item.attributeValue("identifierref");
      XPath meta = rootElement.createXPath("//ns:resource[@identifier='" + identifierref + "']");
      meta.setNamespaceURIs(nsuris);
      String href = (String) 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 chds = item.elements("item");
    int childcnt = chds.size();
    for (int i = 0; i < childcnt; i++) {
      Element childitem = (Element) chds.get(i);
      GenericTreeNode gtnchild = buildNode(childitem);
      treeNode.addChild(gtnchild);
    }
    return treeNode;
  }
View Full Code Here


      Tracing.logWarn("Unhandled olatMenuTree event: " + event.getCommand(), GuestHomeMainController.class);
    }
  }

  private TreeModel buildTreeModel() {
    GenericTreeNode root, gtn;

    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode();
    root.setTitle(translate("menu.guest"));
    root.setUserObject("guest");
    root.setAltText(translate("menu.guest.alt"));
    gtm.setRootNode(root);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.guestwelcome"));
    gtn.setUserObject("guestwelcome");
    gtn.setAltText(translate("menu.guestwelcome.alt"));
    root.addChild(gtn);
    root.setDelegate(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.guestinfo"));
    gtn.setUserObject("guestinfo");
    gtn.setAltText(translate("menu.guestinfo.alt"));
    root.addChild(gtn);

    return gtm;
  }
View Full Code Here

     
    return null;
  }

  private TreeModel buildTreeModel() {
    GenericTreeNode root, gtn;

    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode();
    root.setTitle(translate("menu.root"));
    root.setUserObject(MENU_ROOT);
    root.setAltText(translate("menu.root.alt"));
    gtm.setRootNode(root);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.mysettings"));
    gtn.setUserObject(MENU_MYSETTINGS);
    gtn.setAltText(translate("menu.mysettings.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.calendar"));
    gtn.setUserObject(MENU_CALENDAR);
    gtn.setAltText(translate("menu.calendar.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.notifications"));
    gtn.setUserObject(MENU_ADMINNOTIFICATIONS);
    gtn.setAltText(translate("menu.notifications.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.bookmarks"));
    gtn.setUserObject(MENU_BOOKMARKS);
    gtn.setAltText(translate("menu.bookmarks.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.bc"));
    gtn.setUserObject(MENU_BC);
    gtn.setAltText(translate("menu.bc.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.note"));
    gtn.setUserObject(MENU_NOTE);
    gtn.setAltText(translate("menu.note.alt"));
    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.efficiencyStatements"));
    gtn.setUserObject(MENU_EFFICIENCY_STATEMENTS);
    gtn.setAltText(translate("menu.efficiencyStatements.alt"));
    root.addChild(gtn);

    //not yet active   
//    gtn = new GenericTreeNode();
//    gtn.setTitle(translate("menu.weblog"));
//    gtn.setUserObject(MENU_WEBLOG);
//    gtn.setAltText(translate("menu.weblog.alt"));
//    root.addChild(gtn);

    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.otherusers"));
    gtn.setUserObject(MENU_OTHERUSERS);
    gtn.setAltText(translate("menu.otherusers.alt"));
    root.addChild(gtn);

    // add extension menues
    ExtManager extm = ExtManager.getInstance();
    Class<? extends HomeMainController> extensionPointMenu = this.getClass();
    int cnt = extm.getExtensionCnt();
    for (int i = 0; i < cnt; i++) {
      Extension anExt = extm.getExtension(i);
      // check for sites
      ActionExtension ae = (ActionExtension) anExt.getExtensionFor(extensionPointMenu.getName());
      if (ae != null) {
        gtn = new GenericTreeNode();
        String menuText = ae.getActionText(getLocale());
        gtn.setTitle(menuText);
        gtn.setUserObject(ae);
        gtn.setAltText(ae.getDescription(getLocale()));
        root.addChild(gtn);
        // inform only once
        if (!extensionLogged) {
          extensionLogged = true;
          extm.inform(extensionPointMenu, anExt, "added menu entry (for locale " + getLocale().toString() + " '" + menuText + "'");
        }
View Full Code Here

  public void event(UserRequest ureq, Component source, Event event) {
    if (source == selectionTree) {
      TreeEvent te = (TreeEvent) event;
      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {

        GenericTreeNode node = (GenericTreeNode) selectionTree.getSelectedNode();
        CatalogManager cm = CatalogManager.getInstance();
        Long newParentId = Long.parseLong(node.getIdent());
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        if (!cm.moveCatalogEntry(moveMe, newParent)) {
          fireEvent(ureq, Event.FAILED_EVENT);
        } else {
          fireEvent(ureq, Event.DONE_EVENT);
View Full Code Here

      atLeastOneAccessible = atLeastOneAccessible || entry.booleanValue();
    }

    // if the coursenode is visible, build a treenode
    if (isVisible()) {
      gtn = new GenericTreeNode();
      gtn.setTitle(courseNode.getShortTitle());
      gtn.setAltText(courseNode.getLongTitle());
      String nodeCssClass = CourseNodeFactory.getInstance().getCourseNodeConfiguration(courseNode.getType()).getIconCSSClass();
      gtn.setIconCssClass(nodeCssClass);
      gtn.setUserObject(this); // the current NodeEval is set into the treenode
View Full Code Here

   * Build a tree node from the given category entry
   * @param catEntry
   * @return
   */
  private GenericTreeNode buildNode(CatalogEntry catEntry) {
    GenericTreeNode node = new GenericTreeNode();
    node.setAccessible(false);
    node.setIdent(catEntry.getKey().toString());
    node.setTitle(catEntry.getName());
    //
    entryMap.put(catEntry.getKey(), node);
    return node;
  }
View Full Code Here

   * Build the selection tree from the given list of entries
   * @param entryList
   * @return The root node of the tree
   */
  private GenericTreeNode buildTree(List<CatalogEntry> entryList) {
    GenericTreeNode rootNode = null;

    if (entryList == null || entryList.size() < 1) {
      rootNode = new GenericTreeNode("keine Node :(", null);
    }
    // build the tree - note that the entry list is not ordered in any way
    for (int cnt = 0; cnt < entryList.size(); cnt++) {
      CatalogEntry elem = entryList.get(cnt);
      // create a tree node and add it to the entry map
      GenericTreeNode n = addNode(elem);
      if (n != null) {
        // a node was created, keep it as a potential root node candidate
        rootNode = addNode(elem);
      }
    }
View Full Code Here

   * Create and add a node to the tree
   * @param entry
   * @return
   */
  private GenericTreeNode addNode(CatalogEntry entry) {
    GenericTreeNode node = entryMap.get(entry.getKey());

    if (node == null && entry.getType() == CatalogEntry.TYPE_NODE) {
      if (entry.getParent() != null) {
        node = entryMap.get(entry.getParent().getKey());
        if (node != null) {
          GenericTreeNode build = buildNode(entry);
          node.addChild(build);
          build.setParent(node);
        } else {
          addMissingNodes(entry);
        }
      }
    }
View Full Code Here

   * Create the parent and child nodes that are not yet in the entry map
   *
   * @param fault
   */
  private void addMissingNodes(CatalogEntry fault) {
    GenericTreeNode branch = null;
    GenericTreeNode helper = null;

    while (fault != null) {
      if (entryMap.get(fault.getKey()) == null) {
        GenericTreeNode build = buildNode(fault);
        if (fault.getParent() != null) // in case of catalog root
        branch = entryMap.get(fault.getParent().getKey());
        if (helper != null) {
          helper.setParent(build);
          build.addChild(helper);
        }
        if (branch != null) {
          build.setParent(branch);
          branch.addChild(build);
          return;
        }
        helper = build;
      }
View Full Code Here

  /**
   * Limit accessability to node to the nodes that are owned by the current user
   */
  private void calculateAccessibility(GenericTreeNode rootNode) {
    GenericTreeNode node = null;
    // first : allow access to all children of the owned entries
    if (ownedEntries != null) {
      for (CatalogEntry entry : ownedEntries) {
        node = entryMap.get(entry.getKey());
        changeAccessibility(node, true);
View Full Code Here

TOP

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

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.