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

ListView's items property is not firing change event

XMLWordPrintable

    • x86_64
    • os_x

      A DESCRIPTION OF THE PROBLEM :
      After having created a new instance of ListView I've added a change listener to the items property.
      If, then, I call ListView.setItems() passing a non-empty list, then the listener is invoked.
      If, instead, I call ListView.setItems() passing an empty list, the listener is not invoked. I think this is an error because the new list is a different instance than the original one in the ListView. For me this is a problem because the (not) called listener should add/update a ListChangeListener to the ListView's items list.

      I've tracked the problem being in the ExpressionHelper.fireValueChangedEvent methods where "changed" is false because "currentValue.equals(oldValue)" return true.

      "items" is an ObjectProperty whose value is an ObservableList, not its content. So a different ObservableList instance with the same content should be considered different.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a new ListView.
      2. Add a change listener to the items property.
      3. Call ListView.setItems(...) passing a newly created, empty ObservableList.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The change listener being invoked.
      ACTUAL -
      The change listener is not invoked.

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: