changeset 1416:2e3e8a90f8c0

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.2/scrum/controls/jfx/rt
author jgiles
date Mon, 09 Jul 2012 16:49:39 +1200
parents d48861b45651 e3ddeb5fe157
children 5b3e02e4f23b b9a7024c3450
files
diffstat 2 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Thu Jul 05 13:25:39 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Mon Jul 09 16:49:39 2012 +1200
@@ -209,6 +209,10 @@
             header.dispose();
         }
         
+        for (int i = 0; i < dragRects.size(); i++) {
+            Rectangle rect = dragRects.get(i);
+            rect.visibleProperty().unbind();
+        }
         dragRects.clear();
         getChildren().clear();
     }
@@ -348,7 +352,7 @@
             rect.setWidth(DRAG_RECT_WIDTH);
             rect.setHeight(getHeight() - label.getHeight());
             rect.setFill(Color.TRANSPARENT);
-            rect.setVisible(false);
+            rect.visibleProperty().bind(c.visibleProperty());
             rect.setSmooth(false);
             rect.setOnMousePressed(rectMousePressed);
             rect.setOnMouseDragged(rectMouseDragged);
@@ -439,7 +443,6 @@
             // position drag overlay to intercept column resize requests
             if (dragRects != null && i < dragRects.size()) {
                 Rectangle dragRect = dragRects.get(i++);
-                dragRect.setVisible(true);
                 dragRect.setHeight(getHeight() - label.getHeight());
                 dragRect.relocate(x - DRAG_RECT_WIDTH / 2, getInsets().getTop() + labelHeight);
             }
--- a/javafx-ui-controls/src/javafx/scene/control/MultipleSelectionModelBase.java	Thu Jul 05 13:25:39 2012 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/MultipleSelectionModelBase.java	Mon Jul 09 16:49:39 2012 +1200
@@ -212,7 +212,6 @@
     protected abstract int getFocusedIndex();
     
     
-    // FIXME not optimal: each shift requires a whole new loop
     // package only
     void shiftSelection(int position, int shift) {
         // with no check here, we get RT-15024
@@ -228,26 +227,23 @@
         int idx = 0;
         
         if (shift > 0) {
-            for (int iter = 0; iter < shift; iter++) {
-                for (int i = selectedIndicesSize - 1; i >= position && i >= 0; i--) {
-                    boolean selected = selectedIndices.get(i);
-                    selectedIndices.set(i+1, selected);
-                    
-                    if (selected) {
-                        perm[idx++] = i + 1;
-                    }
+            for (int i = selectedIndicesSize - 1; i >= position && i >= 0; i--) {
+                boolean selected = selectedIndices.get(i);
+                selectedIndices.set(i + shift, selected);
+
+                if (selected) {
+                    perm[idx++] = i + 1;
                 }
-                selectedIndices.clear(position);
-             }
+            }
+            selectedIndices.clear(position);
         } else if (shift < 0) {
-            for (int iter = 0; iter < Math.abs(shift); iter++) {
-                for (int i = position; i < selectedIndicesSize; i++) {
-                    boolean selected = selectedIndices.get(i + 1);
-                    selectedIndices.set(i, selected);
-                    
-                    if (selected) {
-                        perm[idx++] = i;
-                    }
+            for (int i = position; i < selectedIndicesSize; i++) {
+                if ((i + shift) < 0) continue;
+                boolean selected = selectedIndices.get(i + 1);
+                selectedIndices.set(i + 1 + shift, selected);
+
+                if (selected) {
+                    perm[idx++] = i;
                 }
             }
         }