< prev index next >

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

Print this page

        

*** 105,128 **** * dictate what happens when the user resizes columns. * <li>Support for {@link #getSortOrder() multiple column sorting} by clicking * the column header (hold down Shift keyboard key whilst clicking on a * header to sort by multiple columns). * </ul> - * </p> * * <p>Note that TableView is intended to be used to visualize data - it is not * intended to be used for laying out your user interface. If you want to lay * your user interface out in a grid-like fashion, consider the * {@link javafx.scene.layout.GridPane} layout instead.</p> * * <h2>Creating a TableView</h2> * ! * <p>Creating a TableView is a multi-step process, and also depends on the * underlying data model needing to be represented. For this example we'll use * an ObservableList<Person>, as it is the simplest way of showing data in a * TableView. The <code>Person</code> class will consist of a first ! * name and last name properties. That is: * * <pre> * {@code * public class Person { * private StringProperty firstName; --- 105,128 ---- * dictate what happens when the user resizes columns. * <li>Support for {@link #getSortOrder() multiple column sorting} by clicking * the column header (hold down Shift keyboard key whilst clicking on a * header to sort by multiple columns). * </ul> * * <p>Note that TableView is intended to be used to visualize data - it is not * intended to be used for laying out your user interface. If you want to lay * your user interface out in a grid-like fashion, consider the * {@link javafx.scene.layout.GridPane} layout instead.</p> * * <h2>Creating a TableView</h2> * ! * <p> ! * {@literal Creating a TableView is a multi-step process, and also depends on the * underlying data model needing to be represented. For this example we'll use * an ObservableList<Person>, as it is the simplest way of showing data in a * TableView. The <code>Person</code> class will consist of a first ! * name and last name properties. That is:} * * <pre> * {@code * public class Person { * private StringProperty firstName;
*** 146,158 **** * * <pre> * {@code * TableView<Person> table = new TableView<Person>();}</pre> * * <p>With the basic table defined, we next focus on the data model. As mentioned, * for this example, we'll be using a ObservableList<Person>. We can immediately ! * set such a list directly in to the TableView, as such: * * <pre> * {@code * ObservableList<Person> teamMembers = getTeamMembers(); * table.setItems(teamMembers);}</pre> --- 146,159 ---- * * <pre> * {@code * TableView<Person> table = new TableView<Person>();}</pre> * + * {@literal * <p>With the basic table defined, we next focus on the data model. As mentioned, * for this example, we'll be using a ObservableList<Person>. We can immediately ! * set such a list directly in to the TableView, as such:} * * <pre> * {@code * ObservableList<Person> teamMembers = getTeamMembers(); * table.setItems(teamMembers);}</pre>
*** 832,841 **** --- 833,843 ---- // --- Items /** * The underlying data model for the TableView. Note that it has a generic * type that must match the type of the TableView itself. + * @return the items property */ public final ObjectProperty<ObservableList<S>> itemsProperty() { return items; } private ObjectProperty<ObservableList<S>> items = new SimpleObjectProperty<ObservableList<S>>(this, "items") { WeakReference<ObservableList<S>> oldItemsRef;
*** 866,875 **** --- 868,878 ---- /** * This controls whether a menu button is available when the user clicks * in a designated space within the TableView, within which is a radio menu * item for each TableColumn in this table. This menu allows for the user to * show and hide all TableColumns easily. + * @return the tableMenuButtonVisible property */ public final BooleanProperty tableMenuButtonVisibleProperty() { if (tableMenuButtonVisible == null) { tableMenuButtonVisible = new SimpleBooleanProperty(this, "tableMenuButtonVisible"); }
*** 895,904 **** --- 898,908 ---- /** * This is the function called when the user completes a column-resize * operation. The two most common policies are available as static functions * in the TableView class: {@link #UNCONSTRAINED_RESIZE_POLICY} and * {@link #CONSTRAINED_RESIZE_POLICY}. + * @return columnResizePolicy property */ public final ObjectProperty<Callback<ResizeFeatures, Boolean>> columnResizePolicyProperty() { if (columnResizePolicy == null) { columnResizePolicy = new SimpleObjectProperty<Callback<ResizeFeatures, Boolean>>(this, "columnResizePolicy", UNCONSTRAINED_RESIZE_POLICY) { private Callback<ResizeFeatures, Boolean> oldPolicy;
*** 939,948 **** --- 943,953 ---- * instances would most probably be to introduce some form of column * spanning support. * <p> * You can create custom TableCell instances per column by assigning the * appropriate function to the cellFactory property in the TableColumn class. + * @return rowFactory property */ public final ObjectProperty<Callback<TableView<S>, TableRow<S>>> rowFactoryProperty() { if (rowFactory == null) { rowFactory = new SimpleObjectProperty<Callback<TableView<S>, TableRow<S>>>(this, "rowFactory"); }
*** 962,971 **** --- 967,977 ---- * This Node is shown to the user when the table has no content to show. * This may be the case because the table model has no data in the first * place, that a filter has been applied to the table model, resulting * in there being nothing to show the user, or that there are no currently * visible columns. + * @return placeholder property */ public final ObjectProperty<Node> placeholderProperty() { if (placeholder == null) { placeholder = new SimpleObjectProperty<Node>(this, "placeholder"); }
*** 1008,1017 **** --- 1014,1024 ---- /** * The SelectionModel provides the API through which it is possible * to select single or multiple items within a TableView, as well as inspect * which items have been selected by the user. Note that it has a generic * type that must match the type of the TableView itself. + * @return selectionModel property */ public final ObjectProperty<TableViewSelectionModel<S>> selectionModelProperty() { return selectionModel; } public final void setSelectionModel(TableViewSelectionModel<S> value) {
*** 1033,1042 **** --- 1040,1050 ---- } /** * Represents the currently-installed {@link TableViewFocusModel} for this * TableView. Under almost all circumstances leaving this as the default * focus model will suffice. + * @return focusModel property */ public final ObjectProperty<TableViewFocusModel<S>> focusModelProperty() { if (focusModel == null) { focusModel = new SimpleObjectProperty<TableViewFocusModel<S>>(this, "focusModel"); }
*** 1079,1088 **** --- 1087,1097 ---- } /** * Specifies whether this TableView is editable - only if the TableView, the * TableColumn (if applicable) and the TableCells within it are both * editable will a TableCell be able to go into their editing state. + * @return the editable property */ public final BooleanProperty editableProperty() { if (editable == null) { editable = new SimpleBooleanProperty(this, "editable", false); }
*** 1136,1145 **** --- 1145,1155 ---- * only size (thus allowing for variable cell sizes, and preventing the * performance gains from being possible). Therefore, when performance matters * use -fx-fixed-cell-size, instead of -fx-cell-size. If both properties are * specified in CSS, -fx-fixed-cell-size takes precedence.</p> * + * @return fixedCellSize property * @since JavaFX 8.0 */ public final DoubleProperty fixedCellSizeProperty() { if (fixedCellSize == null) { fixedCellSize = new StyleableDoubleProperty(Region.USE_COMPUTED_SIZE) {
*** 1170,1179 **** --- 1180,1190 ---- } /** * Represents the current cell being edited, or null if * there is no cell being edited. + * @return the editingCell property */ public final ReadOnlyObjectProperty<TablePosition<S,?>> editingCellProperty() { return editingCellPropertyImpl().getReadOnlyProperty(); }
*** 1301,1310 **** --- 1312,1322 ---- * the TableView columns, this list will be updated to reflect the current * visual ordering. * * <p>Note: to display any data in a TableView, there must be at least one * TableColumn in this ObservableList.</p> + * @return the columns */ public final ObservableList<TableColumn<S,?>> getColumns() { return columns; }
*** 1449,1458 **** --- 1461,1473 ---- } /** * Applies the currently installed resize policy against the given column, * resizing it based on the delta value provided. + * @param column the column + * @param delta the delta + * @return true if column resize is allowed */ public boolean resizeColumn(TableColumn<S,?> column, double delta) { if (column == null || Double.compare(delta, 0.0) == 0) return false; boolean allowed = getColumnResizePolicy().call(new ResizeFeatures<S>(TableView.this, column, delta));
*** 1466,1475 **** --- 1481,1492 ---- * its editing state, if it is not already in it, and assuming that the * TableView and column are also editable. * * <p><strong>Note:</strong> This method will cancel editing if the given row * value is less than zero and the given column is null.</p> + * @param row the row + * @param column the column */ public void edit(int row, TableColumn<S,?> column) { if (!isEditable() || (column != null && ! column.isEditable())) { return; }
*** 1481,1506 **** --- 1498,1530 ---- } } /** * Returns an unmodifiable list containing the currently visible leaf columns. + * @return an unmodifiable list containing the currently visible leaf columns */ public ObservableList<TableColumn<S,?>> getVisibleLeafColumns() { return unmodifiableVisibleLeafColumns; } /** * Returns the position of the given column, relative to all other * visible leaf columns. + * @param column the column + * @return the position of the given column, relative to all other + * visible leaf columns */ public int getVisibleLeafIndex(TableColumn<S,?> column) { return visibleLeafColumns.indexOf(column); } /** * Returns the TableColumn in the given column index, relative to all other * visible leaf columns. + * @param column the column + * @return the TableColumn in the given column index, relative to all other + * visible leaf columns */ public TableColumn<S,?> getVisibleLeafColumn(int column) { if (column < 0 || column >= visibleLeafColumns.size()) return null; return visibleLeafColumns.get(column); }
*** 1823,1832 **** --- 1847,1857 ---- return (TableColumn<S,?>) super.getColumn(); } /** * Returns the TableView upon which the resize operation is occurring. + * @return the TableView */ public TableView<S> getTable() { return table; } }
*** 1890,1899 **** --- 1915,1926 ---- /** * A read-only ObservableList representing the currently selected cells * in this TableView. Rather than directly modify this list, please * use the other methods provided in the TableViewSelectionModel. + * @return a read-only ObservableList representing the currently + * selected cells in this TableView */ public abstract ObservableList<TablePosition> getSelectedCells(); /***********************************************************************
*** 1909,1918 **** --- 1936,1948 ---- } /** * Convenience function which tests whether the given row and column index * is currently selected in this table instance. + * @param row the row + * @param column the column + * @return true if row and column index is currently selected */ public abstract boolean isSelected(int row, TableColumn<S, ?> column); // --- select
*** 1921,1930 **** --- 1951,1962 ---- select(row, (TableColumn<S,?>)column); } /** * Selects the cell at the given row/column intersection. + * @param row the row + * @param column the column */ public abstract void select(int row, TableColumn<S, ?> column); // --- clearAndSelect
*** 1934,1943 **** --- 1966,1977 ---- } /** * Clears all selection, and then selects the cell at the given row/column * intersection. + * @param row the row + * @param column the column */ public abstract void clearAndSelect(int row, TableColumn<S,?> column); // --- clearSelection
*** 1948,1957 **** --- 1982,1993 ---- /** * Removes selection from the specified row/column position (in view indexes). * If this particular cell (or row if the column value is -1) is not selected, * nothing happens. + * @param row the row + * @param column the column */ public abstract void clearSelection(int row, TableColumn<S, ?> column); /** {@inheritDoc} */ @Override public void selectRange(int minRow, TableColumnBase<S,?> minColumn,
*** 1973,1982 **** --- 2009,2019 ---- * * **********************************************************************/ /** * Returns the TableView instance that this selection model is installed in. + * @return the TableView */ public TableView<S> getTableView() { return tableView; }
*** 3216,3226 **** /** * 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 that <code>focusedIndex = -1</code> unless ! * <pre><code>0 <= index < model size</code></pre>. * * @param index The index of the item to get focus. */ @Override public void focus(int index) { if (index < 0 || index >= getItemCount()) { --- 3253,3263 ---- /** * 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 that <code>focusedIndex = -1</code> unless ! * <pre><code>0 &lt;= index &lt; model size</code></pre>. * * @param index The index of the item to get focus. */ @Override public void focus(int index) { if (index < 0 || index >= getItemCount()) {
< prev index next >