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

ListView: default commit handler updating wrong item

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      fx-beta-b36

      Description

      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);

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: