Esempio n. 1
0
  /**
   * This method returns the tabs for a given node from the cache. Tabs are cached per
   * sessionTreeNode. If the tabs don't exist in the cache, they are created.
   *
   * @param node INode for which to retrieve tabs.
   * @return List of tabs.
   */
  private static List<IDetailTab> getTabs(INode node) {

    if (_logger.isDebugEnabled()) {
      _logger.debug("Loading tabs for: " + node.getUniqueIdentifier());
    }

    NodeCache nodeCache = _sessionTabCache.get(node.getSession());

    if (nodeCache == null) {
      // create cache
      nodeCache = new NodeCache();
      _sessionTabCache.put(node.getSession(), nodeCache);
    }

    nodeCache = findNodeCache(node, nodeCache);

    List<IDetailTab> tabs = nodeCache.getTabs();

    if (tabs == null) {
      // create tabs & store for later
      tabs = createTabs(node);
      nodeCache.setTabs(tabs);
    }

    // display parent details if we have nothing for this node..
    if ((tabs == null || tabs.size() == 0) && node.getParent() != null) {
      return getTabs(node.getParent());
    }

    return tabs;
  }
Esempio n. 2
0
  private static NodeCache findNodeCache(INode pNode, NodeCache pNodeCache) {
    NodeCache found =
        pNode.getParent() == null ? pNodeCache : findNodeCache(pNode.getParent(), pNodeCache);

    return found.getChild(pNode);
  }