I build a little JavaFX TableView for displaying data. The user should be able to edit the data in the tableview. The problem is: only specific values are allowed in certain fields. If the user entered a wrong value, the field is set to 0.
Here is my Class:
private ObservableList shots;
@FXML
void initialize() {
    this.shots = FXCollections.observableArrayList(match.getShots()); // values from database
    tblShots.setItems(shots);
    tblShots.setEditable(true);
    lblserienid.setText(GUIConstants.idPlaceHolder);
    lblresult.setText(GUIConstants.idPlaceHolder);
    colShotID.setCellValueFactory(new PropertyValueFactory<Schuss, String>("idSchuss"));
    colRing.setCellValueFactory(new PropertyValueFactory<Schuss, String>("ringString"));
    colRing.setCellFactory(TextFieldTableCell.forTableColumn());
    colRing.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<Schuss, String>>() {
        @Override
        public void handle(TableColumn.CellEditEvent<Schuss, String> t) {
            Schuss s = (Schuss) t.getTableView().getItems().get(
                    t.getTablePosition().getRow());
            try {
                int ring = Integer.parseInt(t.getNewValue());
                s.setRing(ring);
            } catch (Exception ex) {
                s.setRing(0);
            }
            SerienauswertungViewController.this.refreshTable();
        }
    });
    colRing.setEditable(true);
    // .... omitted
  }
private void refreshTable(){
  if(shots.size()>0) {
        btnDeleteAll.setDisable(false);
        btnEdit.setDisable(false);
        int res = 0;
        for(int i=0;i<shots.size();i++){
            Schuss s = (Schuss)shots.get(i);
            res += s.getRing();
        }
        lblresult.setText(""+res);
    }
    else {
        btnDeleteAll.setDisable(true);
        btnEdit.setDisable(true);
        lblresult.setText(GUIConstants.idPlaceHolder);
    }
}
So when I edit a tableviewcell and enter "q" (this value is not allowed) and press enter, the debugger jumps in the above catch block, sets the specific value in the observablelist to 0 (I can see this in the debugger, when I expand this object) but the tableviewcell still displays q instead of 0 (which has been corrected by the system)...
Why does the tableview not show the right values of the observablelist-Object???
 
     
     
     
    