< prev index next >

modules/controls/src/main/java/javafx/scene/control/TreeTableView.java

Print this page




3480          *                                                                     *
3481          **********************************************************************/
3482 
3483         /**
3484          * Tests whether the row / cell at the given location currently has the
3485          * focus within the TableView.
3486          */
3487         @Override public boolean isFocused(int row, TreeTableColumn<S,?> column) {
3488             if (row < 0 || row >= getItemCount()) return false;
3489 
3490             TreeTablePosition<S,?> cell = getFocusedCell();
3491             boolean columnMatch = column == null || column.equals(cell.getTableColumn());
3492 
3493             return cell.getRow() == row && columnMatch;
3494         }
3495 
3496         /**
3497          * Causes the item at the given index to receive the focus. This does not
3498          * cause the current selection to change. Updates the focusedItem and
3499          * focusedIndex properties such that <code>focusedIndex = -1</code> unless
3500          * <pre><code>0 <= index < model size</code></pre>.
3501          *
3502          * @param index The index of the item to get focus.
3503          */
3504         @Override public void focus(int index) {
3505             if (treeTableView.expandedItemCountDirty) {
3506                 treeTableView.updateExpandedItemCount(treeTableView.getRoot());
3507             }
3508 
3509             if (index < 0 || index >= getItemCount()) {
3510                 setFocusedCell(EMPTY_CELL);
3511             } else {
3512                 setFocusedCell(new TreeTablePosition<>(treeTableView, index, null));
3513             }
3514         }
3515 
3516         /**
3517          * Attempts to move focus to the cell above the currently focused cell.
3518          */
3519         @Override public void focusAboveCell() {
3520             TreeTablePosition<S,?> cell = getFocusedCell();




3480          *                                                                     *
3481          **********************************************************************/
3482 
3483         /**
3484          * Tests whether the row / cell at the given location currently has the
3485          * focus within the TableView.
3486          */
3487         @Override public boolean isFocused(int row, TreeTableColumn<S,?> column) {
3488             if (row < 0 || row >= getItemCount()) return false;
3489 
3490             TreeTablePosition<S,?> cell = getFocusedCell();
3491             boolean columnMatch = column == null || column.equals(cell.getTableColumn());
3492 
3493             return cell.getRow() == row && columnMatch;
3494         }
3495 
3496         /**
3497          * Causes the item at the given index to receive the focus. This does not
3498          * cause the current selection to change. Updates the focusedItem and
3499          * focusedIndex properties such that <code>focusedIndex = -1</code> unless
3500          * <pre><code>0 &lt;= index &lt; model size</code></pre>.
3501          *
3502          * @param index The index of the item to get focus.
3503          */
3504         @Override public void focus(int index) {
3505             if (treeTableView.expandedItemCountDirty) {
3506                 treeTableView.updateExpandedItemCount(treeTableView.getRoot());
3507             }
3508 
3509             if (index < 0 || index >= getItemCount()) {
3510                 setFocusedCell(EMPTY_CELL);
3511             } else {
3512                 setFocusedCell(new TreeTablePosition<>(treeTableView, index, null));
3513             }
3514         }
3515 
3516         /**
3517          * Attempts to move focus to the cell above the currently focused cell.
3518          */
3519         @Override public void focusAboveCell() {
3520             TreeTablePosition<S,?> cell = getFocusedCell();


< prev index next >