title: JavaFX TableView with Custom Cell Datepicker "OnEditCommit" is not invoked
body: <p><strong>Hi everyone !!</strong></p>
  
  <p>I'm working with JavaFX and the JDK 8. </p>
  
  <p>I got a <strong>TableView filled by a database with the use of a JavaFX POJO Class "Inputs"</strong>. I've implemented TexField cells, ComboBoxes cells and Checkbox cells succesfully.</p>
  
  <p>But I am not able to make it working with DatePicker Control: the event on the <strong>"setOnEditComit" is never invoked...</strong></p>
  
  <p><strong>Hre is my code:</strong></p>
  
  <p><strong>Declarations for TableColumn:</strong></p>
  
  <pre><code>    @FXML
      private TableColumn&lt;Inputs,LocalDate&gt; colDate = new TableColumn&lt;Inputs,LocalDate&gt;();
       [...]
      colDate.setCellValueFactory(
                          new PropertyValueFactory&lt;Inputs,LocalDate&gt;("localdate"));
  
          Callback&lt;TableColumn&lt;Inputs, LocalDate&gt;, TableCell&lt;Inputs, LocalDate&gt;&gt; dateCellFactory =
                      new Callback&lt;TableColumn&lt;Inputs, LocalDate&gt;, TableCell&lt;Inputs, LocalDate&gt;&gt;() {
                  public TableCell call(TableColumn p) {
                      return new EditingDatePickerCell();
                  }
              };
  
        [...]
      colDate.setOnEditCommit(
                      new EventHandler&lt;CellEditEvent&lt;Inputs, LocalDate&gt;&gt;() {
                          @Override
                          public void handle(CellEditEvent&lt;Inputs, LocalDate&gt; event) {
  
          System.out.println("EVENT!!!!");
                              ((Inputs) event.getTableView().getItems().get(
                                      event.getTablePosition().getRow())
                                      ).setDatePicker(event.getNewValue());
     }
     }
     );
  </code></pre>
  
  <p><strong>With these JavaFX POJO Objects declarations:</strong></p>
  
  <pre><code>    public ObjectProperty&lt;LocalDate&gt; localdate; 
       [...]
  
       this.localdate =  new SimpleObjectProperty&lt;LocalDate&gt;(localdate); 
       [...]
      public LocalDate  getDatePicker() {
              return localdate.getValue();
          }
       [...]
      public void setDatePicker(LocalDate  value) {
              System.out.println("EVENT!!!!");
              localdate.setValue(value);
          }
       [...]
      public ObjectProperty&lt;LocalDate&gt; localdateProperty() {
              return localdate;
          }
  </code></pre>
  
  <p><strong>EditingDatePickerCell class:</strong></p>
  
  <pre><code> import java.text.SimpleDateFormat;
   import java.time.LocalDate;
   import java.util.ArrayList;
   import java.util.Date;
   import java.util.List;
  
   import javafx.application.Platform;
   import javafx.event.ActionEvent;
   import javafx.event.EventHandler;
   import javafx.geometry.Pos;
   import javafx.scene.control.ContentDisplay;
   import javafx.scene.control.DatePicker;
   import javafx.scene.control.TableCell;
   import javafx.scene.control.TableColumn;
   import javafx.scene.input.KeyCode;
   import javafx.scene.input.KeyEvent;
  
   import com.desktop.newapp.utils.Inputs;
  
      public class EditingDatePickerCell &lt;Inputs, LocalDate&gt; extends TableCell&lt;Inputs, LocalDate&gt; {
  
          @Override
          public void startEdit() {
              if (!isEmpty()) {
                  super.startEdit();
                  createDatePicker();
                  setText(null);
                  setGraphic(datePicker);
                  datePicker.requestFocus();
              }
          }
  
          @Override
          public void cancelEdit() {
              super.cancelEdit();
              datePicker.setValue((java.time.LocalDate) getItem());
              setGraphic(null);
              setContentDisplay(ContentDisplay.TEXT_ONLY);
          }
  
          private DatePicker datePicker;
  
          public EditingDatePickerCell() {
              if (datePicker == null) {
                  createDatePicker();
              }
              setGraphic(datePicker);
              setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
  
              Platform.runLater(new Runnable() {
                  @Override
                  public void run() {
                      datePicker.requestFocus();
                  }
              });
          }
  
          @Override
          public void updateItem(LocalDate item, boolean empty) {
              super.updateItem(item, empty);
              if (empty) {
                  setText(null);
                  setGraphic(null);
              } else {
  
              if (datePicker != null &amp;&amp; item != null) {
                  datePicker.setValue((java.time.LocalDate) getLocalDate());
                  commitEdit(getLocalDate());
              }
                  setGraphic(datePicker);
                  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
  
              }
          }
  
  
          private void createDatePicker() {
              datePicker = new DatePicker();
              datePicker.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
              setGraphic(datePicker);  
  
  
  
              datePicker.addEventFilter(KeyEvent.KEY_PRESSED,new EventHandler&lt;KeyEvent&gt;() { 
                  @Override
                  public void handle(KeyEvent t) {
  
                          if (t.getCode() == KeyCode.ENTER) {
                              commitEdit(getLocalDate());
                          } else if (t.getCode() == KeyCode.ESCAPE) {
                              cancelEdit();
                          } else if (t.getCode() == KeyCode.TAB) {
                              commitEdit(getLocalDate());;
  
                          }
                      }
  
              });
  
              setAlignment(Pos.CENTER);
          }
  
          private LocalDate getLocalDate() {
         return  getItem();
           ///return datePicker.getValue() != null ? datePicker.getValue() : getItem();
          }  
      }
  </code></pre>
  
  <p>I've been Googling a lot and I didn't find any correct implementation of the Java8 DatePicker Editing capabilities in a JavaFX TableView. Any help would be <strong>very appreciate</strong> !!</p>
  
  <p>Without Stackoverflow I'll never could done the quarter of the whole job so <strong>long life to Stackoverflow</strong> !! </p>
  
  <p><strong>Regards.</strong></p>