changeset 4223:53ab58d87489

RT-30593: TableView.TableViewSelectionModel changes in Lombard are not back compatible with previous versions
author jgiles
date Wed, 10 Jul 2013 10:14:04 +1200
parents fad6a5daeb8f
children 1365d109fccb
files modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehavior.java modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java modules/controls/src/main/java/javafx/scene/control/TableSelectionModel.java modules/controls/src/main/java/javafx/scene/control/TableView.java modules/controls/src/main/java/javafx/scene/control/TreeTableView.java
diffstat 6 files changed, 29 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehavior.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehavior.java	Wed Jul 10 10:14:04 2013 +1200
@@ -117,7 +117,7 @@
     }
 
     /** {@inheritDoc}  */
-    @Override protected TableSelectionModel<T, TableColumn<T, ?>> getSelectionModel() {
+    @Override protected TableSelectionModel<T> getSelectionModel() {
         return getControl().getSelectionModel();
     }
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java	Wed Jul 10 10:14:04 2013 +1200
@@ -320,7 +320,7 @@
      * Returns the selection model for the underlying UI control (which must extend
      * from TableSelectionModel).
      */
-    protected abstract TableSelectionModel<T,TC> getSelectionModel();
+    protected abstract TableSelectionModel<T> getSelectionModel();
     
     /**
      * Returns an observable list of all cells that are currently selected in
@@ -450,7 +450,7 @@
      *************************************************************************/ 
     
     protected void scrollUp() {
-        TableSelectionModel<T,TC> sm = getSelectionModel();
+        TableSelectionModel<T> sm = getSelectionModel();
         if (sm == null || getSelectedCells().isEmpty()) return;
         
         TablePositionBase<TC> selectedCell = getSelectedCells().get(0);
@@ -465,7 +465,7 @@
     }
 
     protected void scrollDown() {
-        TableSelectionModel<T,TC> sm = getSelectionModel();
+        TableSelectionModel<T> sm = getSelectionModel();
         if (sm == null || getSelectedCells().isEmpty()) return;
         
         TablePositionBase<TC> selectedCell = getSelectedCells().get(0);
@@ -587,7 +587,7 @@
     }
     
     protected void clearSelectionOutsideRange(int start, int end) {
-        TableSelectionModel<T,?> sm = getSelectionModel();
+        TableSelectionModel<T> sm = getSelectionModel();
         if (sm == null) return;
         
         int min = Math.min(start, end);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java	Wed Jul 10 10:14:04 2013 +1200
@@ -131,7 +131,7 @@
     }
 
     /** {@inheritDoc}  */
-    @Override protected TableSelectionModel<TreeItem<T>, TreeTableColumn<T, ?>> getSelectionModel() {
+    @Override protected TableSelectionModel<TreeItem<T>> getSelectionModel() {
         return getControl().getSelectionModel();
     }
 
--- a/modules/controls/src/main/java/javafx/scene/control/TableSelectionModel.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/javafx/scene/control/TableSelectionModel.java	Wed Jul 10 10:14:04 2013 +1200
@@ -33,35 +33,33 @@
  * table-like controls (most notably {@link TableView} and {@link TreeTableView}.
  * 
  * @param <T> The type of the underlying data model for the UI control.
- * @param <TC> The concrete subclass of {@link TableColumnBase} that is used by the
- *      underlying UI control (e.g. {@link TableColumn} or {@link TreeTableColumn}.
  * @since JavaFX 8.0
  */
-public abstract class TableSelectionModel<T, TC extends TableColumnBase<T,?>> extends MultipleSelectionModelBase<T> {
+public abstract class TableSelectionModel<T> extends MultipleSelectionModelBase<T> {
     
     /**
      * Convenience function which tests whether the given row and column index
      * is currently selected in this table instance.
      */
-    public abstract boolean isSelected(int row, TC column);
+    public abstract boolean isSelected(int row, TableColumnBase<T,?> column);
 
     /**
      * Selects the cell at the given row/column intersection.
      */
-    public abstract void select(int row, TC column);
+    public abstract void select(int row, TableColumnBase<T,?> column);
 
     /**
      * Clears all selection, and then selects the cell at the given row/column
      * intersection.
      */
-    public abstract void clearAndSelect(int row, TC column);
+    public abstract void clearAndSelect(int row, TableColumnBase<T,?> column);
 
     /**
      * 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.
      */
-    public abstract void clearSelection(int row, TC column);
+    public abstract void clearSelection(int row, TableColumnBase<T,?> column);
 
     /**
      * Selects the cell to the left of the currently selected cell.
--- a/modules/controls/src/main/java/javafx/scene/control/TableView.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/javafx/scene/control/TableView.java	Wed Jul 10 10:14:04 2013 +1200
@@ -1512,7 +1512,7 @@
      * allow for special support for TableView controls.
      * @since JavaFX 2.0
      */
-    public static abstract class TableViewSelectionModel<S> extends TableSelectionModel<S, TableColumn<S,?>> {
+    public static abstract class TableViewSelectionModel<S> extends TableSelectionModel<S> {
 
         /***********************************************************************
          *                                                                     *
@@ -1579,7 +1579,7 @@
          * Convenience method that returns getTableView().getItems().
          * @return The items list of the current TableView.
          */
-        protected ObservableList<S> getTableModel()  {
+        protected List<S> getTableModel()  {
             return tableView.getItems();
         }
 
@@ -1796,7 +1796,7 @@
             tableView.itemsProperty().addListener(weakItemsPropertyListener);
             
             // watching for changes to the items list content
-            ObservableList<S> items = getTableModel();
+            ObservableList<S> items = getTableView().getItems();//getTableModel();
             if (items != null) {
                 items.addListener(weakItemsContentListener);
             }
--- a/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Tue Jul 09 15:40:41 2013 +1200
+++ b/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java	Wed Jul 10 10:14:04 2013 +1200
@@ -207,7 +207,7 @@
  * normal JavaBean properties too, although there is a caveat to this, so refer 
  * to the class documentation for more information). When this is not the case, 
  * it is necessary to provide a custom cell value factory. More information
- * about cell value factories can be found in the {@link TreeTableColumns} API 
+ * about cell value factories can be found in the {@link TreeTableColumn} API
  * documentation, but briefly, here is how a TreeTableColumns could be specified:
  * 
  * <pre>
@@ -259,7 +259,7 @@
  * 
  * <p>You can create custom {@link TreeTableCell} instances per column by assigning 
  * the appropriate function to the TreeTableColumns
- * {@link TreeTableColumns#cellFactoryProperty() cell factory} property.
+ * {@link TreeTableColumn#cellFactoryProperty() cell factory} property.
  * 
  * <p>See the {@link Cell} class documentation for a more complete
  * description of how to write custom Cells.
@@ -1457,7 +1457,7 @@
      * Instructs the TreeTableView to begin editing the given TreeItem, if 
      * the TreeTableView is {@link #editableProperty() editable}. Once
      * this method is called, if the current 
-     * {@link #cellFactoryProperty() cell factory} is set up to support editing,
+     * {@link javafx.scene.control.TreeTableColumn#cellFactoryProperty()} cell factory} is set up to support editing,
      * the Cell will switch its visual state to enable the user input to take place.
      * 
      * @param item The TreeItem in the TreeTableView that should be edited.
@@ -1916,7 +1916,7 @@
          * TreeTableColumn and delta values being set and stored in this immutable
          * instance.
          * 
-         * @param table The TreeTableView upon which the resize operation is occurring.
+         * @param treeTable The TreeTableView upon which the resize operation is occurring.
          * @param column The column upon which the resize is occurring, or null
          *      if this ResizeFeatures instance is being created as a result of a
          *      TreeTableView resize operation.
@@ -2018,8 +2018,8 @@
      * allow for special support for TableView controls.
      * @since JavaFX 8.0
      */
-    public static abstract class TreeTableViewSelectionModel<S> extends 
-            TableSelectionModel<TreeItem<S>, TreeTableColumn<S, ?>> {
+    public static abstract class TreeTableViewSelectionModel<S> extends
+            TableSelectionModel<TreeItem<S>> {
 
         /***********************************************************************
          *                                                                     *
@@ -2040,7 +2040,7 @@
         /**
          * Builds a default TableViewSelectionModel instance with the provided
          * TableView.
-         * @param tableView The TableView upon which this selection model should
+         * @param treeTableView The TableView upon which this selection model should
          *      operate.
          * @throws NullPointerException TableView can not be null.
          */
@@ -2451,7 +2451,7 @@
             clearAndSelect(row, null);
         }
 
-        @Override public void clearAndSelect(int row, TreeTableColumn<S,?> column) {
+        @Override public void clearAndSelect(int row, TableColumnBase column) {
             quietClearSelection();
             select(row, column);
         }
@@ -2460,7 +2460,7 @@
             select(row, null);
         }
 
-        @Override public void select(int row, TreeTableColumn<S,?> column) {
+        @Override public void select(int row, TableColumnBase column) {
             // TODO we need to bring in the TreeView selection stuff here...
             if (row < 0 || row >= getRowCount()) return;
 
@@ -2472,7 +2472,7 @@
 //            // if a column is given, I return
 //            if (! isCellSelectionEnabled() && column != null) return;
 
-            TreeTablePosition pos = new TreeTablePosition(getTreeTableView(), row, column);
+            TreeTablePosition pos = new TreeTablePosition(getTreeTableView(), row, (TreeTableColumn)column);
             
             if (! selectedCells.contains(pos)) {
                 if (getSelectionMode() == SelectionMode.SINGLE) {
@@ -2483,7 +2483,7 @@
 
 //            setSelectedIndex(row);
             updateSelectedIndex(row);
-            focus(row, column);
+            focus(row, (TreeTableColumn)column);
             
             int changeIndex = selectedCellsSeq.indexOf(pos);
             selectedCellsSeq.callObservers(new NonIterableChange.SimpleAddChange<TreeTablePosition<S,?>>(changeIndex, changeIndex+1, selectedCellsSeq));
@@ -2649,8 +2649,8 @@
             clearSelection(index, null);
         }
 
-        @Override public void clearSelection(int row, TreeTableColumn<S,?> column) {
-            TreeTablePosition tp = new TreeTablePosition(getTreeTableView(), row, column);
+        @Override public void clearSelection(int row, TableColumnBase column) {
+            TreeTablePosition tp = new TreeTablePosition(getTreeTableView(), row, (TreeTableColumn)column);
 
             boolean csMode = isCellSelectionEnabled();
             
@@ -2680,7 +2680,7 @@
             return isSelected(index, null);
         }
 
-        @Override public boolean isSelected(int row, TreeTableColumn<S,?> column) {
+        @Override public boolean isSelected(int row, TableColumnBase column) {
             // When in cell selection mode, we currently do NOT support selecting
             // entire rows, so a isSelected(row, null) 
             // should always return false.
@@ -2894,7 +2894,7 @@
          * Creates a default TableViewFocusModel instance that will be used to
          * manage focus of the provided TableView control.
          * 
-         * @param tableView The tableView upon which this focus model operates.
+         * @param treeTableView The tableView upon which this focus model operates.
          * @throws NullPointerException The TableView argument can not be null.
          */
         public TreeTableViewFocusModel(final TreeTableView<S> treeTableView) {