Pivot
  1. Pivot
  2. PIVOT-724

Problem with TreeView and Comparator

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Fedora 12, NetBeans 8.9, java 1.6.0_18

      Description

      If two TreeNode have the same text AND a comparator is defined for the TreeBranch they belong, then is impossible to select (by mouse o by arrow key) one of them.

      1. Main.java
        3 kB
        Stefano Sancese

        Activity

        Stefano Sancese created issue -
        Stefano Sancese made changes -
        Field Original Value New Value
        Attachment Main.java [ 12475122 ]
        Hide
        Stefano Sancese added a comment -

        This is the right file, forget the other!

        Show
        Stefano Sancese added a comment - This is the right file, forget the other!
        Stefano Sancese made changes -
        Attachment Main.java [ 12475123 ]
        Stefano Sancese made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Stefano Sancese made changes -
        Attachment Main.java [ 12475122 ]
        Sandro Martini made changes -
        Fix Version/s 2.0.1 [ 12315951 ]
        Hide
        Noel Grandin added a comment -

        The problem here is as follows:

        TerraTreeViewSkin#mouseDown()
        calls TerraTreeViewSkin.NodeInfo#getPath()
        calls TreeBranch#indexOf
        calls ArrayList#indexOf
        which use the comparator to do a binary search, and comes up with the wrong answer because it considers the first 2 nodes to be the same.

        Show
        Noel Grandin added a comment - The problem here is as follows: TerraTreeViewSkin#mouseDown() calls TerraTreeViewSkin.NodeInfo#getPath() calls TreeBranch#indexOf calls ArrayList#indexOf which use the comparator to do a binary search, and comes up with the wrong answer because it considers the first 2 nodes to be the same.
        Hide
        Noel Grandin added a comment -

        In revision 1089018 by making the indexOf() method in TreeBranch search for the node by hand.

        Show
        Noel Grandin added a comment - In revision 1089018 by making the indexOf() method in TreeBranch search for the node by hand.
        Noel Grandin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Noel Grandin [ grandinj ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Noel Grandin
            Reporter:
            Stefano Sancese
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development