changeset 96:ad9c4f1b10f6

RT-18275: [ComboBox] When list is empty, thin line of shadow is visible.
author Jonathan Giles
date Thu, 01 Dec 2011 08:57:31 +1000
parents b8d5a05a415b
children 349ecca8c8da
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu Dec 01 08:01:11 2011 +1000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Thu Dec 01 08:57:31 2011 +1000
@@ -174,28 +174,39 @@
     
     private ListView<T> createListView() {
         final ListView<T> listView = new ListView<T>() {
+
+            @Override protected double computeMinHeight(double width) {
+                return 30;
+            }
+            
             @Override protected double computePrefWidth(double height) {
                 doCSSCheck();
                 
+                double pw;
                 if (getSkin() instanceof VirtualContainerBase) {
                     VirtualContainerBase skin = (VirtualContainerBase)getSkin();
-                    return skin.getVirtualFlowPreferredWidth(height) + 10;
+                    pw = skin.getVirtualFlowPreferredWidth(height) + 10;
                 } else {
-                    return Math.max(100, comboBox.getWidth());
+                    pw = Math.max(100, comboBox.getWidth());
                 }
+                
+                return Math.max(50, pw);
             }
 
             @Override protected double computePrefHeight(double width) {
                 doCSSCheck();
                 
+                Double ph;
                 if (getSkin() instanceof VirtualContainerBase) {
                     int maxRows = comboBox.getVisibleRowCount();
                     VirtualContainerBase skin = (VirtualContainerBase)getSkin();
-                    return skin.getVirtualFlowPreferredHeight(maxRows);
+                    ph = skin.getVirtualFlowPreferredHeight(maxRows);
                 } else {
                     double ch = comboBox.getItems().size() * 25;
-                    return Math.min(ch, 200);
+                    ph = Math.min(ch, 200);
                 }
+                
+                return ph;
             }
             
             private void doCSSCheck() {
@@ -244,4 +255,8 @@
     @Override protected double computePrefWidth(double height) {
         return listView.prefWidth(height);
     }
+    
+    @Override protected double computeMinWidth(double height) {
+        return 50;
+    }
 }