title: How to bind a domain object to a JavaFX TreeView?
body: <p>How can I bind a domain object to a JavaFX TreeView? ComboBox has <code>getItems()</code> and you can add something to that collection. TreeView does not seem to have such a method. I could only build the tree manually by adding TreeItems to the TreeView's root and then using <code>getChildren().add(...)</code> to add children, but there seems no way of just adding an observable tree structure.</p>
  
  <p>The domain object can read itself from a file and write itself to a file. It has methods to modify its contents. How do I best hook this up with a TreeView so that the user can add and delete nodes?</p>
  
  <p>I don't want GUI code (i.e., JavaFX classes) in my domain objects.</p>
  
  <p>Do I need to write an Adapter class that can turn my domain object into a JavaFX tree?  Then add listeners to the tree and map the changes back to the domain object? Or is there a better way?</p>