Wrong behaviour or documentation for ListChangeListener.Change

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • None
    • Affects Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      Windows 7, JDK7, JavaFX b40

      The documentation for ListChangeListener.Change suggest the following code:
      {code}
      ObservableList<Item> theList = ...;
       {
           theList.addListener(new ListChangeListener<Item>() {
               public void onChanged(Change<Item> c) {
                   while (c.next()) {
                       for (Item remitem : c.getRemoved()) {
                           remitem.remove(Outer.this);
                       }
                       for (Item additem : c.getAddedSubList()) {
                           additem.add(Outer.this);
                       }
                   }
               }
           });
       }
      {code}
      But this will not work because c.next() returns false if there was only one change.
      See attached example.

            Assignee:
            Michael Heinrichs (Inactive)
            Reporter:
            Dr. Michael Paus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: