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

FilteredList: broken change notification

XMLWordPrintable

      The test case below is about a single add - probably more issues with other modifications of underlying list, too lazy to go for a hunt

          /**
           * Change incorrect on add.
           */
          @Test
          public void testFilteredNotificationAdd() {
              ObservableList<Integer> original = FXCollections.observableArrayList(
                      0, 1, 2, 3, 4 ,5, 6, 7, 8, 9
              );
              FilteredList list = new FilteredList(original, new Always());
              final ObjectProperty<Change> change = new ObjectProperty<Change>();
              ListChangeListener l = new ListChangeListener() {

                  @Override
                  public void onChanged(Change c) {
                      change.set(c);
                  }
                  
              };
              list.addListener(l);
              original.add(20);
              assertEquals("from", list.size() - 1, change.get().getFrom());
              assertEquals("to", list.size(), change.get().getTo());
              assertEquals("added", true, change.get().wasAdded());
      }

           

            msladecek Martin Sládeček
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: