changeset 1795:bedd78e543a0

RT-25133: strip off package when comparing class name in css selector
author David Grieve<david.grieve@oracle.com>
date Thu, 04 Oct 2012 17:06:53 -0400
parents c15a91781139
children 80b5d7e96fdb
files javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java	Thu Oct 04 17:06:52 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java	Thu Oct 04 17:06:53 2012 -0400
@@ -485,10 +485,11 @@
         if (simpleSelector == null) {
 
             final String name = node.getClass().getName();
+            final int dotPos = name.lastIndexOf('.');
             final String id = node.getId();
             final List<String> selectorStyleClasses = node.getStyleClass();
             simpleSelector = new SimpleSelector(
-                    name,
+                    name.substring(dotPos+1), // want Foo, not bada.bing.Foo
                     selectorStyleClasses,
                     null,
                     id);
--- a/javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java	Thu Oct 04 17:06:52 2012 -0400
+++ b/javafx-ui-controls/test/javafx/scene/control/PopupControlTest.java	Thu Oct 04 17:06:53 2012 -0400
@@ -24,6 +24,10 @@
 
     @Before public void setup() {
         popup = new PopupControl();
+        // PopupControl normally gets its stylesheet from the owner scene.
+        popup.getScene().getStylesheets().add(
+            PopupControlSkin.class.getResource("caspian/caspian.css").toExternalForm()
+        );
     }
 
     /*********************************************************************