@Test public void updateItem() { final AtomicBoolean initialized = new AtomicBoolean(false); final BooleanProperty readProp = new SimpleBooleanProperty(false); final AtomicReference<String> value = new AtomicReference<>(""); final Pane pane = new Pane(); final ComponentCellFxmlController<String> clvcc = new ComponentCellFxmlController<>() { @Override public void updateWithValue(String newValue) { value.set(newValue); } @Override public void selectedProperty(final BooleanExpression selected) { readProp.bind(selected); } @Override public void initialize() { if (initialized.get()) { throw new IllegalStateException("Double init!"); } initialized.set(true); } }; final TestListCell testListViewCell = new TestListCell(pane, clvcc); testListViewCell.updateItem("TEST", false); await().until(() -> value.get().equals("TEST")); testListViewCell.updateItem("TEST2", false); await().until(() -> value.get().equals("TEST2")); testListViewCell.updateItem(null, true); await().until(() -> value.get() == null); }
@Override protected void updateItem(final T item, final boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setVisible(false); setManaged(false); } else { setVisible(true); setManaged(true); } Platform.runLater(() -> { cellController.updateWithValue(item); cellController.selectedProperty(selectedProperty()); if (getGraphic() == null) { setGraphic(cellNode); } }); }
ComponentListCell extends ListCell<T> { @Override protected void updateItem(final T item, final boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setVisible(false); setManaged(false); } else { setVisible(true); setManaged(true); } Platform.runLater(() -> { cellController.updateWithValue(item); cellController.selectedProperty(selectedProperty()); if (getGraphic() == null) { setGraphic(cellNode); } }); } }
ComponentListCell extends ListCell<T> { @Override protected void updateItem(final T item, final boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setVisible(false); setManaged(false); } else { setVisible(true); setManaged(true); } Platform.runLater(() -> { cellController.updateWithValue(item); cellController.selectedProperty(selectedProperty()); if (getGraphic() == null) { setGraphic(cellNode); } }); } ComponentListCell(final EasyFxml easyFxml, final FxmlComponent cellNode); @SuppressWarnings("unchecked")  ComponentListCell(final FxmlLoadResult<Pane, ComponentCellFxmlController> loadResult);  ComponentListCell(final Pane cellNode, final ComponentCellFxmlController<T> controller); }
ComponentListCell extends ListCell<T> { @Override protected void updateItem(final T item, final boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setVisible(false); setManaged(false); } else { setVisible(true); setManaged(true); } Platform.runLater(() -> { cellController.updateWithValue(item); cellController.selectedProperty(selectedProperty()); if (getGraphic() == null) { setGraphic(cellNode); } }); } ComponentListCell(final EasyFxml easyFxml, final FxmlComponent cellNode); @SuppressWarnings("unchecked")  ComponentListCell(final FxmlLoadResult<Pane, ComponentCellFxmlController> loadResult);  ComponentListCell(final Pane cellNode, final ComponentCellFxmlController<T> controller);  }
ComponentListCell extends ListCell<T> { @Override protected void updateItem(final T item, final boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setVisible(false); setManaged(false); } else { setVisible(true); setManaged(true); } Platform.runLater(() -> { cellController.updateWithValue(item); cellController.selectedProperty(selectedProperty()); if (getGraphic() == null) { setGraphic(cellNode); } }); } ComponentListCell(final EasyFxml easyFxml, final FxmlComponent cellNode); @SuppressWarnings("unchecked")  ComponentListCell(final FxmlLoadResult<Pane, ComponentCellFxmlController> loadResult);  ComponentListCell(final Pane cellNode, final ComponentCellFxmlController<T> controller);   }