- 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
All Methods Static Methods Concrete Methods 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)
Can be used as a workaround for TreeTableView: graphic of TreeItem is not show/hidden correctly after collapsing/expanding tree .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, ornull
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, ornull
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 ornull
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 frompFromPos
(inclusive) topToPos
(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 ornull
if there is no previous cell or if the specified position isnull
.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.
-
-
-
Method Detail
-
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:
toString(TreeTableView)
-
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 isnull
, 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 frompFromPos
(inclusive) topToPos
(inclusive). IfpFromPos
is greater thanpToPos
, the elements in the stream are provided in backward order.- Throws:
IllegalArgumentException
- if any of the specified positions isnull
, 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, ornull
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, ornull
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 ornull
if there is no previous cell or if the specified position isnull
.
-
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 ornull
if there is no next cell. If the specified position isnull
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 isnull
.
-
selectRow
public static void selectRow(javafx.scene.control.TreeTableView<?> pTable, int pRow)
Selects the specified row and ensures that it's 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)
Can be used as a workaround for TreeTableView: graphic of TreeItem is not show/hidden correctly after collapsing/expanding tree .
-
-