title: Get object from ListView's ListItem on click
body: <p>I have a list view populated with an observable list </p>
  
  <pre><code>availableSymbolsTable.setItems(watch.GetAvailableSymbols());
  </code></pre>
  
  <p>The cell factory:</p>
  
  <pre><code>availableSymbolsTable.setCellFactory(new Callback&lt;ListView&lt;Symbol&gt;, ListCell&lt;Symbol&gt;&gt;()
          {
  
              @Override
              public ListCell&lt;Symbol&gt; call(ListView&lt;Symbol&gt; p)
              {
                  final ListCell&lt;Symbol&gt; cell = new ListCell&lt;Symbol&gt;()
                  {
                      @Override
                      protected void updateItem(Symbol t, boolean bln)
                      {
                          if (t != null)
                          {
                              setText(t.getSymbolName());
                          }
  
                          setOnMouseEntered(new EventHandler&lt;MouseEvent&gt;()
                          {
                              @Override
                              public void handle(MouseEvent event)
                              {
                                  //This works
                                  System.out.println("index: " + getIndex());
                              }
                          });
  
                          setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;()
                          {
                              @Override
                              public void handle(MouseEvent event)
                              {
                                   //HERE getItem() always returns null
                                  System.out.println( getItem().getSymbolName());         
                              }
                          });
                      }
  
                  };
                  return cell;}});}
  </code></pre>
  
  <p>In the MouseClicked event handler, the getItem() method always returns null. How can I get the associated Symbol object?</p>
  
  <p>EDIT:
  If it helps: I dont know the expected behaviour, but when clicked, elements do not become selected. This happens event when I comment out mouseClicked and mouseEntered handlers. Mouse clicks do nothing.</p>