Class TreeTableView.TreeTableViewFocusModel<S>
- javafx.scene.control.FocusModel<T>
-
- javafx.scene.control.TableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
- javafx.scene.control.TreeTableView.TreeTableViewFocusModel<S>
Enclosing class:
public static class TreeTableView.TreeTableViewFocusModel<S> extends TableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
FocusModel with additional functionality to support the requirements of a TableView control.Since:
JavaFX 8.0
See Also:
-
Property Summary
All MethodsInstance MethodsConcrete Methods Type Property and Description ReadOnlyObjectProperty<TreeTablePosition<S,?>>focusedCellThe position of the current item in the TableView which has the focus.-
Properties inherited from class javafx.scene.control.FocusModel
focusedIndex, focusedItem
-
-
Constructor Summary
Constructors Constructor and Description TreeTableViewFocusModel(TreeTableView<S> treeTableView)Creates a default TableViewFocusModel instance that will be used to manage focus of the provided TableView control.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description voidfocus(int index)Causes the item at the given index to receive the focus.voidfocus(int row, TreeTableColumn<S,?> column)Causes the item at the given index to receive the focus.voidfocus(TreeTablePosition<S,?> pos)Convenience method for setting focus on a particular row or cell using aTablePosition.voidfocusAboveCell()Attempts to move focus to the cell above the currently focused cell.voidfocusBelowCell()Attempts to move focus to the cell below the currently focused cell.ReadOnlyObjectProperty<TreeTablePosition<S,?>>focusedCellProperty()The position of the current item in the TableView which has the focus.voidfocusLeftCell()Attempts to move focus to the cell to the left of the currently focused cell.voidfocusNext()Attempts to give focus to the row after to the currently focused row.voidfocusPrevious()Attempts to give focus to the row previous to the currently focused row.voidfocusRightCell()Attempts to move focus to the cell to the right of the the currently focused cell.TreeTablePosition<S,?>getFocusedCell()Gets the value of the property focusedCell.protected intgetItemCount()Returns the number of items in the data model that underpins the control.protected TreeItem<S>getModelItem(int index)Returns the item at the given index.booleanisFocused(int row, TreeTableColumn<S,?> column)Tests whether the row / cell at the given location currently has the focus within the TableView.-
Methods inherited from class javafx.scene.control.FocusModel
focusedIndexProperty, focusedItemProperty, getFocusedIndex, getFocusedItem, isFocused
-
-
Property Detail
-
focusedCell
public final ReadOnlyObjectProperty<TreeTablePosition<S,?>> focusedCellProperty
The position of the current item in the TableView which has the focus.See Also:
-
-
Constructor Detail
-
TreeTableViewFocusModel
public TreeTableViewFocusModel(TreeTableView<S> treeTableView)
Creates a default TableViewFocusModel instance that will be used to manage focus of the provided TableView control.Parameters:
treeTableView- The tableView upon which this focus model operates.Throws:
NullPointerException- The TableView argument can not be null.
-
-
Method Detail
-
getItemCount
protected int getItemCount()
Returns the number of items in the data model that underpins the control. An example would be that a ListView focus model would likely returnlistView.getItems().size(). The valid range of focusable indices is between 0 and whatever is returned by this method.Specified by:
getItemCountin classFocusModel<TreeItem<S>>
-
getModelItem
protected TreeItem<S> getModelItem(int index)
Returns the item at the given index. An example using ListView would belistView.getItems().get(index).Specified by:
getModelItemin classFocusModel<TreeItem<S>>Parameters:
index- The index of the item that is requested from the underlying data model.Returns:
Returns null if the index is out of bounds, or an element of type T that is related to the given index.
-
focusedCellProperty
public final ReadOnlyObjectProperty<TreeTablePosition<S,?>> focusedCellProperty()
The position of the current item in the TableView which has the focus.See Also:
-
getFocusedCell
public final TreeTablePosition<S,?> getFocusedCell()
Gets the value of the property focusedCell.Property description:
The position of the current item in the TableView which has the focus.
-
focus
public void focus(int row, TreeTableColumn<S,?> column)Causes the item at the given index to receive the focus.Specified by:
focusin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>Parameters:
row- The row index of the item to give focus to.
-
focus
public void focus(TreeTablePosition<S,?> pos)
Convenience method for setting focus on a particular row or cell using aTablePosition.Parameters:
pos- The table position where focus should be set.
-
isFocused
public boolean isFocused(int row, TreeTableColumn<S,?> column)Tests whether the row / cell at the given location currently has the focus within the TableView.Specified by:
isFocusedin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
focus
public void focus(int index)
Causes the item at the given index to receive the focus. This does not cause the current selection to change. Updates the focusedItem and focusedIndex properties such thatfocusedIndex = -1unless0 <= index < model size
.Overrides:
focusin classFocusModel<TreeItem<S>>Parameters:
index- The index of the item to get focus.
-
focusAboveCell
public void focusAboveCell()
Attempts to move focus to the cell above the currently focused cell.Specified by:
focusAboveCellin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
focusBelowCell
public void focusBelowCell()
Attempts to move focus to the cell below the currently focused cell.Specified by:
focusBelowCellin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
focusLeftCell
public void focusLeftCell()
Attempts to move focus to the cell to the left of the currently focused cell.Specified by:
focusLeftCellin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
focusRightCell
public void focusRightCell()
Attempts to move focus to the cell to the right of the the currently focused cell.Specified by:
focusRightCellin classTableFocusModel<TreeItem<S>,TreeTableColumn<S,?>>
-
focusPrevious
public void focusPrevious()
Attempts to give focus to the row previous to the currently focused row. If the current focus owner is the first row, or is -1 (representing that there is no current focus owner), calling this method will have no result.Overrides:
focusPreviousin classFocusModel<TreeItem<S>>
-
focusNext
public void focusNext()
Attempts to give focus to the row after to the currently focused row. If the current focus owner is the last row, calling this method will have no result.Overrides:
focusNextin classFocusModel<TreeItem<S>>
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.