changeset 897:ce65dc129c92

merge
author Kinsley Wong
date Mon, 30 Apr 2012 11:11:55 -0700
parents 06cc0cc5e1cf 65e0acb7530b
children 3fa9344823cf 66ba0daf77a7
files
diffstat 5 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ColorPickerBehavior.java	Fri Apr 27 14:02:21 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ColorPickerBehavior.java	Mon Apr 30 11:11:55 2012 -0700
@@ -32,6 +32,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import com.sun.javafx.scene.control.ColorPicker;
+import com.sun.javafx.scene.control.skin.ColorPickerSkin;
 
 import javafx.scene.input.MouseEvent;
 import javafx.scene.paint.Color;
@@ -112,7 +113,12 @@
 //    }
     
     @Override public void onAutoHide() {
-        // do nothing
+        // when we click on some non  interactive part of the 
+        // Color Palette - we do not want to hide.
+        wasComboBoxButtonClickedForAutoHide = mouseInsideButton;
+        ColorPicker colorPicker = (ColorPicker)getControl();
+        ColorPickerSkin cpSkin = (ColorPickerSkin)colorPicker.getSkin();
+        cpSkin.syncWithAutoUpdate();
     }
     
     @Override public void mouseReleased(MouseEvent e) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Fri Apr 27 14:02:21 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Mon Apr 30 11:11:55 2012 -0700
@@ -228,7 +228,7 @@
     }
     
     boolean wasComboBoxButtonClickedForAutoHide = false;
-    private boolean mouseInsideButton = false;
+    boolean mouseInsideButton = false;
     public void onAutoHide() {
         // if the ComboBox button was clicked, and it was this that forced the
         // popup to disappear, we don't want the popup to immediately reappear,
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPalette.java	Fri Apr 27 14:02:21 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPalette.java	Mon Apr 30 11:11:55 2012 -0700
@@ -66,6 +66,7 @@
     public ColorPalette(Color initPaint, final ColorPicker colorPicker) {
         getStyleClass().add("color-panel");
         this.colorPicker = colorPicker;
+        owner = colorPicker.getScene().getWindow();
         cpg = new ColorPickerGrid(initPaint);
         customColorDialog = new CustomColorDialog(owner, colorPicker.valueProperty());
         customColorLink.setPrefWidth(cpg.prefWidth(-1));
@@ -232,11 +233,6 @@
     public ColorPickerGrid getColorGrid() {
         return cpg;
     }
-    public void setOwner(ColorPicker colorPicker) {
-        this.colorPicker = colorPicker;
-        owner = colorPicker.getScene().getWindow();
-        cpg.owner = colorPicker.getScene().getWindow();
-    }
     
     @Override protected void layoutChildren() {
         double paddingX = getInsets().getLeft();
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Fri Apr 27 14:02:21 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Mon Apr 30 11:11:55 2012 -0700
@@ -70,7 +70,6 @@
         if (colorPicker.getValue() == null) colorPicker.setValue(Color.WHITE);
         popupContent = new ColorPalette(Color.WHITE, colorPicker);
         popupContent.setPopupControl(getPopup());
-        popupContent.setOwner(colorPicker);
         updateComboBoxMode();
         if (getMode() == ComboBoxMode.BUTTON || getMode() == ComboBoxMode.COMBOBOX) {
              if (arrowButton.getOnMouseReleased() == null) {
@@ -91,7 +90,6 @@
                 });
             }
         }
-        registerChangeListener(getPopup().showingProperty(), "POPUP_VISIBLE");
 //        getPopup().setAutoHide(false);
     }
     
@@ -164,13 +162,6 @@
                 if (!popupContent.isAddColorDialogShowing()) hide();
             }
         }     
-        else if (p == "POPUP_VISIBLE") {
-            if (!getPopup().isShowing() && getSkinnable().isShowing()) {
-                // Popup was dismissed. Maybe user clicked outside or typed ESCAPE.
-                // Make sure button is in sync.
-                getSkinnable().hide();
-            }
-        }
     }
     @Override public Node getDisplayNode() {
         final ColorPicker colorPicker = (ColorPicker)getSkinnable();
@@ -233,6 +224,14 @@
         return displayNode;
     }
     
+    public void syncWithAutoUpdate() {
+        if (!getPopup().isShowing() && getSkinnable().isShowing()) {
+            // Popup was dismissed. Maybe user clicked outside or typed ESCAPE.
+            // Make sure ColorPicker button is in sync.
+            getSkinnable().hide();
+        }
+    }
+    
     @Override protected void layoutChildren() {
         updateComboBoxMode();
         super.layoutChildren();
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CustomColorDialog.java	Fri Apr 27 14:02:21 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CustomColorDialog.java	Mon Apr 30 11:11:55 2012 -0700
@@ -75,7 +75,7 @@
         this.currentColorProperty.bind(currentColorProperty);
         if (owner != null) dialog.initOwner(owner);
         dialog.setTitle("Custom Colors..");
-        dialog.initModality(Modality.WINDOW_MODAL);
+        dialog.initModality(Modality.APPLICATION_MODAL);
         dialog.initStyle(StageStyle.UTILITY);
         colorRectPane = new ColorRectPane();
         controlsPane = new ControlsPane();