Beehive
  1. Beehive
  2. BEEHIVE-760

selected tree item getting set after the selectionAction is run

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: V1Alpha, V1Beta
    • Fix Version/s: None
    • Component/s: NetUI
    • Labels:
      None

      Description

      TreeRootElement getSelectedNode() and TreeHelpers findSelectedNode(TreeElement root) are both a selection item behind the currently selected item.

      Example tree:
      Item0
      Item0.0

      JPF code snippet:
      TreeRootElement myTree;
      TreeHelpers myHelper;

      @Jpf.Action(forwards =

      { @Jpf.Forward(name = "success", navigateTo=Jpf.NavigateTo.currentPage) }

      )
      protected Forward selectionAction()

      { TreeElement selected = myHelper.findSelected(myTree); System.out.println("SELECTED: " + selected.getName()); return new Forward("success"); }

      Repro steps with above snippets:
      1) If I click on Item0, the println is null and an error/warning is given
      2) If I then click on Item0.0, the following will be printed:
      SELECTED: 0
      3) If I click on Item0.0 again, the following will be printed:
      SELECTED: 0.0
      Continue clicking and you will notice that the printed out selectedItem from the selection action is always one selection behind what was actually clicked.

      1. j760javadoc.txt
        2 kB
        Carlin Rogers
      2. Controller.jpf
        5 kB
        Krista Baker
      3. index.jsp
        0.6 kB
        Krista Baker

        Activity

        Hide
        Rich Feit added a comment -

        Hey Carlin, I applied the patch – thanks.

        Show
        Rich Feit added a comment - Hey Carlin, I applied the patch – thanks.
        Hide
        Carlin Rogers added a comment -

        Assigning this to Rich for review. Rich, please just
        assign this back to me after the patch is applied.
        We can keep this bug open and I can try to create
        a fix for this... TBD.

        Show
        Carlin Rogers added a comment - Assigning this to Rich for review. Rich, please just assign this back to me after the patch is applied. We can keep this bug open and I can try to create a fix for this... TBD.
        Hide
        Carlin Rogers added a comment -

        Here's a patch to update the Javadoc for TreeHelpers.findSelected()
        and TreeRootElement.getSelectedNode() with information describing
        the results of calling these methods from an action.

        Show
        Carlin Rogers added a comment - Here's a patch to update the Javadoc for TreeHelpers.findSelected() and TreeRootElement.getSelectedNode() with information describing the results of calling these methods from an action.
        Hide
        Krista Baker added a comment -

        Would it be possible to add a comment that also explains this into the JavaDoc for TreeRootElement and TreeHelpers for v1?

        Thanks

        Show
        Krista Baker added a comment - Would it be possible to add a comment that also explains this into the JavaDoc for TreeRootElement and TreeHelpers for v1? Thanks
        Hide
        Carlin Rogers added a comment -

        Here's some additional information...

        The problem is that the TreeHelpers.processTreeRequest() has not yet
        been called when the Controller's Action method calls
        TreeHelpers.findSelected(). The value for selected node on the
        server has not been updated when the Action is processed. The
        routine, TreeHelpers.processTreeRequest() is called from the Tree
        tag in the JSP and changes the selected node value.

        Therefor the call from the action to get the selected node
        returns the value before the request is completely processed.

        This seems to be by design and is even noted in the DRT,
        TreeGetSelected. See
        netui/test/webapps/drt/coreWeb/tree/getSelected/Controller.jpf
        and the note in the corresponding JSP,
        netui/test/webapps/drt/coreWeb/tree/getSelected/index.jsp

        Show
        Carlin Rogers added a comment - Here's some additional information... The problem is that the TreeHelpers.processTreeRequest() has not yet been called when the Controller's Action method calls TreeHelpers.findSelected(). The value for selected node on the server has not been updated when the Action is processed. The routine, TreeHelpers.processTreeRequest() is called from the Tree tag in the JSP and changes the selected node value. Therefor the call from the action to get the selected node returns the value before the request is completely processed. This seems to be by design and is even noted in the DRT, TreeGetSelected. See netui/test/webapps/drt/coreWeb/tree/getSelected/Controller.jpf and the note in the corresponding JSP, netui/test/webapps/drt/coreWeb/tree/getSelected/index.jsp
        Hide
        Carlin Rogers added a comment -

        Changing this to TBD fix version. I'll look at this today
        to evaluate and determine the risk involved with a V1 fix.
        Otherwise, based on where we are before the milestone, I
        think this one will have to go in the next release.

        Other thoughts?

        Show
        Carlin Rogers added a comment - Changing this to TBD fix version. I'll look at this today to evaluate and determine the risk involved with a V1 fix. Otherwise, based on where we are before the milestone, I think this one will have to go in the next release. Other thoughts?
        Hide
        Krista Baker added a comment -

        Repro attached.

        Show
        Krista Baker added a comment - Repro attached.

          People

          • Assignee:
            Carlin Rogers
            Reporter:
            Krista Baker
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development