title: Checkbox cell in tableview on JavaFX
body: <p>I'm try create checkbox cell in tableview using FXML. Checkbox appear but not active. Clicking on it does not change its state. 
  This is my FXML file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.collections.*?&gt;
  &lt;?import java.net.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.control.cell.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.paint.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?import sample.*?&gt;
  &lt;?import javafx.geometry.Insets?&gt;
  &lt;?scenebuilder-preview-i18n-resource BasicApplication_en.properties?&gt;
  &lt;VBox prefHeight="400.0" prefWidth="640.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="sample.Controller"&gt;
    &lt;children&gt;
      &lt;MenuBar VBox.vgrow="NEVER"&gt;
        &lt;menus&gt;
          &lt;Menu mnemonicParsing="false" text="%menu.title.file"&gt;
            &lt;items&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.new" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.open" /&gt;
              &lt;Menu mnemonicParsing="false" text="%menu.title.open.recent" /&gt;
              &lt;SeparatorMenuItem mnemonicParsing="false" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.close" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.save" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.save.as" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.revert" /&gt;
              &lt;SeparatorMenuItem mnemonicParsing="false" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.preferences" /&gt;
              &lt;SeparatorMenuItem mnemonicParsing="false" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.quit" onAction="#closeApp"/&gt;
            &lt;/items&gt;
          &lt;/Menu&gt;
          &lt;Menu mnemonicParsing="false" text="%menu.title.edit"&gt;
            &lt;items&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.undo" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.redo" /&gt;
              &lt;SeparatorMenuItem mnemonicParsing="false" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.cut" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.copy" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.paste" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.delete" /&gt;
              &lt;SeparatorMenuItem mnemonicParsing="false" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.select.all" /&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.unselect.all" /&gt;
            &lt;/items&gt;
          &lt;/Menu&gt;
          &lt;Menu mnemonicParsing="false" text="%menu.title.help"&gt;
            &lt;items&gt;
              &lt;MenuItem mnemonicParsing="false" text="%menu.title.about" /&gt;
            &lt;/items&gt;
          &lt;/Menu&gt;
        &lt;/menus&gt;
      &lt;/MenuBar&gt;
      &lt;ToolBar&gt;
        &lt;items&gt;
          &lt;Button mnemonicParsing="false" text="%toolbar.button.add" /&gt;
          &lt;Button mnemonicParsing="false" text="%toolbar.button.edit" /&gt;
          &lt;Button mnemonicParsing="false" text="%toolbar.button.duplicate"     onAction="#duplicateAction"/&gt;
        &lt;/items&gt;
      &lt;/ToolBar&gt;
        &lt;TableView fx:id="tableView" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" &gt;
            &lt;columns&gt;
                &lt;TableColumn fx:id="enabledColumn" prefWidth="75.0" text="%tableview.enabled"&gt;
                    &lt;cellValueFactory&gt;
                        &lt;PropertyValueFactory property="enabled" /&gt;
                    &lt;/cellValueFactory&gt;
                    &lt;cellFactory&gt;
                        &lt;CheckBoxCellFactory&gt;
                        &lt;/CheckBoxCellFactory&gt;
                    &lt;/cellFactory&gt;
                &lt;/TableColumn&gt;
                &lt;TableColumn fx:id="timeColumn" prefWidth="75.0" text="%tableview.time"&gt;
                &lt;/TableColumn&gt;
                &lt;TableColumn fx:id="descriptionColumn" prefWidth="75.0"     text="%tableview.description"&gt;
                    &lt;cellValueFactory&gt;
                        &lt;PropertyValueFactory property="description" /&gt;
                    &lt;/cellValueFactory&gt;
                    &lt;cellFactory&gt;
                        &lt;FormattedTableCellFactory alignment="left"&gt;
                        &lt;/FormattedTableCellFactory&gt;
                    &lt;/cellFactory&gt;
                &lt;/TableColumn&gt;
            &lt;/columns&gt;
            &lt;items&gt;
                &lt;FXCollections fx:factory="observableArrayList"&gt;
                    &lt;MyTimer enabled="false" description="desc1"/&gt;
                    &lt;MyTimer enabled="true" description="desc2"/&gt;
                &lt;/FXCollections&gt;
            &lt;/items&gt;
        &lt;/TableView&gt;
    &lt;/children&gt;
    &lt;stylesheets&gt;
      &lt;URL value="@BasicApplication.css" /&gt;
    &lt;/stylesheets&gt;
  &lt;/VBox&gt;
  </code></pre>
  
  <p>and this is my CheckBoxCellFactory.java</p>
  
  <pre><code>package sample;
  import javafx.beans.property.BooleanProperty;
  import javafx.beans.property.ObjectProperty;
  import javafx.beans.value.ObservableValue;
  import javafx.geometry.Pos;
  import javafx.scene.control.TableCell;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.cell.CheckBoxTableCell;
  import javafx.util.Callback;
  public class CheckBoxCellFactory&lt;S, T&gt; implements Callback&lt;TableColumn&lt;S, T&gt;, TableCell&lt;S, T&gt;&gt; {
      @Override
      public TableCell&lt;S, T&gt; call(TableColumn&lt;S, T&gt; p) {
          CheckBoxTableCell&lt;S, T&gt; cell = new CheckBoxTableCell&lt;S, T&gt;(){
              private ObservableValue&lt;T&gt; ov;
              @Override
              public void updateItem(Object item, boolean empty) {
  
                  super.updateItem((T) item, empty);
                  if (item == null) {
                      super.setText(null);
                      super.setGraphic(null);
                  }
                  else {
                      if (ov instanceof BooleanProperty) {
                              super.selectedStateCallbackProperty().unbindBidirectional((ObjectProperty) ov);
                      }
                      ov = getTableColumn().getCellObservableValue(getIndex());
                      if (ov instanceof BooleanProperty) {
                              super.selectedStateCallbackProperty().bindBidirectional((ObjectProperty) ov);
                      }
                  }
  
              }
          };
          cell.setAlignment(Pos.CENTER);
          return cell;
      }
  }
  </code></pre>
  
  <p>What I do wrong?</p>