ListView does not update cells on NonIterableChange.SimpleUpdateChange

XMLWordPrintable

    • Type: Bug
    • Resolution: Incomplete
    • Priority: P4
    • None
    • Affects Version/s: 7u15
    • Component/s: javafx
    • Environment:

      java version "1.7.0_21"
      Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
      Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)

      I can not notify update in observable list to ListView.

          @Test
          public void testUpdate() {

              ObservableListWrapper<Long> list = new ObservableListWrapper(new LinkedList<Long>()) {
                  // Just for test
                  @Override
                  public void sort() {
                      callObservers(new NonIterableChange.SimpleUpdateChange(0, this));
                  }
              };
              Long x = 1L;
              list.add(x);

              ListView<Long> listView = new ListView<Long>(list);
              listView.setCellFactory(new Callback<ListView<Long>, ListCell<Long>>() {
                  @Override
                  public ListCell<Long> call(ListView<Long> param) {
                      return new ListCell<Long>() {
                          @Override
                          protected void updateItem(Long item, boolean empty) {
                              super.updateItem(item, empty);
                              System.out.print("Update");
                          }
                      };
                  }
              });

              list.sort(); // Must output Update, nothing happens
          }

      As workaround we can remove and then add item

            Assignee:
            Jonathan Giles
            Reporter:
            J. Duke
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: