Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.scene.control; 027 028import javafx.beans.property.BooleanProperty; 029import javafx.beans.property.SimpleBooleanProperty; 030 031/** 032 * The abstract base class for MultipleSelectionModel implementations that are used within 033 * table-like controls (most notably {@link TableView} and {@link TreeTableView}. 034 * 035 * @param <T> The type of the underlying data model for the UI control. 036 * @param <TC> The concrete subclass of {@link TableColumnBase} that is used by the 037 * underlying UI control (e.g. {@link TableColumn} or {@link TreeTableColumn}. 038 */ 039public abstract class TableSelectionModel<T, TC extends TableColumnBase<T,?>> extends MultipleSelectionModelBase<T> { 040 041 /** 042 * Convenience function which tests whether the given row and column index 043 * is currently selected in this table instance. 044 */ 045 public abstract boolean isSelected(int row, TC column); 046 047 /** 048 * Selects the cell at the given row/column intersection. 049 */ 050 public abstract void select(int row, TC column); 051 052 /** 053 * Clears all selection, and then selects the cell at the given row/column 054 * intersection. 055 */ 056 public abstract void clearAndSelect(int row, TC column); 057 058 /** 059 * Removes selection from the specified row/column position (in view indexes). 060 * If this particular cell (or row if the column value is -1) is not selected, 061 * nothing happens. 062 */ 063 public abstract void clearSelection(int row, TC column); 064 065 /** 066 * Selects the cell to the left of the currently selected cell. 067 */ 068 public abstract void selectLeftCell(); 069 070 /** 071 * Selects the cell to the right of the currently selected cell. 072 */ 073 public abstract void selectRightCell(); 074 075 /** 076 * Selects the cell directly above the currently selected cell. 077 */ 078 public abstract void selectAboveCell(); 079 080 /** 081 * Selects the cell directly below the currently selected cell. 082 */ 083 public abstract void selectBelowCell(); 084 085 /** 086 * A boolean property used to represent whether the table is in 087 * row or cell selection modes. By default a table is in row selection 088 * mode which means that individual cells can not be selected. Setting 089 * <code>cellSelectionEnabled</code> to be true results in cells being 090 * able to be selected (but not rows). 091 */ 092 private BooleanProperty cellSelectionEnabled = 093 new SimpleBooleanProperty(this, "cellSelectionEnabled"); 094 public final BooleanProperty cellSelectionEnabledProperty() { 095 return cellSelectionEnabled; 096 } 097 public final void setCellSelectionEnabled(boolean value) { 098 cellSelectionEnabledProperty().set(value); 099 } 100 public final boolean isCellSelectionEnabled() { 101 return cellSelectionEnabled == null ? false : cellSelectionEnabled.get(); 102 } 103}