changeset 4229:3a7a4276dc6c

Fix unit test failure due to RT-31479
author jgiles
date Wed, 10 Jul 2013 16:53:56 +1200
parents 734434df77c4
children fc5da25527e5 8ed8e95a28d2
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Jul 10 16:34:19 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Jul 10 16:53:56 2013 +1200
@@ -55,7 +55,8 @@
      */
     // FIXME this should not be a StackPane
     private StackPane placeholderRegion;
-    private Label placeholderLabel;
+    private Node placeholderNode;
+//    private Label placeholderLabel;
     private static final String EMPTY_LIST_TEXT = ControlResources.getString("ListView.noContent");
 
     private ObservableList<T> listViewItems;
@@ -237,22 +238,19 @@
         boolean visible = getItemCount() == 0;
         
         if (visible) {
-            if (placeholderRegion == null) {
-                placeholderRegion = new StackPane();
-                placeholderRegion.getStyleClass().setAll("placeholder");
-                getChildren().add(placeholderRegion);
+            placeholderNode = getSkinnable().getPlaceholder();
+            if (placeholderNode == null && (EMPTY_LIST_TEXT != null && ! EMPTY_LIST_TEXT.isEmpty())) {
+                placeholderNode = new Label();
+                ((Label)placeholderNode).setText(EMPTY_LIST_TEXT);
             }
-            
-            Node placeholderNode = getSkinnable().getPlaceholder();
 
-            if (placeholderNode == null) {
-                if (placeholderLabel == null) {
-                    placeholderLabel = new Label();
+            if (placeholderNode != null) {
+                if (placeholderRegion == null) {
+                    placeholderRegion = new StackPane();
+                    placeholderRegion.getStyleClass().setAll("placeholder");
+                    getChildren().add(placeholderRegion);
                 }
-                placeholderLabel.setText(EMPTY_LIST_TEXT);
 
-                placeholderRegion.getChildren().setAll(placeholderLabel);
-            } else {
                 placeholderRegion.getChildren().setAll(placeholderNode);
             }
         }
@@ -320,7 +318,9 @@
         
         if (getItemCount() == 0) {
             // show message overlay instead of empty listview
-            placeholderRegion.resizeRelocate(x, y, w, h);
+            if (placeholderRegion != null) {
+                placeholderRegion.resizeRelocate(x, y, w, h);
+            }
         } else {
             flow.resizeRelocate(x, y, w, h);
         }