Class TreeTableViewUtil

java.lang.Object
com.iamsoft.util.ui.javafx.TreeTableViewUtil

public final class TreeTableViewUtil extends Object
Miscellaneous utility methods related to TreeTableView.
See Also:
  • TreeTableView
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addCtrlShiftSelectionRangeMode(javafx.scene.control.TreeTableView<?> pTreeTableView)
    Support Ctrl-Shift selection.
    static <S> void
    checkPositions(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pFromPos, javafx.scene.control.TreeTablePosition<S,?> pToPos)
     
    static List<org.controlsfx.control.action.Action>
    configureCopyAccelerators(javafx.scene.control.TreeTableView<?> pTreeTableView)
    Configure Ctrl-C and Ctrl-Shift-C keyboard shortcuts.
    static void
    copy(javafx.scene.control.TreeTableView<?> pTreeTableView)
    Copy selected treetable rows to clipboard.
    static <T> javafx.scene.control.TreeTableRow<T>
    createTreeTableRow(javafx.scene.control.TreeTableView<T> pTreeTable)
    static void
    ensureRowIsVisible(javafx.scene.control.TreeTableView<?> pTable, int pRow)
     
    static <T> javafx.collections.ObservableList<T>
    getExpandedItems(javafx.scene.control.TreeTableView<T> pTreeTableView)
     
    static <T> javafx.collections.ObservableList<T>
    getExpandedItems(javafx.scene.control.TreeTableView<T> pTreeTableView, boolean pUpdateLater)
     
    static <S> javafx.scene.control.TreeTablePosition<S,?>
    getFirstCellPos(javafx.scene.control.TreeTableView<S> pTable)
    Returns the first cell or row position, depending on whether cell selection is enabled, or null if the table is empty or has no columns.
    static int
    getFirstVisibleRow(javafx.scene.control.TreeTableView<?> pTable)
    Returns the first visible row or -1 if there are no visible rows.
    static <S> javafx.scene.control.TreeTablePosition<S,?>
    getLastCellPos(javafx.scene.control.TreeTableView<S> pTable)
    Returns the last cell or row position, depending on whether cell selection is enabled, or null if the table is empty or has no columns.
    static <T> javafx.collections.ObservableList<javafx.scene.control.TreeItem<T>>
    getSelectedItems(javafx.scene.control.TreeTableView<T> pTreeTable)
     
    static <S> javafx.scene.control.TreeTablePosition<S,?>
    nextPosition(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pPos)
    Returns the position of the next cell or null if there is no next cell.
    static <S> Stream<javafx.scene.control.TreeTablePosition<S,?>>
    positionStream(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pFromPos, javafx.scene.control.TreeTablePosition<S,?> pToPos)
    Returns a stream of positions from pFromPos (inclusive) to pToPos (inclusive).
    static <S> javafx.scene.control.TreeTablePosition<S,?>
    prevPosition(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pPos)
    Returns the position of the previous cell or null if there is no previous cell or if the specified position is null.
    static <T> void
    select(javafx.scene.control.TreeTableView<T> pTable, List<javafx.scene.control.TreeItem<T>> pTreeItems)
    Selects the specified tree items and ensures that the first one is visible.
    static <T> void
    selectPosition(javafx.scene.control.TreeTableView<T> pTable, javafx.scene.control.TreeTablePosition<T,?> pPos)
    Selects the specified cell/row and ensures that it's visible.
    static void
    selectRow(javafx.scene.control.TreeTableView<?> pTable, int pRow)
    Selects the specified row and ensures that it's visible.
    static String
    toString(javafx.scene.control.TreeTableView<?> pTreeTableView)
    Export selected rows to a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • toString

      public static String toString(javafx.scene.control.TreeTableView<?> pTreeTableView)
      Export selected rows to a string. If necessary, this method could be adjusted to facilitate copying selected cells, the entire table, etc. TODO: consider using CSV util to handle escapes, etc.
    • copy

      public static void copy(javafx.scene.control.TreeTableView<?> pTreeTableView)
      Copy selected treetable rows to clipboard.
      See Also:
    • configureCopyAccelerators

      public static List<org.controlsfx.control.action.Action> configureCopyAccelerators(javafx.scene.control.TreeTableView<?> pTreeTableView)
      Configure Ctrl-C and Ctrl-Shift-C keyboard shortcuts.
    • addCtrlShiftSelectionRangeMode

      public static void addCtrlShiftSelectionRangeMode(javafx.scene.control.TreeTableView<?> pTreeTableView)
      Support Ctrl-Shift selection.
    • getExpandedItems

      public static <T> javafx.collections.ObservableList<T> getExpandedItems(javafx.scene.control.TreeTableView<T> pTreeTableView)
    • getExpandedItems

      public static <T> javafx.collections.ObservableList<T> getExpandedItems(javafx.scene.control.TreeTableView<T> pTreeTableView, boolean pUpdateLater)
    • checkPositions

      public static <S> void checkPositions(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pFromPos, javafx.scene.control.TreeTablePosition<S,?> pToPos)
      Throws:
      IllegalArgumentException - if any of the specified positions is null, or if an invalid position is specified as an argument, or if one of the specified positions is row based and the other is not.
    • positionStream

      public static <S> Stream<javafx.scene.control.TreeTablePosition<S,?>> positionStream(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pFromPos, javafx.scene.control.TreeTablePosition<S,?> pToPos)
      Returns a stream of positions from pFromPos (inclusive) to pToPos (inclusive). If pFromPos is greater than pToPos, the elements in the stream are provided in backward order.
      Throws:
      IllegalArgumentException - if any of the specified positions is null, or if an invalid position is specified as an argument, or if one of the specified positions is row based and the other is not.
    • getFirstCellPos

      public static <S> javafx.scene.control.TreeTablePosition<S,?> getFirstCellPos(javafx.scene.control.TreeTableView<S> pTable)
      Returns the first cell or row position, depending on whether cell selection is enabled, or null if the table is empty or has no columns.
    • getLastCellPos

      public static <S> javafx.scene.control.TreeTablePosition<S,?> getLastCellPos(javafx.scene.control.TreeTableView<S> pTable)
      Returns the last cell or row position, depending on whether cell selection is enabled, or null if the table is empty or has no columns.
    • prevPosition

      public static <S> javafx.scene.control.TreeTablePosition<S,?> prevPosition(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pPos)
      Returns the position of the previous cell or null if there is no previous cell or if the specified position is null.
    • nextPosition

      public static <S> javafx.scene.control.TreeTablePosition<S,?> nextPosition(javafx.scene.control.TreeTableView<S> pTable, javafx.scene.control.TreeTablePosition<S,?> pPos)
      Returns the position of the next cell or null if there is no next cell. If the specified position is null and the table is not empty and there is at least one column in the table, the first cell is returned.
    • selectPosition

      public static <T> void selectPosition(javafx.scene.control.TreeTableView<T> pTable, javafx.scene.control.TreeTablePosition<T,?> pPos)
      Selects the specified cell/row and ensures that it's visible. The method does nothing if any of the arguments is null.
    • selectRow

      public static void selectRow(javafx.scene.control.TreeTableView<?> pTable, int pRow)
      Selects the specified row and ensures that it's visible.
    • select

      public static <T> void select(javafx.scene.control.TreeTableView<T> pTable, List<javafx.scene.control.TreeItem<T>> pTreeItems)
      Selects the specified tree items and ensures that the first one is visible.
    • ensureRowIsVisible

      public static void ensureRowIsVisible(javafx.scene.control.TreeTableView<?> pTable, int pRow)
    • getFirstVisibleRow

      public static int getFirstVisibleRow(javafx.scene.control.TreeTableView<?> pTable)
      Returns the first visible row or -1 if there are no visible rows.
    • getSelectedItems

      public static <T> javafx.collections.ObservableList<javafx.scene.control.TreeItem<T>> getSelectedItems(javafx.scene.control.TreeTableView<T> pTreeTable)
    • createTreeTableRow

      public static <T> javafx.scene.control.TreeTableRow<T> createTreeTableRow(javafx.scene.control.TreeTableView<T> pTreeTable)