Class VFXObservingTableCell<T,E>

All Implemented Interfaces:
io.github.palexdev.mfxcore.behavior.WithBehavior, io.github.palexdev.mfxcore.controls.MFXSkinnable, io.github.palexdev.mfxcore.controls.MFXStyleable, VFXCell<T>, VFXMappingTableCell<T, ObservableValue<E>>, VFXTableCell<T>, Styleable, EventTarget, Skinnable

public class VFXObservingTableCell<T,E> extends VFXSimpleTableCell<T, ObservableValue<E>>
Extension of VFXSimpleTableCell which is intended to be used with models that make use of JavaFX properties. Uses VFXObservingTableCell<T,E>.VFXObservingTableCellSkin as the default skin implementation.

The extractor function is expected to extract a property of type ObservableValue.

The StringConverter is intended to convert the value of the observable, ObservableValue.getValue(), to a String. By default, this returns an empty string if the observable is null, otherwise uses Objects.toString(Object) on its value.

Also note that this cell keeps a reference to the extracted ObservableValue thus avoiding continuous calls to the extractor. The reference is disposed by dispose()
  • Field Details

  • Constructor Details

  • Method Details

    • getProperty

      protected ObservableValue<E> getProperty()
      Returns the ObservableValue extracted by the extractor function.

      If the local reference is still null it first attempts at extracting it, and then updates it (so that later calls will just return the already extracted observable).

    • updateItem

      public void updateItem(T item)
      Automatically called by the framework when the cell needs to update its item.

      Note though, that there is no 100% guarantee the new given item is different from the current one. If you have some operations happen when the item changes, for performance reasons, I recommend you to first ensure the new item really is different.

      See VFXCellBase and read how this is handled.

      Updates the VFXCellBase.itemProperty().

      Before updating the item this disposes the ObservableValue previously extracted by getProperty().
      Specified by:
      updateItem in interface VFXCell<T>
      Overrides:
      updateItem in class VFXCellBase<T>
    • defaultSkinFactory

      public Supplier<io.github.palexdev.mfxcore.controls.MFXSkinBase<? extends Node>> defaultSkinFactory()
      Specified by:
      defaultSkinFactory in interface io.github.palexdev.mfxcore.controls.MFXSkinnable
      Overrides:
      defaultSkinFactory in class VFXSimpleTableCell<T, ObservableValue<E>>
    • dispose

      public void dispose()
      Description copied from interface: VFXCell
      Automatically called by the framework when the cell is not needed anymore. The user can override this to perform some operations before the cell is GCd.
      Specified by:
      dispose in interface VFXCell<T>
      Overrides:
      dispose in class VFXCellBase<T>