title: CheckBoxTableCell not working with ObjectProperty<Boolean>
body: <p>I extended <code>SimpleObjectProperty&lt;T&gt;</code> to create a custom, lazy-loading implementation (<a href="https://stackoverflow.com/questions/49037141/lazy-loading-fxproperties">see here</a>), <code>LazyLoadingObjectProperty&lt;T&gt;</code>. </p>
  
  <p>To use this generic implementation for a boolean property, I use <code>LazyLoadingObjectProperty&lt;Boolean&gt;</code>.</p>
  
  <p>In my table, I want to render the boolean property as a <code>CheckBox</code>.</p>
  
  <p>Nevertheless, <strong><code>CheckBoxTableCell</code> seems to work only with <code>BooleanProperty</code> but not with <code>ObjectProperty&lt;Boolean&gt;</code></strong>.</p>
  
  <p>Why is that and how can I workaround?</p>
  
  <p>Here is some code:</p>
  
  <pre><code>public class ExampleTable extends Application {
  
      private static final int NUM_ELEMENTS = 5000;
  
      private final TableView&lt;ExampleBean&gt; table = new TableView&lt;&gt;();
  
      private final ObservableList&lt;ExampleBean&gt; data = FXCollections.observableArrayList();
  
      public static void main(final String[] args) {
          launch(args);
      }
  
      @Override
      public void start(final Stage stage) {
          final Scene scene = new Scene(new Group());
          stage.setTitle("Table View Sample");
          stage.setWidth(300);
          stage.setHeight(500);
  
          final TableColumn&lt;ExampleBean, Boolean&gt; c1 = new TableColumn&lt;&gt;("A");
          c1.setCellValueFactory(new PropertyValueFactory&lt;ExampleBean, Boolean&gt;("p1"));
          c1.setCellFactory(CheckBoxTableCell.forTableColumn(c1));
          c1.setEditable(true);
          c1.setPrefWidth(100);
  
          final TableColumn&lt;ExampleBean, String&gt; c2 = new TableColumn&lt;&gt;("B");
          c2.setCellValueFactory(new PropertyValueFactory&lt;ExampleBean, String&gt;("p2"));
          c2.setCellFactory(TextFieldTableCell.forTableColumn());
          c2.setEditable(true);
          c2.setPrefWidth(100);
  
  
          for (int i = 0; i &lt; NUM_ELEMENTS; i++) {
              data.add(new ExampleBean());
          }
  
          final ScrollPane sp = new ScrollPane();
          sp.setContent(table);
          sp.setMaxHeight(Double.POSITIVE_INFINITY);
          sp.setMaxWidth(Double.POSITIVE_INFINITY);
          sp.setFitToHeight(true);
          sp.setFitToWidth(true);
  
          table.setEditable(true);
          table.setItems(data);
          // table.setMaxHeight(Double.POSITIVE_INFINITY);
          // table.setMaxWidth(Double.POSITIVE_INFINITY);
          table.getColumns().addAll(c1, c2);
  
          final ContextMenu cm = new ContextMenu();
          cm.getItems().add(new MenuItem("bu"));
          table.setContextMenu(cm);
  
          final VBox vbox = new VBox();
          vbox.setSpacing(5);
          VBox.setVgrow(sp, Priority.ALWAYS);
          vbox.getChildren().addAll(sp);
  
          scene.setRoot(vbox);
  
          stage.setScene(scene);
          stage.show();
      }
  }
  
  public class ExampleBean {
  
      private ObjectProperty&lt;Boolean&gt; p1;
  
      private ObjectProperty&lt;String&gt; p2;
  
  
      public ExampleBean() {
          p1 = new SimpleObjectProperty(true);
          p1.addListener((o, ov, nv) -&gt; {
              System.err.println("Value changed " + ov + " -&gt; " + nv);
          });
  
          p2 = new SimpleObjectProperty(Integer.toString(new Random().nextInt()));
          p2.addListener((o, ov, nv) -&gt; {
              System.err.println("Value changed " + ov + " -&gt; " + nv);
          });
      }
  
      public final ObjectProperty&lt;Boolean&gt; p1Property() {
          return this.p1;
      }
  
      public final ObjectProperty&lt;String&gt; p2Property() {
          return this.p2;
      }
  }
  </code></pre>
  
  <p>Note that the property is initialized with <code>Boolean.TRUE</code> and the CheckBoxCells are not checked.</p>
  
  <p>Not used/ needed for this question:</p>
  
  <pre><code>public abstract class LazyLoadingObjectProperty&lt;T&gt; extends SimpleObjectProperty&lt;T&gt; {
  
      public LazyLoadingObjectProperty() {
          super();
  
      }
  
      public LazyLoadingObjectProperty(final Object bean, final String name, final T initialValue) {
          super(bean, name, initialValue);
  
      }
  
      public LazyLoadingObjectProperty(final Object bean, final String name) {
          super(bean, name);
  
      }
  
      public LazyLoadingObjectProperty(final T initialValue) {
          super(initialValue);
  
      }
  
      private boolean loaded = false;
  
      private final ChangeListener&lt;T&gt; valueChangeListener = (o, ov, nv) -&gt; {
          valueExternallyUpdated(nv);
      };
  
      /**
       * Is called after the background task's finished (success or failure). Override
       * if needed. E.g. to bind the value afterwards.
       */
      protected void afterLoaded() {
          addListener(valueChangeListener);
  
      }
  
      /**
       * Returns a {@link Task} that will calculate this Property's value in the
       * background.
       *
       * @return a {@link Task} that will calculate this Property's value in the
       *         background.
       */
      protected abstract Task&lt;T&gt; createTask();
  
      protected T getFailedValue(final Throwable t) {
          return null;
      }
  
      @Override
      public T getValue() {
          if (!loaded) {
              startLoadingService();
          }
          return super.getValue();
      }
  
      public boolean isLoaded() {
          return loaded;
      }
  
      public void setLoaded(final boolean loaded) {
  
  
  
          // the loaded property has been reset manually. Remove change listener
          if (this.loaded &amp;&amp; !loaded) {
              removeListener(valueChangeListener);
          }
  
          this.loaded = loaded;
      }
  
      @Override
      public void setValue(final T v) {
          super.setValue(v);
      }
  
      /**
       * Starts the {@link Task} that will calculate this Property's value in the
       * background.
       */
      protected void startLoadingService() {
          setLoaded(true);
          final Task&lt;T&gt; s = LazyLoadingObjectProperty.this.createTask();
  
          LazyLoadingThreads.getExecutorService().submit(s);
  
          s.setOnFailed(e -&gt; {
              setValue(getFailedValue(e.getSource().getException()));
              afterLoaded();
          });
  
          s.setOnSucceeded(e -&gt; {
              setValue(s.getValue());
              afterLoaded();
          });
  
      }
  
      /**
       * Override this callback method to handle external value-change-events
       * (not-lazily-loaded). This callback is only called, if the value is updated
       * manually, i.e., not via the lazy-loading mechanism.
       *
       * @param nv
       *            the new value
       */
      protected void valueExternallyUpdated(final T nv) {
          // override if needed
  
      }
  
  }
  </code></pre>
  
  <p>Find the mwe also <a href="https://github.com/kerner1000/checkboxtablecell_booleanobjectproperty" rel="nofollow noreferrer">here</a>.</p>