glazedlists
  1. glazedlists
  2. GLAZEDLISTS-462

selection is lost when update on TreeList happens

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: 1.10.0
    • Component/s: treetable
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      462

      Description

      The test case
      EventSelectionModelTest.guiTestSelectionOnTreeListUpdate_FixMe()
      currently fails (the last assertion).
      An EventSelectionModel based on a TreeList looses
      its selection when an update happens on the selected element
      in the source list.

        Activity

        Hide
        immudium added a comment -

        Created an attachment (id=46)
        Proposed patch (generated via Eclipse) to track changes to the lead and anchor indices by way of the reorder map to preserve keyboard selections

        Show
        immudium added a comment - Created an attachment (id=46) Proposed patch (generated via Eclipse) to track changes to the lead and anchor indices by way of the reorder map to preserve keyboard selections
        Hide
        brianmerrill added a comment -

        Please disregard the previous attachment/patch. It was intended for Issue #464.
        I apologize for any inconvenience.

        Show
        brianmerrill added a comment - Please disregard the previous attachment/patch. It was intended for Issue #464. I apologize for any inconvenience.
        Hide
        davidecavestro added a comment - - edited

        I suspect the selection is lost only for updates on leaf nodes . My griffon app suffers from this issue.
        Since I've seen there's a RC for 1.9 (that's great!) I just wonder if this issue could be somewhat scheduled for a fix.
        In the meantime is there any known workaround?

        UPDATE: If needed I could easily produce a groovy test case script.

        Show
        davidecavestro added a comment - - edited I suspect the selection is lost only for updates on leaf nodes . My griffon app suffers from this issue. Since I've seen there's a RC for 1.9 (that's great!) I just wonder if this issue could be somewhat scheduled for a fix. In the meantime is there any known workaround? UPDATE: If needed I could easily produce a groovy test case script.
        Hide
        davidecavestro added a comment -

        I've patched TreeList on glazedlists 1.9.0 disabling leafs specific removal/re-add the following way:

        patch.java
        Index: extensions/treetable/source/ca/odell/glazedlists/TreeList.java
        ===================================================================
        --- extensions/treetable/source/ca/odell/glazedlists/TreeList.java	(revision 2358)
        +++ extensions/treetable/source/ca/odell/glazedlists/TreeList.java	(working copy)
        @@ -1006,13 +1006,14 @@
                 Node<E> node = data.get(sourceIndex, REAL_NODES).get();
         
                 // if it has children, replace it with a virtual copy and schedule that for verification
        -        if(!node.isLeaf()) {
        +//        if(!node.isLeaf()) {
                     Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path()));
                     replaceNode(node, replacement, true);
         
                     nodesToVerify.add(replacement);
         
                 // otherwise delete it directly
        +/*
                 } else {
                     Node<E> follower = node.next();
         
        @@ -1024,6 +1025,7 @@
                     // also remove the follower - it may have become redundant as well
                     if(follower != null && follower.virtual) nodesToVerify.add(follower);
                 }
        +*/
             }
         
             /**
        
        

        So far it works for me, provided that I've seen some test fail with or without my change (I must admit I've not gone deep enough on failures cause I've not seen any easily readable test report).

        Show
        davidecavestro added a comment - I've patched TreeList on glazedlists 1.9.0 disabling leafs specific removal/re-add the following way: patch.java Index: extensions/treetable/source/ca/odell/glazedlists/TreeList.java =================================================================== --- extensions/treetable/source/ca/odell/glazedlists/TreeList.java (revision 2358) +++ extensions/treetable/source/ca/odell/glazedlists/TreeList.java (working copy) @@ -1006,13 +1006,14 @@ Node<E> node = data.get(sourceIndex, REAL_NODES).get(); // if it has children, replace it with a virtual copy and schedule that for verification - if (!node.isLeaf()) { + // if (!node.isLeaf()) { Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path())); replaceNode(node, replacement, true ); nodesToVerify.add(replacement); // otherwise delete it directly +/* } else { Node<E> follower = node.next(); @@ -1024,6 +1025,7 @@ // also remove the follower - it may have become redundant as well if (follower != null && follower.virtual) nodesToVerify.add(follower); } +*/ } /** So far it works for me, provided that I've seen some test fail with or without my change (I must admit I've not gone deep enough on failures cause I've not seen any easily readable test report).
        Hide
        wimc added a comment -

        Although the above patch works for my use case, I don't think this is the correct solution.
        It does change the behaviour of the TreeList.
        This is clearly visible when you run the TreeList test suite.

        Show
        wimc added a comment - Although the above patch works for my use case, I don't think this is the correct solution. It does change the behaviour of the TreeList. This is clearly visible when you run the TreeList test suite.
        Hide
        brands added a comment -

        Fixed by pull request
        https://github.com/glazedlists/glazedlists/pull/2
        with commit
        e2dfb43b9d1463183e4f5f239d00cd5e6737561f.

        Show
        brands added a comment - Fixed by pull request https://github.com/glazedlists/glazedlists/pull/2 with commit e2dfb43b9d1463183e4f5f239d00cd5e6737561f.

          People

          • Assignee:
            brands
            Reporter:
            brands
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: