0 Replies Latest reply on Nov 8, 2012 5:42 PM by 973303

    ListView ChangeListener behaving badly

      I have a ListView in am FXML project the controller has this method

      public void initialize(URL url, ResourceBundle rb) {


      memebersListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<EnterpriseMember>() {

      public void changed(ObservableValue<? extends EnterpriseMember> ov, EnterpriseMember t, EnterpriseMember t1) {

      The FXML loads correctly and the memebersListView has all the right data in it from the EnterpriseMember. mbq.getAllEnterpriseMembersAlpha() is like this

      private EntityManagerFactory emf = Persistence.createEntityManagerFactory("xxPU");
      private EnterpriseMemberJpaController emjc = new EnterpriseMemberJpaController(emf);

      private EntityManager em = emf.createEntityManager();
      public List<EnterpriseMember> getAllEnterpriseMembersAlpha(){
      List<EnterpriseMember> ems = em.createQuery("SELECT p FROM EnterpriseMember p ORDER BY p.secondName").getResultList();
      return ems;

      When I click for the first time the changeListener is notified correctly and the toString() prints a representation of the object. However if I select another one from the list i get nothing.
      And I really mean nothing the changelistener.change() method is never reached (I have had the debugger on to check this).

      Anyone any idea what is happening here. (I have used listview in this way before and just can't spot a difference)