public final class TableViewUtil extends Object
TableView
Modifier and Type | Method and Description |
---|---|
static void |
addCtrlShiftSelectionRangeMode(javafx.scene.control.TableView<?> pTableView)
Support Ctrl-Shift selection.
|
static <T> void |
addItemsListener(javafx.scene.control.TableView<T> pTable,
javafx.beans.value.ChangeListener<? super javafx.collections.ObservableList<T>> pListener)
Using a change listener for TableView.itemsProperty() may result in an
unexpected behavior, because when the value of items property is replaced and both
old and new lists are empty or have equal elements and size, they will be considered
as equal and change event will not be fired.
|
static <T> void |
bindColumns(javafx.scene.control.TableView<T> pDestTableView,
javafx.scene.control.TableView<T> pSrcTableView) |
static <S> void |
checkPositions(javafx.scene.control.TableView<S> pTable,
javafx.scene.control.TablePosition<S,?> pFromPos,
javafx.scene.control.TablePosition<S,?> pToPos) |
static int |
compare(javafx.scene.control.TablePositionBase<?> pPos1,
javafx.scene.control.TablePositionBase<?> pPos2) |
static Object |
configureColumnReordering(javafx.scene.control.TableView<?> pTable,
javafx.scene.control.TableView<?> pReorderingTable)
Keep reordering line and reordering region in sync when the user is reordering columns.
|
static List<org.controlsfx.control.action.Action> |
configureCopyAccelerators(javafx.scene.control.TableView<?> pTableView)
Configure Ctrl-C and Ctrl-Shift-C keyboard shortcuts.
|
static List<org.controlsfx.control.action.Action> |
configureCopyAccelerators(javafx.scene.control.TableView<?> pTableView,
Consumer<javafx.event.ActionEvent> pCopySelectedRowHandler)
Configure Ctrl-C and Ctrl-Shift-C keyboard shortcuts.
|
static void |
copyFocusedCell(javafx.scene.control.TableView<?> pTableView)
Copy selected cell to clipboard.
|
static void |
copySelectedRows(javafx.scene.control.TableView<?> pTableView)
Copy selected table rows to clipboard.
|
static void |
copySelection(javafx.scene.control.TableView<?> pTableView) |
static void |
copySelection(javafx.stage.Window pParent,
javafx.scene.control.TableView<?> pTableView,
BiFunction<Integer,Integer,Object> pCellTextProvider) |
static <S,T> javafx.scene.control.cell.ComboBoxTableCell<S,T> |
createComboBoxTableCell(javafx.scene.control.TableView<S> pTable,
javafx.util.StringConverter<T> pConverter,
javafx.collections.ObservableList<T> pItems)
Use this method as a workaround for the following bugs:
Clicking outside of the edited cell, node, or entry should commit the value
[TableCell] commit on focus lost not possible in every case
.
|
static javafx.beans.property.ReadOnlyProperty<Double> |
createHeaderHeightProperty(javafx.scene.control.TableView<?> pTable)
Creates a read-only property providing the height of the
header of the specified table.
|
static javafx.beans.value.ObservableValue<com.sun.javafx.scene.control.skin.TableHeaderRow> |
createHeaderRowProperty(javafx.scene.control.TableView<?> pTable)
Creates a read-only property providing the header row
of the specified table.
|
static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> |
createHScrollBarProperty(javafx.scene.control.Control pControl)
Creates a read-only property providing the horizontal scroll bar
of the specified table.
|
static <S> javafx.beans.property.ReadOnlyProperty<Double> |
createMaxRowHeightProperty(javafx.scene.control.TableView<S> pTable)
Creates a read-only property providing the height of the
'tallest' row in the table.
|
static <N extends javafx.scene.Node> |
createNodeProperty(javafx.scene.control.Control pParent,
String pCssSelector) |
static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> |
createScrollBarProperty(javafx.scene.control.Control pControl,
javafx.geometry.Orientation pOrientation)
Creates a read-only property providing the horizontal/vertical
scroll bar of the specified table.
|
static <S,T> javafx.scene.control.cell.TextFieldTableCell<S,T> |
createTextFieldTableCell(javafx.scene.control.TableView<S> pTable,
javafx.util.StringConverter<T> pConverter)
Use this method as a workaround for the following bugs:
Clicking outside of the edited cell, node, or entry should commit the value
[TableCell] commit on focus lost not possible in every case
.
|
static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> |
createVScrollBarProperty(javafx.scene.control.Control pControl)
Creates a read-only property providing the vertical scroll bar
of the specified table.
|
static void |
embedContent(javafx.collections.ObservableList<? extends javafx.scene.control.TableColumn<?,?>> pColumns,
javafx.scene.control.TableView<?> pTable)
Display table contents of the specified table within TableColumn2 headers.
|
static void |
ensureRowIsVisible(javafx.scene.control.TableView<?> pTable,
int pRow) |
static String |
focusedCellToString(javafx.scene.control.TableView<?> pTableView) |
static <S> javafx.scene.control.TableCell<S,?> |
getCellByScenePosition(javafx.scene.control.TableView<S> pTable,
double pSceneX,
double pSceneY) |
static <S> javafx.scene.control.TablePosition<S,?> |
getCellPositionByScenePosition(javafx.scene.control.TableView<S> pTable,
double pSceneX,
double pSceneY) |
static Map.Entry<Integer,Integer> |
getColumnIndexPair(javafx.scene.control.TableView<?> pTableView,
int pColumnIdx)
If the table contains nested columns, the returned entry's key
contains the corresponding table column index and the entry's value
the corresponding nested column index or
-1 if the column
dosn't have nested columns. |
static <S> javafx.scene.control.TablePosition<S,?> |
getFirstCellPos(javafx.scene.control.TableView<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 <S> javafx.scene.control.TablePosition<S,?> |
getLastCellPos(javafx.scene.control.TableView<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 javafx.scene.control.ScrollBar |
getScrollBar(javafx.scene.control.Control pControl,
javafx.geometry.Orientation pOrientation) |
static javafx.scene.control.ScrollBar |
getScrollBar(javafx.scene.control.Control pControl,
javafx.geometry.Orientation pOrientation,
String pSelector) |
static <T> javafx.collections.ObservableList<T> |
getSelectedItems(javafx.collections.ObservableList<T> pSelectedItems)
Can be used as a workaround for bug JDK-8204078.
|
static <T> javafx.collections.ObservableList<T> |
getSelectedItems(javafx.beans.value.ObservableValue<? extends javafx.scene.control.TableSelectionModel<T>> pSelectionModelProperty)
Can be used as a workaround for bug JDK-8204078.
|
static <T> javafx.collections.ObservableList<T> |
getSelectedItems(javafx.scene.control.TableView<T> pTable)
Can be used as a workaround for bug JDK-8204078.
|
static com.sun.javafx.scene.control.skin.TableViewSkinBase |
getTableSkin(javafx.scene.control.TableView<?> pTable) |
static void |
hideHeader(javafx.scene.control.TableView<?> pTableView) |
static void |
hideHorizontalScrollBar(javafx.scene.control.TableView<?> pTableView) |
static void |
hideRegion(javafx.beans.value.ObservableValue<? extends javafx.scene.layout.Region> pRegion) |
static void |
hideRegion(javafx.scene.layout.Region pRegion) |
static <T> void |
linkSort(javafx.scene.control.TableView<?> pSrcTable,
javafx.scene.control.TableView<T> pTargetTable) |
static <S> javafx.scene.control.TablePosition<S,?> |
nextPosition(javafx.scene.control.TableView<S> pTable,
javafx.scene.control.TablePosition<S,?> pPos)
Returns the position of the next cell or
null if there is no next cell. |
static <S> Stream<javafx.scene.control.TablePosition<S,?>> |
positionStream(javafx.scene.control.TableView<S> pTable,
javafx.scene.control.TablePosition<S,?> pFromPos,
javafx.scene.control.TablePosition<S,?> pToPos)
Returns a stream of positions from
pFromPos (inclusive) to
pToPos (inclusive). |
static void |
preserveTableSelection(javafx.scene.control.TableView<?> pTable)
Use this method to preserve the table selection on item updates when
ObservableSortedList is used as item list in the table. |
static <S> javafx.scene.control.TablePosition<S,?> |
prevPosition(javafx.scene.control.TableView<S> pTable,
javafx.scene.control.TablePosition<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 String |
selectedRowsToString(javafx.scene.control.TableView<?> pTableView)
Export selected table rows to String.
|
static String |
selectedRowsToString(javafx.scene.control.TableView<?> pTableView,
BiFunction<Integer,Integer,Object> pCellTextProvider) |
static void |
selectIndices(javafx.scene.control.TableView<?> pTable,
List<Integer> pIndices)
Efficient way to select indices.
|
static String |
selectionToString(javafx.scene.control.TableView<?> pTableView) |
static String |
selectionToString(javafx.scene.control.TableView<?> pTableView,
BiFunction<Integer,Integer,Object> pCellTextProvider) |
static <T> void |
selectPosition(javafx.scene.control.TableView<T> pTable,
javafx.scene.control.TablePosition<T,?> pPos)
Selects the specified cell/row and ensures that it's visible.
|
static void |
selectRow(javafx.scene.control.TableView<?> pTable,
int pRow)
Selects the specified row and ensures that it's visible.
|
static void |
setEmptyPlaceholder(javafx.scene.control.TableView<?> pTable) |
void |
syncAllColWidths(javafx.collections.ObservableList<javafx.collections.ObservableList<javafx.scene.control.TableColumn<?,?>>> pColLists)
Keep column widths in sync for a list of column lists.
|
static <I,O> Collection<Object> |
syncColumnArrangement(javafx.collections.ObservableList<javafx.scene.control.TableColumn<I,?>> pSrcColumns,
Function<javafx.scene.control.TableColumn<I,?>,javafx.scene.control.TableColumn<O,?>> pFunction,
javafx.scene.control.TableView<O> pDestTableView)
Synchronize ordering and width of columns.
|
static Object |
syncHorizontalScroll(javafx.collections.ObservableList<? extends javafx.scene.control.TableView<?>> pTables) |
static void |
updateFocusedCellOnRightClick(javafx.scene.control.TableView<?> pTable) |
public static String selectedRowsToString(javafx.scene.control.TableView<?> pTableView)
public static String selectedRowsToString(javafx.scene.control.TableView<?> pTableView, BiFunction<Integer,Integer,Object> pCellTextProvider)
public static String selectionToString(javafx.scene.control.TableView<?> pTableView) throws InterruptedException
InterruptedException
public static String selectionToString(javafx.scene.control.TableView<?> pTableView, BiFunction<Integer,Integer,Object> pCellTextProvider) throws InterruptedException
InterruptedException
public static void copySelectedRows(javafx.scene.control.TableView<?> pTableView)
selectedRowsToString(TableView)
public static void copySelection(javafx.scene.control.TableView<?> pTableView)
public static void copySelection(javafx.stage.Window pParent, javafx.scene.control.TableView<?> pTableView, BiFunction<Integer,Integer,Object> pCellTextProvider)
public static List<org.controlsfx.control.action.Action> configureCopyAccelerators(javafx.scene.control.TableView<?> pTableView)
public static List<org.controlsfx.control.action.Action> configureCopyAccelerators(javafx.scene.control.TableView<?> pTableView, Consumer<javafx.event.ActionEvent> pCopySelectedRowHandler)
public static String focusedCellToString(javafx.scene.control.TableView<?> pTableView)
public static void copyFocusedCell(javafx.scene.control.TableView<?> pTableView)
public static Map.Entry<Integer,Integer> getColumnIndexPair(javafx.scene.control.TableView<?> pTableView, int pColumnIdx)
-1
if the column
dosn't have nested columns.
If the table does not contain nested columns, the returned entry's value
is -1
and the entry's key is pColumnIdx
.public static <T> void bindColumns(javafx.scene.control.TableView<T> pDestTableView, javafx.scene.control.TableView<T> pSrcTableView)
public void syncAllColWidths(javafx.collections.ObservableList<javafx.collections.ObservableList<javafx.scene.control.TableColumn<?,?>>> pColLists)
public static javafx.beans.value.ObservableValue<com.sun.javafx.scene.control.skin.TableHeaderRow> createHeaderRowProperty(javafx.scene.control.TableView<?> pTable)
public static javafx.beans.property.ReadOnlyProperty<Double> createHeaderHeightProperty(javafx.scene.control.TableView<?> pTable)
public static <S> javafx.beans.property.ReadOnlyProperty<Double> createMaxRowHeightProperty(javafx.scene.control.TableView<S> pTable)
public static void setEmptyPlaceholder(javafx.scene.control.TableView<?> pTable)
public static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> createHScrollBarProperty(javafx.scene.control.Control pControl)
public static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> createVScrollBarProperty(javafx.scene.control.Control pControl)
public static javafx.beans.property.ReadOnlyProperty<javafx.scene.control.ScrollBar> createScrollBarProperty(javafx.scene.control.Control pControl, javafx.geometry.Orientation pOrientation)
pOrientation
- Specifies whether to return
horizontal or vertical scroll bar property.public static javafx.scene.control.ScrollBar getScrollBar(javafx.scene.control.Control pControl, javafx.geometry.Orientation pOrientation)
public static javafx.scene.control.ScrollBar getScrollBar(javafx.scene.control.Control pControl, javafx.geometry.Orientation pOrientation, String pSelector)
public static <N extends javafx.scene.Node> javafx.beans.property.ReadOnlyProperty<N> createNodeProperty(javafx.scene.control.Control pParent, String pCssSelector)
public static void hideHeader(javafx.scene.control.TableView<?> pTableView)
public static void hideHorizontalScrollBar(javafx.scene.control.TableView<?> pTableView)
public static void hideRegion(javafx.beans.value.ObservableValue<? extends javafx.scene.layout.Region> pRegion)
public static void hideRegion(javafx.scene.layout.Region pRegion)
public static <I,O> Collection<Object> syncColumnArrangement(javafx.collections.ObservableList<javafx.scene.control.TableColumn<I,?>> pSrcColumns, Function<javafx.scene.control.TableColumn<I,?>,javafx.scene.control.TableColumn<O,?>> pFunction, javafx.scene.control.TableView<O> pDestTableView)
public static Object configureColumnReordering(javafx.scene.control.TableView<?> pTable, javafx.scene.control.TableView<?> pReorderingTable)
pTable
- The table which should be kept in sync.pReorderingTable
- The table for which the user will be able to reorder columns.public static <T> void linkSort(javafx.scene.control.TableView<?> pSrcTable, javafx.scene.control.TableView<T> pTargetTable)
public static com.sun.javafx.scene.control.skin.TableViewSkinBase getTableSkin(javafx.scene.control.TableView<?> pTable)
public static Object syncHorizontalScroll(javafx.collections.ObservableList<? extends javafx.scene.control.TableView<?>> pTables)
public static void ensureRowIsVisible(javafx.scene.control.TableView<?> pTable, int pRow)
public static <T> void selectPosition(javafx.scene.control.TableView<T> pTable, javafx.scene.control.TablePosition<T,?> pPos)
null
.public static void selectRow(javafx.scene.control.TableView<?> pTable, int pRow)
public static <S> void checkPositions(javafx.scene.control.TableView<S> pTable, javafx.scene.control.TablePosition<S,?> pFromPos, javafx.scene.control.TablePosition<S,?> pToPos)
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.public static <S> Stream<javafx.scene.control.TablePosition<S,?>> positionStream(javafx.scene.control.TableView<S> pTable, javafx.scene.control.TablePosition<S,?> pFromPos, javafx.scene.control.TablePosition<S,?> pToPos)
pFromPos
(inclusive) to
pToPos
(inclusive). If pFromPos
is greater than pToPos
,
the elements in the stream are provided in backward order.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.public static <S> javafx.scene.control.TablePosition<S,?> getFirstCellPos(javafx.scene.control.TableView<S> pTable)
null
if the table is empty or has no columns.public static <S> javafx.scene.control.TablePosition<S,?> getLastCellPos(javafx.scene.control.TableView<S> pTable)
null
if the table is empty or has no columns.public static <S> javafx.scene.control.TablePosition<S,?> prevPosition(javafx.scene.control.TableView<S> pTable, javafx.scene.control.TablePosition<S,?> pPos)
null
if there is no previous cell or if the specified position is null
.public static <S> javafx.scene.control.TablePosition<S,?> nextPosition(javafx.scene.control.TableView<S> pTable, javafx.scene.control.TablePosition<S,?> pPos)
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.public static int compare(javafx.scene.control.TablePositionBase<?> pPos1, javafx.scene.control.TablePositionBase<?> pPos2)
public static void embedContent(javafx.collections.ObservableList<? extends javafx.scene.control.TableColumn<?,?>> pColumns, javafx.scene.control.TableView<?> pTable)
public static void updateFocusedCellOnRightClick(javafx.scene.control.TableView<?> pTable)
public static <S> javafx.scene.control.TablePosition<S,?> getCellPositionByScenePosition(javafx.scene.control.TableView<S> pTable, double pSceneX, double pSceneY)
public static <S> javafx.scene.control.TableCell<S,?> getCellByScenePosition(javafx.scene.control.TableView<S> pTable, double pSceneX, double pSceneY)
public static <T> void addItemsListener(javafx.scene.control.TableView<T> pTable, javafx.beans.value.ChangeListener<? super javafx.collections.ObservableList<T>> pListener)
public static <S,T> javafx.scene.control.cell.TextFieldTableCell<S,T> createTextFieldTableCell(javafx.scene.control.TableView<S> pTable, javafx.util.StringConverter<T> pConverter)
public static <S,T> javafx.scene.control.cell.ComboBoxTableCell<S,T> createComboBoxTableCell(javafx.scene.control.TableView<S> pTable, javafx.util.StringConverter<T> pConverter, javafx.collections.ObservableList<T> pItems)
public static void addCtrlShiftSelectionRangeMode(javafx.scene.control.TableView<?> pTableView)
public static void preserveTableSelection(javafx.scene.control.TableView<?> pTable)
ObservableSortedList
is used as item list in the table.ObservableSortedList
public static <T> javafx.collections.ObservableList<T> getSelectedItems(javafx.scene.control.TableView<T> pTable)
public static <T> javafx.collections.ObservableList<T> getSelectedItems(javafx.collections.ObservableList<T> pSelectedItems)
public static <T> javafx.collections.ObservableList<T> getSelectedItems(javafx.beans.value.ObservableValue<? extends javafx.scene.control.TableSelectionModel<T>> pSelectionModelProperty)
Copyright © 2023. All rights reserved.