26 package javafx.scene.control; 27 28 import javafx.beans.property.BooleanProperty; 29 import javafx.beans.property.SimpleBooleanProperty; 30 31 /** 32 * The abstract base class for MultipleSelectionModel implementations that are used within 33 * table-like controls (most notably {@link TableView} and {@link TreeTableView}. 34 * 35 * @param <T> The type of the underlying data model for the UI control. 36 * @since JavaFX 8.0 37 */ 38 public abstract class TableSelectionModel<T> extends MultipleSelectionModelBase<T> { 39 40 /** 41 * Convenience function which tests whether the given row and column index 42 * is currently selected in this table instance. If the table control is in its 43 * 'cell selection' mode (where individual cells can be selected, rather than 44 * entire rows), and if the column argument is null, this method should return 45 * true only if all cells in the given row are selected. 46 */ 47 public abstract boolean isSelected(int row, TableColumnBase<T,?> column); 48 49 /** 50 * Selects the cell at the given row/column intersection. If the table control is in its 51 * 'cell selection' mode (where individual cells can be selected, rather than 52 * entire rows), and if the column argument is null, this method should select 53 * all cells in the given row. 54 */ 55 public abstract void select(int row, TableColumnBase<T,?> column); 56 57 /** 58 * Clears all selection, and then selects the cell at the given row/column 59 * intersection. If the table control is in its 60 * 'cell selection' mode (where individual cells can be selected, rather than 61 * entire rows), and if the column argument is null, this method should select 62 * all cells in the given row. 63 */ 64 public abstract void clearAndSelect(int row, TableColumnBase<T,?> column); 65 66 /** 67 * Removes selection from the specified row/column position (in view indexes). 68 * If this particular cell (or row if the column value is -1) is not selected, 69 * nothing happens. If the table control is in its 70 * 'cell selection' mode (where individual cells can be selected, rather than 71 * entire rows), and if the column argument is null, this method should deselect 72 * all cells in the given row. 73 */ 74 public abstract void clearSelection(int row, TableColumnBase<T,?> column); 75 76 /** 77 * Selects the cell to the left of the currently selected cell. 78 */ 79 public abstract void selectLeftCell(); 80 81 /** 82 * Selects the cell to the right of the currently selected cell. 83 */ 84 public abstract void selectRightCell(); 85 86 /** 87 * Selects the cell directly above the currently selected cell. 88 */ 89 public abstract void selectAboveCell(); 90 91 /** 92 * Selects the cell directly below the currently selected cell. 93 */ 94 public abstract void selectBelowCell(); 95 96 /** 97 * Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), 98 * inclusive. 99 */ 100 public abstract void selectRange(int minRow, TableColumnBase<T,?> minColumn, 101 int maxRow, TableColumnBase<T,?> maxColumn); 102 103 /** 104 * A boolean property used to represent whether the table is in 105 * row or cell selection modes. By default a table is in row selection 106 * mode which means that individual cells can not be selected. Setting 107 * <code>cellSelectionEnabled</code> to be true results in cells being 108 * able to be selected (but not rows). 109 */ 110 private BooleanProperty cellSelectionEnabled = 111 new SimpleBooleanProperty(this, "cellSelectionEnabled"); 112 public final BooleanProperty cellSelectionEnabledProperty() { 113 return cellSelectionEnabled; 114 } 115 public final void setCellSelectionEnabled(boolean value) { 116 cellSelectionEnabledProperty().set(value); 117 } 118 public final boolean isCellSelectionEnabled() { | 26 package javafx.scene.control; 27 28 import javafx.beans.property.BooleanProperty; 29 import javafx.beans.property.SimpleBooleanProperty; 30 31 /** 32 * The abstract base class for MultipleSelectionModel implementations that are used within 33 * table-like controls (most notably {@link TableView} and {@link TreeTableView}. 34 * 35 * @param <T> The type of the underlying data model for the UI control. 36 * @since JavaFX 8.0 37 */ 38 public abstract class TableSelectionModel<T> extends MultipleSelectionModelBase<T> { 39 40 /** 41 * Convenience function which tests whether the given row and column index 42 * is currently selected in this table instance. If the table control is in its 43 * 'cell selection' mode (where individual cells can be selected, rather than 44 * entire rows), and if the column argument is null, this method should return 45 * true only if all cells in the given row are selected. 46 * @param row the row 47 * @param column the column 48 * @return true if the given row and column index is currently selected in 49 * this table instance 50 */ 51 public abstract boolean isSelected(int row, TableColumnBase<T,?> column); 52 53 /** 54 * Selects the cell at the given row/column intersection. If the table control is in its 55 * 'cell selection' mode (where individual cells can be selected, rather than 56 * entire rows), and if the column argument is null, this method should select 57 * all cells in the given row. 58 * @param row the row 59 * @param column the column 60 */ 61 public abstract void select(int row, TableColumnBase<T,?> column); 62 63 /** 64 * Clears all selection, and then selects the cell at the given row/column 65 * intersection. If the table control is in its 66 * 'cell selection' mode (where individual cells can be selected, rather than 67 * entire rows), and if the column argument is null, this method should select 68 * all cells in the given row. 69 * @param row the row 70 * @param column the column 71 */ 72 public abstract void clearAndSelect(int row, TableColumnBase<T,?> column); 73 74 /** 75 * Removes selection from the specified row/column position (in view indexes). 76 * If this particular cell (or row if the column value is -1) is not selected, 77 * nothing happens. If the table control is in its 78 * 'cell selection' mode (where individual cells can be selected, rather than 79 * entire rows), and if the column argument is null, this method should deselect 80 * all cells in the given row. 81 * @param row the row 82 * @param column the column 83 */ 84 public abstract void clearSelection(int row, TableColumnBase<T,?> column); 85 86 /** 87 * Selects the cell to the left of the currently selected cell. 88 */ 89 public abstract void selectLeftCell(); 90 91 /** 92 * Selects the cell to the right of the currently selected cell. 93 */ 94 public abstract void selectRightCell(); 95 96 /** 97 * Selects the cell directly above the currently selected cell. 98 */ 99 public abstract void selectAboveCell(); 100 101 /** 102 * Selects the cell directly below the currently selected cell. 103 */ 104 public abstract void selectBelowCell(); 105 106 /** 107 * Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), 108 * inclusive. 109 * @param minRow the minRow 110 * @param minColumn the minColumn 111 * @param maxRow the maxRow 112 * @param maxColumn the maxColumn 113 */ 114 public abstract void selectRange(int minRow, TableColumnBase<T,?> minColumn, 115 int maxRow, TableColumnBase<T,?> maxColumn); 116 117 /** 118 * A boolean property used to represent whether the table is in 119 * row or cell selection modes. By default a table is in row selection 120 * mode which means that individual cells can not be selected. Setting 121 * <code>cellSelectionEnabled</code> to be true results in cells being 122 * able to be selected (but not rows). 123 */ 124 private BooleanProperty cellSelectionEnabled = 125 new SimpleBooleanProperty(this, "cellSelectionEnabled"); 126 public final BooleanProperty cellSelectionEnabledProperty() { 127 return cellSelectionEnabled; 128 } 129 public final void setCellSelectionEnabled(boolean value) { 130 cellSelectionEnabledProperty().set(value); 131 } 132 public final boolean isCellSelectionEnabled() { |