1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.control;
  27 
  28 /**
  29  * The abstract base class for FocusModel implementations that are used within
  30  * table-like controls (most notably {@link TableView} and {@link TreeTableView}.
  31  *
  32  * @param <T> The type of the underlying data model for the UI control.
  33  * @param <TC> The concrete subclass of {@link TableColumnBase} that is used by the
  34  *      underlying UI control (e.g. {@link TableColumn} or {@link TreeTableColumn}.
  35  * @since JavaFX 8.0
  36  */
  37 public abstract class TableFocusModel<T, TC extends TableColumnBase<T,?>> extends FocusModel<T> {
  38 
  39     /***********************************************************************
  40      *                                                                     *
  41      * Public API                                                          *
  42      *                                                                     *
  43      **********************************************************************/
  44 
  45     /**
  46      * Causes the item at the given index to receive the focus.
  47      *
  48      * @param row The row index of the item to give focus to.
  49      * @param column The column of the item to give focus to. Can be null.
  50      */
  51     public abstract void focus(int row, TC column);
  52 
  53     /**
  54      * Tests whether the row / cell at the given location currently has the
  55      * focus within the UI control.
  56      * @param row the row
  57      * @param column the column
  58      * @return true if the row / cell at the given location currently has the
  59      * focus within the UI control
  60      */
  61     public abstract boolean isFocused(int row, TC column);
  62 
  63     /**
  64      * Attempts to move focus to the cell above the currently focused cell.
  65      */
  66     public abstract void focusAboveCell();
  67 
  68     /**
  69      * Attempts to move focus to the cell below the currently focused cell.
  70      */
  71     public abstract void focusBelowCell();
  72 
  73     /**
  74      * Attempts to move focus to the cell to the left of the currently focused cell.
  75      */
  76     public abstract void focusLeftCell();
  77 
  78     /**
  79      * Attempts to move focus to the cell to the right of the the currently focused cell.
  80      */
  81     public abstract void focusRightCell();
  82 
  83 
  84 
  85      /***********************************************************************
  86      *                                                                     *
  87      * Private Implementation                                              *
  88      *                                                                     *
  89      **********************************************************************/
  90 
  91 }