Class TableColumnUtil


  • public final class TableColumnUtil
    extends Object
    Miscellaneous utility methods related to TableView.
    See Also:
    TableView
    • Method Detail

      • syncColWidths

        public static void syncColWidths​(javafx.collections.ObservableList<? extends javafx.scene.control.TableColumn<?,​?>> pColumns)
        Keep column widths in sync for a single set of columns.
      • valueFactory

        public static <S,​T> javafx.util.Callback<javafx.scene.control.TableColumn.CellDataFeatures<S,​T>,​javafx.beans.value.ObservableValue<T>> valueFactory​(javafx.scene.control.TableColumn<S,​T> pTableColumn)
        Callback that accounts for columns with mutating value factories.
        Type Parameters:
        S - The TableView type.
        T - The TableColumn type.
        See Also:
        TableColumn.setCellValueFactory(Callback)
      • excisedRootColumnList

        public static <S,​T> javafx.collections.ObservableList<javafx.scene.control.TableColumn<S,​T>> excisedRootColumnList​(javafx.collections.ObservableList<javafx.scene.control.TableColumn<S,​T>> pColumns)
        New list that, if there is exactly one top-level column and it has 1 or more children, contains the children of 'root' col. If argument list doesn't meet these criteria, it is used as a delegate.
        Type Parameters:
        S - The TableView type.
        T - The TableColumn type.
      • addHideActionToColumns

        public static void addHideActionToColumns​(javafx.collections.ObservableList<? extends javafx.scene.control.TableColumnBase<?,​?>> pColumns)
      • createUnfocusableCheckBoxTableCell

        public static <S,​T> javafx.scene.control.cell.CheckBoxTableCell<S,​T> createUnfocusableCheckBoxTableCell()
      • setUnfocusable

        public static <L extends javafx.scene.control.Labeled> L setUnfocusable​(L pLabel)
      • createTableCell

        public static <S> javafx.scene.control.TableCell<S,​String> createTableCell​(BiFunction<String,​Double,​String> pTruncateFunction)
        Creates a table cell which supports custom truncation strategy.
        Parameters:
        pTruncateFunction - A function, which will be used to truncate the text inside the cell if it doesn't fit. The function accepts the text to be truncated and the width of the cell and returns the truncated text.
      • getTruncateFunction

        public static BiFunction<String,​Double,​String> getTruncateFunction​(javafx.scene.control.TableColumnBase<?,​?> pColumn)
      • setTruncateFunction

        public static void setTruncateFunction​(javafx.scene.control.TableColumnBase<?,​?> pColumn,
                                               BiFunction<String,​Double,​String> pFunction)