title: Validation of editable cell in onEditCommit in TableColumn
body: <p>I'm writing editable table with JavaFX I want to validate input (e.g. whether same value already exists in table/column) if validation fails I want reject new value. In other words when user types new value into cell and hits ENTER, I do my validation and if it fails I want to see in cell old value. </p>
  
  <p>My code looks very similar to this example
  <a href="http://java-buddy.blogspot.com/2012/04/javafx-2-editable-tableview.html" rel="nofollow">http://java-buddy.blogspot.com/2012/04/javafx-2-editable-tableview.html</a></p>
  
  <p>I thought that I could do something like that</p>
  
  <pre><code>colName.setCellFactory(trainerStringCellFactory);
  colName.setOnEditCommit(
    new EventHandler&lt;TableColumn.CellEditEvent&lt;GymTrainer, String&gt;&gt;() {
      public void handle(TableColumn.CellEditEvent&lt;GymTrainer, String&gt; t) {
         GymTrainer newTrainer = new GymTrainer(t.getNewValue(), trainer.getSurrname(), trainer.getRateOfPay());
         newTrainer.setTrainerId(trainer.getTrainerId());
     if ( !updateTrainer(newTrainer) ) {
            // Here I would like to replace value in editable cell
         }
       }
     }
   });
  </code></pre>
  
  <p>Does anyone has an idea how to do that, or maybe it is wrong place to do so?</p>