Examples of MenuNode


Examples of org.apache.myfaces.trinidad.menu.MenuNode

        }

        _attrMap = _getMapFromList(attrList);

        // Create either an itemNode or groupNode.
        MenuNode menuNode = _createMenuNode();

        if (menuNode == null)
        {
          // No menu item is created, so note that we are
          // now skipping the subtree
          _skipDepth = _nodeDepth;
        }
        else
        {
          if (   (_resBundleName != null && !"".equals(_resBundleName))
              && (_resBundleKey  != null && !"".equals(_resBundleKey))
             )
          {
            menuNode.setResBundleKey(_resBundleKey);
            menuNode.setResBundleName(_resBundleName);
          }

          // Set the node's MenuContentHandlerUsingApiImpl id so that when
          // the node's getLabel() method is called, we can
          // use the handlerId to insert into the label
          // if it is an EL expression.
          menuNode.setHandlerId(getHandlerId());

          // Set the root model on the node so we can call into
          // the root model from the node to populate its
          // idNodeMap (See XMLMenuModel.java)
          menuNode.setRootModelKey(getRootModelKey());

          // Set the local model (created when parsing a sharedNode)
          // on the node in case the node needs to get back to its
          // local model.
          menuNode.setModelId(getModelId());

          // menu nodes need to know how to refer
          // back to the specific xml menu model
          // so that they can mutate them.
          FacesContext facesContext = FacesContext.getCurrentInstance();
          Map<String, Object> requestMap =
            facesContext.getExternalContext().getRequestMap();
          if(!requestMap.containsKey(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY))
            menuNode.setRootId( (getId() ) );
          else
            menuNode.setRootId((Integer) requestMap.get(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY));

          List<MenuNode> list = _menuNodes.get(_nodeDepth-1);
          list.add(menuNode.getThreadSafeCopy());
        }
      }
      else if (_SHARED_NODE.equals(qualifiedElemName))
      {
        _nodeDepth++;
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

      {
        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 > && _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));
      }
    }
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

    String accessKey   = _getAndRemoveAttrValue(_ACCESSKEY_ATTR);
    String labelAndAccessKey = _getAndRemoveAttrValue(_LABEL_AND_ACCESSKEY_ATTR);
    String id          = _getAndRemoveAttrValue(_ID_ATTR);
    String visibleStr  = _getAndRemoveAttrValue(_VISIBLE_ATTR);

    MenuNode menuNode = _currentNodeStyle == MenuConstants.NODE_STYLE_ITEM
                         ? _createItemNode()
                         : _createGroupNode()
                        );

    // Set the generic attributes
    menuNode.setLabel(label);
    menuNode.setIcon(icon);
    menuNode.setDisabled(disabledStr);
    menuNode.setRendered(renderedStr);
    menuNode.setReadOnly(readOnlyStr);
    menuNode.setAccessKey(accessKey);
    menuNode.setId(id);
    menuNode.setVisible(visibleStr);

    if (labelAndAccessKey != null)
      menuNode.setLabelAndAccessKey(labelAndAccessKey);

    return menuNode;
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

    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);
      }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

        }

        _attrMap = _getMapFromList(attrList);

        // Create either an itemNode or groupNode.
        MenuNode menuNode = _createMenuNode();

        if (menuNode == null)
        {
          // No menu item is created, so note that we are
          // now skipping the subtree
          _skipDepth = _nodeDepth;
        }
        else
        {
          if (   (_resBundleName != null && !"".equals(_resBundleName))
              && (_resBundleKey  != null && !"".equals(_resBundleKey))
             )
          {
            menuNode.setResBundleKey(_resBundleKey);
            menuNode.setResBundleName(_resBundleName);
          }

          // Set the node's MenuContentHandlerUsingApiImpl id so that when
          // the node's getLabel() method is called, we can
          // use the handlerId to insert into the label
          // if it is an EL expression.
          menuNode.setHandlerId(getHandlerId());

          // Set the root model on the node so we can call into
          // the root model from the node to populate its
          // idNodeMap (See XMLMenuModel.java)
          menuNode.setRootModelKey(getRootModelKey());

          // Set the local model (created when parsing a sharedNode)
          // on the node in case the node needs to get back to its
          // local model.
          menuNode.setModelId(getModelId());

          // menu nodes need to know how to refer
          // back to the specific xml menu model
          // so that they can mutate them.
          FacesContext facesContext = FacesContext.getCurrentInstance();
          Map<String, Object> requestMap =
            facesContext.getExternalContext().getRequestMap();
          if(!requestMap.containsKey(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY))
            menuNode.setRootId( (getId() ) );
          else
            menuNode.setRootId((Integer) requestMap.get(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY));

          List<MenuNode> list = _menuNodes.get(_nodeDepth-1);
          list.add(menuNode.getThreadSafeCopy());
        }
      }
      else if (_SHARED_NODE.equals(qualifiedElemName))
      {
        _nodeDepth++;
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

      {
        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 > && _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));
      }
    }
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

    String accessKey   = _getAndRemoveAttrValue(_ACCESSKEY_ATTR);
    String labelAndAccessKey = _getAndRemoveAttrValue(_LABEL_AND_ACCESSKEY_ATTR);
    String id          = _getAndRemoveAttrValue(_ID_ATTR);
    String visibleStr  = _getAndRemoveAttrValue(_VISIBLE_ATTR);

    MenuNode menuNode = _currentNodeStyle == MenuConstants.NODE_STYLE_ITEM
                         ? _createItemNode()
                         : _createGroupNode()
                        );

    // Set the generic attributes
    menuNode.setLabel(label);
    menuNode.setIcon(icon);
    menuNode.setDisabled(disabledStr);
    menuNode.setRendered(renderedStr);
    menuNode.setReadOnly(readOnlyStr);
    menuNode.setAccessKey(accessKey);
    menuNode.setId(id);
    menuNode.setVisible(visibleStr);

    if (labelAndAccessKey != null)
      menuNode.setLabelAndAccessKey(labelAndAccessKey);

    return menuNode;
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.menu.MenuNode

    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);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.