title: JavaFX, ObservableList: How to fire an InvalidationListener whenever an object of the list gets modified?
body: <p>Say I have a JavaFX app with an observable class <code>SomeObservableClass</code> with some Properties:</p>
  
  <pre><code>public class SomeObservableClass{
  
    private StringProperty prop1 = new SimpleStringProperty();
    private DoubleProperty prop2 = new SimpleDoubleProperty();
  
    ... constructors, getters and setters
  }
  </code></pre>
  
  <p>and another class which has a property:</p>
  
  <pre><code>public class ParentClass{
    private ObservableList&lt;SomeObservableClass&gt; sOC = FXCollections.observableArrayList();`
  }
  </code></pre>
  
  <p>In this parent class I add a listener for the observable list:  `</p>
  
  <pre><code>public class ParentClass{
    private ObservableList&lt;SomeObservableClass&gt; observableList = FXCollections.observableArrayList();
  
    public`ParentClass(List&lt;SomeObservableClass&gt; list){
      this.observableList.addAll(list);
      this.observableList.addListener((InvalidationListener) observable -&gt; System.out.println("listener detected a change!"));`.
    }
  }
  </code></pre>
  
  <p>Now say that in a controller class I change the property of one of the SomeObservableClass objects:</p>
  
  <pre><code>public class Controller(){
    private ParentClass parentClass;
  
    public void changeSomeProps(){
      SomeObservableClass anObservableObject = parentClass.getObservableList().get(0);
      anObservableObject.setProp1("newVal");
    }
  }
  </code></pre>
  
  <p>This doesn't fire the listener. Why ? </p>
  
  <p>I suspect I am lacking some code to make the listener aware that it should fire when <em>any</em> property of the list objects get modified, but I have no idea how to do that.</p>