changeset 2243:15404b7ea44b

RT-26573: [MenuItem] graphic cannot be removed.
author jgiles
date Tue, 15 Jan 2013 16:28:26 +1300
parents 5801a67086d9
children c47b77160532
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Tue Jan 15 15:55:20 2013 +1300
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Tue Jan 15 16:28:26 2013 +1300
@@ -1087,9 +1087,18 @@
             // Add the menu item to properties map of this node. Used by QA for testing
             // This allows associating this container with corresponding MenuItem.
             getProperties().put(MenuItem.class, item);
+            
+            item.graphicProperty().addListener(new InvalidationListener() {
+                @Override public void invalidated(Observable o) {
+                    createChildren();
+                    computeVisualMetrics();
+                }
+            });
         }
         
         private void createChildren() {
+            getChildren().clear();
+            
             // draw background region for hover effects. All content (other
             // than Nodes from NodeMenuItems) are set to be mouseTransparent, so
             // this background also acts as the receiver of user input