trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java [962:1037]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void _addToMaps(
    TreeModel tree,
    Map viewIdFocusPathMap,
    Map nodeFocusPathMap,
    Map idNodeMap)
  {
    for ( int i = 0; i < tree.getRowCount(); i++)
    {
      tree.setRowIndex(i);

      // Get the node
      MenuNode node = (MenuNode) tree.getRowData();

      // Get its focus path
      List<Object> focusPath = (List<Object>)tree.getRowKey();

      // Get the focusViewId of the node
      Object viewIdObject = node.getFocusViewId();

      if (viewIdObject != null)
      {
        // Put this entry in the nodeFocusPathMap
        nodeFocusPathMap.put(node, focusPath);

        // Does this viewId already exist in the _viewIdFocusPathMap?
        List<Object> existingFpArrayList =
          _viewIdFocusPathMap.get(viewIdObject);

        if (existingFpArrayList == null)
        {
          // This is a node with a unique focusViewId.  Simply create
          // and Arraylist and add the focusPath as the single entry
          // to the focus path ArrayList.  Then put the focusPath
          // ArrayList in the focusPath HashMap.
          List<Object> fpArrayList = new ArrayList<Object>();
          fpArrayList.add(focusPath);
          viewIdFocusPathMap.put(viewIdObject, fpArrayList);
        }
        else
        {
          // This is a node that points to the same viewId as at least one
          // other node.

          // If the node's defaultFocusPath is set to true, we move it to
          // the head of the ArrayList. The 0th element of the list is
          // always returned when navigation to a viewId occurs from outside
          // the menu model (that is _currentNode is null)
          boolean defFocusPath = node.getDefaultFocusPath();

          if (defFocusPath)
          {
            existingFpArrayList.add(0, focusPath);
          }
          else
          {
            existingFpArrayList.add(focusPath);
          }
        }
      }

      // Get the Id of the node
      String idProp = node.getUniqueId();

      if (idProp != null)
      {
        idNodeMap.put(idProp, node);
      }

      if (tree.isContainer() && !tree.isContainerEmpty())
      {
        tree.enterContainer();
        _addToMaps(tree, viewIdFocusPathMap, nodeFocusPathMap, idNodeMap);
        tree.exitContainer();
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerUsingApiImpl.java [965:1040]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void _addToMaps(
    TreeModel tree,
    Map viewIdFocusPathMap,
    Map nodeFocusPathMap,
    Map idNodeMap)
  {
    for ( int i = 0; i < tree.getRowCount(); i++)
    {
      tree.setRowIndex(i);

      // Get the node
      MenuNode node = (MenuNode) tree.getRowData();

      // Get its focus path
      List<Object> focusPath = (List<Object>)tree.getRowKey();

      // Get the focusViewId of the node
      Object viewIdObject = node.getFocusViewId();

      if (viewIdObject != null)
      {
        // Put this entry in the nodeFocusPathMap
        nodeFocusPathMap.put(node, focusPath);

        // Does this viewId already exist in the _viewIdFocusPathMap?
        List<Object> existingFpArrayList =
          _viewIdFocusPathMap.get(viewIdObject);

        if (existingFpArrayList == null)
        {
          // This is a node with a unique focusViewId.  Simply create
          // and Arraylist and add the focusPath as the single entry
          // to the focus path ArrayList.  Then put the focusPath
          // ArrayList in the focusPath HashMap.
          List<Object> fpArrayList = new ArrayList<Object>();
          fpArrayList.add(focusPath);
          viewIdFocusPathMap.put(viewIdObject, fpArrayList);
        }
        else
        {
          // This is a node that points to the same viewId as at least one
          // other node.

          // If the node's defaultFocusPath is set to true, we move it to
          // the head of the ArrayList. The 0th element of the list is
          // always returned when navigation to a viewId occurs from outside
          // the menu model (that is _currentNode is null)
          boolean defFocusPath = node.getDefaultFocusPath();

          if (defFocusPath)
          {
            existingFpArrayList.add(0, focusPath);
          }
          else
          {
            existingFpArrayList.add(focusPath);
          }
        }
      }

      // Get the Id of the node
      String idProp = node.getUniqueId();

      if (idProp != null)
      {
        idNodeMap.put(idProp, node);
      }

      if (tree.isContainer() && !tree.isContainerEmpty())
      {
        tree.enterContainer();
        _addToMaps(tree, viewIdFocusPathMap, nodeFocusPathMap, idNodeMap);
        tree.exitContainer();
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



