Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8114715

ListView: default commit handler updating wrong item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • fx-beta-b36

      happens if items is a SortedList, to reproduce in the modified example below,
      - edit first item (in the view, that is "data item 99") and commit
      expected: the item at that first line is updated
      is: the item at the very bottom (of the view, that is previous "data item 1") is updated

      culprit is the default commit handler, which sets the item of the bottommost source with the index of the sorted. Must do an index mapping to the coordinate system of the bottom-most before setting.

      Modify the example of RT-15205 and add the following:


                  Comparator<String> comparator = new Comparator<String> (){
                      Comparator collator = Collator.getInstance();
                      @Override
                      public int compare(String o1, String o2) {
                          return - collator.compare(o1, o2);
                      }
                      
                  };
                  SortedList<String> sorted = new SortedList(data, comparator);
                  list.setItems(sorted);

            jgiles Jonathan Giles
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: