changeset 2325:83a8d540e79d

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/scrum/controls/jfx/rt
author jgiles
date Sat, 19 Jan 2013 10:08:14 +1300
parents 18bb34950eab ee8242e75018
children b11de5fd3149 64e0643de066
files
diffstat 6 files changed, 61 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Sat Jan 19 10:08:14 2013 +1300
@@ -168,8 +168,6 @@
                         return;
                     }
                 }
-                
-                textField.fireEvent(t);
             }
         });
         
--- a/javafx-ui-controls/src/javafx/scene/control/IndexedCell.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/IndexedCell.java	Sat Jan 19 10:08:14 2013 +1300
@@ -25,7 +25,9 @@
 
 package javafx.scene.control;
 
+import java.util.Set;
 import javafx.css.PseudoClass;
+import com.sun.javafx.css.StyleManager;
 import javafx.beans.property.ReadOnlyIntegerProperty;
 import javafx.beans.property.ReadOnlyIntegerWrapper;
 
@@ -111,9 +113,16 @@
      */
     public void updateIndex(int i) { 
         index.set(i);
+        indexChanged();
     }
     
-    
+    /** 
+     * This method is called whenever the index is changed, regardless of whether
+     * the new index is the same as the old index. 
+     */
+    void indexChanged() { 
+        // no-op
+    }
     
     /* *************************************************************************
      *                                                                         *
--- a/javafx-ui-controls/src/javafx/scene/control/ListCell.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/ListCell.java	Sat Jan 19 10:08:14 2013 +1300
@@ -79,7 +79,6 @@
      */
     public ListCell() {
         getStyleClass().addAll(DEFAULT_STYLE_CLASS);
-        indexProperty().addListener(indexListener);
     }
 
 
@@ -94,14 +93,6 @@
      *     or items).                                                          *
      *                                                                         *
      **************************************************************************/
-    
-    private final InvalidationListener indexListener = new InvalidationListener() {
-        @Override public void invalidated(Observable valueModel) {
-            updateItem();
-            updateSelection();
-            updateFocus();
-        }
-    };
 
     /**
      * Listens to the editing index on the ListView. It is possible for the developer
@@ -303,6 +294,14 @@
      **************************************************************************/
     
     /** {@inheritDoc} */
+    @Override void indexChanged() {
+        super.indexChanged();
+        updateItem();
+        updateSelection();
+        updateFocus();
+    }
+
+    /** {@inheritDoc} */
     @Override protected Skin<?> createDefaultSkin() {
         return new ListCellSkin(this);
     }
--- a/javafx-ui-controls/src/javafx/scene/control/TableCell.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TableCell.java	Sat Jan 19 10:08:14 2013 +1300
@@ -70,7 +70,7 @@
      */
     public TableCell() {
         getStyleClass().addAll(DEFAULT_STYLE_CLASS);
-        indexProperty().addListener(indexListener);
+        
         updateColumnIndex();
     }
 
@@ -84,19 +84,6 @@
     
     private boolean itemDirty = false;
     
-    private final InvalidationListener indexListener = new InvalidationListener() {
-        @Override public void invalidated(Observable valueModel) {
-            // Ideally we would just use the following two lines of code, rather
-            // than the updateItem() call beneath, but if we do this we end up with
-            // RT-22428 where all the columns are collapsed.
-            // itemDirty = true;
-            // requestLayout();
-            updateItem();
-            updateSelection();
-            updateFocus();
-        }
-    };
-    
     /*
      * This is the list observer we use to keep an eye on the SelectedCells
      * ObservableList in the table view. Because it is possible that the table can
@@ -389,6 +376,18 @@
     *                                                                         *
     **************************************************************************/
     
+    @Override void indexChanged() {
+        super.indexChanged();
+        // Ideally we would just use the following two lines of code, rather
+        // than the updateItem() call beneath, but if we do this we end up with
+        // RT-22428 where all the columns are collapsed.
+        // itemDirty = true;
+        // requestLayout();
+        updateItem();
+        updateSelection();
+        updateFocus();
+    }
+    
     private boolean isLastVisibleColumn = false;
     private int columnIndex = -1;
     
--- a/javafx-ui-controls/src/javafx/scene/control/TableRow.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TableRow.java	Sat Jan 19 10:08:14 2013 +1300
@@ -69,7 +69,6 @@
      */
     public TableRow() {
         getStyleClass().addAll(DEFAULT_STYLE_CLASS);
-        indexProperty().addListener(indexListener);
     }
 
 
@@ -88,22 +87,6 @@
      *                                                                         *
      **************************************************************************/
 
-    private final InvalidationListener indexListener = new InvalidationListener() {
-        @Override public void invalidated(Observable valueModel) {
-            int newIndex = getIndex();
-        
-            // Below we check if the index has changed, but we always call updateItem,
-            // as the value in the given index may have changed.
-            updateItem(newIndex);
-
-            if (oldIndex == newIndex) return;
-            oldIndex = newIndex;
-
-            updateSelection();
-            updateFocus();
-        }
-    };
-    
     /*
      * This is the list observer we use to keep an eye on the SelectedCells
      * list in the table view. Because it is possible that the table can
@@ -240,6 +223,23 @@
 
     private int oldIndex = -1;
     
+    /** {@inheritDoc} */
+    @Override void indexChanged() {
+        int newIndex = getIndex();
+        
+        super.indexChanged();
+        
+        // Below we check if the index has changed, but we always call updateItem,
+        // as the value in the given index may have changed.
+        updateItem(newIndex);
+        
+        if (oldIndex == newIndex) return;
+        oldIndex = newIndex;
+        
+        updateSelection();
+        updateFocus();
+    }
+    
     private void updateItem(int newIndex) {
         TableView<T> tv = getTableView();
         if (tv == null || tv.getItems() == null) return;
--- a/javafx-ui-controls/src/javafx/scene/control/TreeTableCell.java	Fri Jan 18 11:11:18 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeTableCell.java	Sat Jan 19 10:08:14 2013 +1300
@@ -69,7 +69,7 @@
      */
     public TreeTableCell() {
         getStyleClass().addAll(DEFAULT_STYLE_CLASS);
-        indexProperty().addListener(indexListener);
+        
         updateColumnIndex();
     }
 
@@ -83,19 +83,6 @@
     
     private boolean itemDirty = false;
     
-    private final InvalidationListener indexListener = new InvalidationListener() {
-        @Override public void invalidated(Observable valueModel) {
-            // Ideally we would just use the following two lines of code, rather
-            // than the updateItem() call beneath, but if we do this we end up with
-            // RT-22428 where all the columns are collapsed.
-            // itemDirty = true;
-            // requestLayout();
-            updateItem();
-            updateSelection();
-            updateFocus();
-        }
-    };
-    
     /*
      * This is the list observer we use to keep an eye on the SelectedCells
      * ObservableList in the tree table view. Because it is possible that the table can
@@ -360,6 +347,18 @@
      *                                                                         *
      **************************************************************************/
     
+    @Override void indexChanged() {
+        super.indexChanged();
+        // Ideally we would just use the following two lines of code, rather
+        // than the updateItem() call beneath, but if we do this we end up with
+        // RT-22428 where all the columns are collapsed.
+        // itemDirty = true;
+        // requestLayout();
+        updateItem();
+        updateSelection();
+        updateFocus();
+    }
+    
     private boolean isLastVisibleColumn = false;
     private int columnIndex = -1;