ICEfaces
  1. ICEfaces
  2. ICE-3758

ContextValue does not work when used within a tree

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.7.2
    • Fix Version/s: 1.8RC1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      A contextValue parameter has been added to the panelGroup within the tree node:

      <ice:tree>
                     <ice:treeNode>
                              <f:facet name="content">
                                  <ice:panelGroup menuPopup="::::j_id13:A" contextValue="#{item.userObject}"
                                      `<ice:outputText value="#{item.userObject.text}" />
                                  </ice:panelGroup>
                              </f:facet>
       </ice:treeNode>

      The doSomething method will reference the contextValue here:

      <ice:menuPopup id="A" value="Do Something">
               <ice:menuItem id="item1" onclick="return false;" value="Item 1"/>
                 <ice:menuItem id="item2" actionListener="#{tree.doSomething}" value="Item 2"/>
                  </ice:menuPopup>

      and subsequently:

        public void doSomething(ActionEvent e)
          {
           ContextActionEvent c = (ContextActionEvent) e;
           IceUserObject i = (IceUserObject) c.getContextValue();
          }

      The contextValue parameter that is passed is always null.

        Activity

        Hide
        Tyler Johnson added a comment -

        Sample app configured for Jboss 4.2.

        Show
        Tyler Johnson added a comment - Sample app configured for Jboss 4.2.
        Hide
        yip.ng added a comment -

        The problem has nothing to do with whether the context menu is in a tree. It has to do with the order of processing of <ice:panelGroup> and <ice:menuPopup>. <ice:panelGroup> needs to be processed first so it can pass the contextValue to <ice:menuPopup>, where the action event is fired using the contextValue. Therefore <ice:menuPopup> needs to be moved to after the tree:

        <ice:panelGroup ...>
        <ice:tree ...>
        <ice:treeNode>
        <f:facet name="content">
        <ice:panelGroup menuPopup="::::j_id13:A" contextValue="#

        {item.userObject}

        " ...>
        ...
        </ice:panelGroup>
        </f:facet>
        </ice:treeNode>
        </ice:tree>
        </ice:panelGroup>

        <ice:menuPopup id="A" ...>
        <ice:menuItem id="item1" .../>
        <ice:menuItem id="item2" actionListener="#

        {tree.doSomething}

        " .../>
        </ice:menuPopup>

        In the original source the <ice:menuPopup> was before the <ice:panelGroup>, not after as can be wrongly deduced from the description.

        See screenshot-1 for the original exception thrown, screenshot-3 for the running application without exception, and screenshot-2 for the output from doSomething() without exception.

        Show
        yip.ng added a comment - The problem has nothing to do with whether the context menu is in a tree. It has to do with the order of processing of <ice:panelGroup> and <ice:menuPopup>. <ice:panelGroup> needs to be processed first so it can pass the contextValue to <ice:menuPopup>, where the action event is fired using the contextValue. Therefore <ice:menuPopup> needs to be moved to after the tree: <ice:panelGroup ...> <ice:tree ...> <ice:treeNode> <f:facet name="content"> <ice:panelGroup menuPopup="::::j_id13:A" contextValue="# {item.userObject} " ...> ... </ice:panelGroup> </f:facet> </ice:treeNode> </ice:tree> </ice:panelGroup> <ice:menuPopup id="A" ...> <ice:menuItem id="item1" .../> <ice:menuItem id="item2" actionListener="# {tree.doSomething} " .../> </ice:menuPopup> In the original source the <ice:menuPopup> was before the <ice:panelGroup>, not after as can be wrongly deduced from the description. See screenshot-1 for the original exception thrown, screenshot-3 for the running application without exception, and screenshot-2 for the output from doSomething() without exception.
        Hide
        Ken Fyten added a comment -

        Marking WON'T FIX. ice:menuPopup must be after the panelGroup in the page for this work correctly.

        Show
        Ken Fyten added a comment - Marking WON'T FIX. ice:menuPopup must be after the panelGroup in the page for this work correctly.

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: