trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java [372:426]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public void endElement(String nameSpaceUri, String localElemName, String qualifiedElemName)
  {
    if (   _ITEM_NODE.equals(qualifiedElemName)
        || _GROUP_NODE.equals(qualifiedElemName)
       )
    {
      _nodeDepth--;

      if (_skipDepth >= 0)
      {
        if (_nodeDepth < _skipDepth)
        {
          _skipDepth = -1;
        }
      }
      else
      {
        if (_nodeDepth > 0)
        {
          // The parent menu item is the last menu item at the previous depth
          List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
          MenuNode       parentNode = parentList.get(parentList.size()-1);

          parentNode.setChildren(_menuNodes.get(_nodeDepth));
        }

        // If we have dropped back two levels, then we are done adding
        // the parent's sub tree, remove the list of menu items at that level
        // so they don't get added twice.
        if (_nodeDepth == (_menuNodes.size() - 2))
        {
          _menuNodes.remove(_nodeDepth+1);
        }
      }
    }
    else if (_SHARED_NODE.equals(qualifiedElemName))
    {
      _nodeDepth--;

      // In processing a sharedNode in startElement(), it is possible
      // that a sharedNode model is not created properly. However,
      // we only log an error and let parsing continue so that the whole
      // Tree can get created w/o the failed sharedNode submenu model.
      // Thus we need the 2nd conditional here to detect if we are at
      // the end of parsing a failed sharedNode.
      if (_nodeDepth > 0  && _menuNodes.size() > _nodeDepth)
      {
        // The parent menu item is the last menu item at the previous depth
        List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
        MenuNode       parentNode = parentList.get(parentList.size()-1);

        parentNode.setChildren(_menuNodes.get(_nodeDepth));
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerUsingApiImpl.java [375:429]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public void endElement(String nameSpaceUri, String localElemName, String qualifiedElemName)
  {
    if (   _ITEM_NODE.equals(qualifiedElemName)
        || _GROUP_NODE.equals(qualifiedElemName)
       )
    {
      _nodeDepth--;

      if (_skipDepth >= 0)
      {
        if (_nodeDepth < _skipDepth)
        {
          _skipDepth = -1;
        }
      }
      else
      {
        if (_nodeDepth > 0)
        {
          // The parent menu item is the last menu item at the previous depth
          List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
          MenuNode       parentNode = parentList.get(parentList.size()-1);

          parentNode.setChildren(_menuNodes.get(_nodeDepth));
        }

        // If we have dropped back two levels, then we are done adding
        // the parent's sub tree, remove the list of menu items at that level
        // so they don't get added twice.
        if (_nodeDepth == (_menuNodes.size() - 2))
        {
          _menuNodes.remove(_nodeDepth+1);
        }
      }
    }
    else if (_SHARED_NODE.equals(qualifiedElemName))
    {
      _nodeDepth--;

      // In processing a sharedNode in startElement(), it is possible
      // that a sharedNode model is not created properly. However,
      // we only log an error and let parsing continue so that the whole
      // Tree can get created w/o the failed sharedNode submenu model.
      // Thus we need the 2nd conditional here to detect if we are at
      // the end of parsing a failed sharedNode.
      if (_nodeDepth > 0  && _menuNodes.size() > _nodeDepth)
      {
        // The parent menu item is the last menu item at the previous depth
        List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
        MenuNode       parentNode = parentList.get(parentList.size()-1);

        parentNode.setChildren(_menuNodes.get(_nodeDepth));
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



