changeset 128:39b77f7b2433

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.1/scrum/controls/jfx/rt
author jgiles
date Thu, 08 Dec 2011 17:47:34 +1000
parents 1258b293c169 682bde65e6d3
children f6abb0dd0f61 d06073f52116
files
diffstat 7 files changed, 43 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TableCellBehavior.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TableCellBehavior.java	Thu Dec 08 17:47:34 2011 +1000
@@ -151,10 +151,14 @@
                 sm.clearSelection();
 
                 // and then perform the selection
-                for (int _row = minRow; _row <= maxRow; _row++) {
-                    for (int _col = minColumn; _col <= maxColumn; _col++) {
-                        sm.select(_row, tableView.getVisibleLeafColumn(_col));
+                if (sm.isCellSelectionEnabled()) {
+                    for (int _row = minRow; _row <= maxRow; _row++) {
+                        for (int _col = minColumn; _col <= maxColumn; _col++) {
+                            sm.select(_row, tableView.getVisibleLeafColumn(_col));
+                        }
                     }
+                } else {
+                    sm.selectRange(minRow, maxRow + 1);
                 }
 
                 // return selection back to the focus owner
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu Dec 08 17:47:34 2011 +1000
@@ -135,6 +135,9 @@
                     if (c == null) return;
                     T value = c.fromString(textField.getText());
                     comboBox.setValue(value);
+                } else if (t.getCode() == KeyCode.F4) {
+                    if (comboBox.isShowing()) comboBox.hide();
+                    else comboBox.show();
                 }
             }
         });
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java	Thu Dec 08 17:47:34 2011 +1000
@@ -1147,12 +1147,14 @@
 
     @Override protected void setWidth(double value) {
         super.setWidth(value);
-        layoutChildren();
+        setNeedsLayout(true);
+        requestLayout();
     }
     
     @Override protected void setHeight(double value) {
         super.setHeight(value);
-        layoutChildren();
+        setNeedsLayout(true);
+        requestLayout();
     }
 
     private void updateScrollBarsAndViewport(double lastViewportLength) {
--- a/javafx-ui-controls/src/javafx/scene/control/TableView.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TableView.java	Thu Dec 08 17:47:34 2011 +1000
@@ -1843,12 +1843,11 @@
                     if (position < 0) return;
                     
                     List<TablePosition> newIndices = new ArrayList<TablePosition>(selectedCells.size());
-                    int m = Math.min(position, selectedCells.size());
-                    newIndices.addAll(selectedCells.subList(0, m));
         
                     for (int i = 0; i < selectedCells.size(); i++) {
                         TablePosition old = selectedCells.get(i);
-                        newIndices.add(new TablePosition(getTableView(), old.getRow() + shift, old.getTableColumn()));
+                        int newRow = old.getRow() < position ? old.getRow() : old.getRow() + shift;
+                        newIndices.add(new TablePosition(getTableView(), newRow, old.getTableColumn()));
                     }
                     
                     quietClearSelection();
@@ -1935,6 +1934,7 @@
 //            if (! isCellSelectionEnabled() && column != null) return;
 
             TablePosition pos = new TablePosition(getTableView(), row, column);
+            
             if (getSelectionMode() == SelectionMode.SINGLE) {
                 quietClearSelection();
             }
--- a/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Thu Dec 08 17:47:34 2011 +1000
@@ -298,4 +298,12 @@
         assertTrue(fm.isFocused(0));
         assertEquals("row1", fm.getFocusedItem());
     }
+    
+    @Test public void test_rt18385() {
+        listView.getItems().addAll("row1", "row2", "row3");
+        listView.getSelectionModel().select(1);
+        listView.getItems().add("Another Row");
+        assertEquals(1, listView.getSelectionModel().getSelectedIndices().size());
+        assertEquals(1, listView.getSelectionModel().getSelectedItems().size());
+    }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TableViewTest.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TableViewTest.java	Thu Dec 08 17:47:34 2011 +1000
@@ -360,4 +360,13 @@
         assertTrue(fm.isFocused(0));
         assertEquals("row1", fm.getFocusedItem());
     }
+    
+    @Test public void test_rt18385() {
+        table.getItems().addAll("row1", "row2", "row3");
+        table.getSelectionModel().select(1);
+        table.getItems().add("Another Row");
+        assertEquals(1, table.getSelectionModel().getSelectedIndices().size());
+        assertEquals(1, table.getSelectionModel().getSelectedItems().size());
+        assertEquals(1, table.getSelectionModel().getSelectedCells().size());
+    }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Wed Dec 07 20:43:56 2011 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Thu Dec 08 17:47:34 2011 +1000
@@ -380,4 +380,13 @@
 //        assertTrue("Focused index: " + fm.getFocusedIndex(), fm.isFocused(1));
 //        assertEquals(child1, fm.getFocusedItem());
 //    }
+    
+    @Test public void test_rt18385() {
+        installChildren();
+//        table.getItems().addAll("row1", "row2", "row3");
+        treeView.getSelectionModel().select(1);
+        treeView.getRoot().getChildren().add(new TreeItem("Another Row"));
+        assertEquals(1, treeView.getSelectionModel().getSelectedIndices().size());
+        assertEquals(1, treeView.getSelectionModel().getSelectedItems().size());
+    }
 }