< prev index next >

modules/controls/src/main/java/javafx/scene/control/PopupControl.java

Print this page

        

@@ -47,15 +47,19 @@
 import javafx.stage.PopupWindow;
 import com.sun.javafx.application.PlatformImpl;
 import javafx.css.CssMetaData;
 import javafx.css.PseudoClass;
 import com.sun.javafx.css.StyleManager;
+import com.sun.javafx.scene.NodeHelper;
+import com.sun.javafx.scene.ParentHelper;
 import javafx.css.Styleable;
 import javafx.css.StyleableStringProperty;
 import javafx.css.converter.StringConverter;
 import com.sun.javafx.scene.control.Logging;
+import com.sun.javafx.scene.layout.PaneHelper;
 import com.sun.javafx.stage.PopupWindowHelper;
+import com.sun.javafx.util.Utils;
 import javafx.css.StyleableProperty;
 import javafx.stage.Window;
 import sun.util.logging.PlatformLogger;
 import sun.util.logging.PlatformLogger.Level;
 

@@ -268,16 +272,16 @@
                 bridge.getChildren().setAll(n);
             } else {
                 bridge.getChildren().clear();
             }
 
-            // calling impl_reapplyCSS() as the styleable properties may now
+            // calling NodeHelper.reapplyCSS() as the styleable properties may now
             // be different, as we will now be able to return styleable properties
-            // belonging to the skin. If impl_reapplyCSS() is not called, the
+            // belonging to the skin. If NodeHelper.reapplyCSS() is not called, the
             // getCssMetaData() method is never called, so the
             // skin properties are never exposed.
-            bridge.impl_reapplyCSS();
+            NodeHelper.reapplyCSS(bridge);
 
             // DEBUG: Log that we've changed the skin
             final PlatformLogger logger = Logging.getControlsLogger();
             if (logger.isLoggable(Level.FINEST)) {
                 logger.finest("Stored skin[" + getValue() + "] on " + this);

@@ -1106,10 +1110,15 @@
      */
     protected class CSSBridge extends Pane {
 
         private final PopupControl popupControl = PopupControl.this;
 
+        {
+            // To initialize the class helper at the begining each constructor of this class
+            CSSBridgeHelper.initHelper(this);
+        }
+
         /**
          * Requests a layout pass to be performed before the next scene is
          * rendered. This is batched up asynchronously to happen once per
          * "pulse", or frame of animation.
          * <p/>

@@ -1134,49 +1143,35 @@
         @Override
         public Styleable getStyleableParent() {
             return PopupControl.this.getStyleableParent();
         }
 
-        /**
-         * @treatAsPrivate implementation detail
-         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-         */
-        @Deprecated
-        protected void setSkinClassName(String skinClassName) { /* no-op - retain for binary compatibility */ }
-
         @Override
         public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
             return PopupControl.this.getCssMetaData();
         }
 
-        /**
-         * @treatAsPrivate implementation detail
-         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-         */
-        @Deprecated
-        @Override public List<String> impl_getAllParentStylesheets() {
+        List<String> getAllParentStylesheets() {
             Styleable styleable = getStyleableParent();
             if (styleable instanceof Parent) {
-                return ((Parent)styleable).impl_getAllParentStylesheets();
+                return ParentHelper.getAllParentStylesheets((Parent)styleable);
             }
             return null;
         }
 
-        /**
-         * @treatAsPrivate implementation detail
-         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+        /*
+         * Note: This method MUST only be called via its accessor method.
          */
-        @Deprecated
-        @Override protected void impl_processCSS() {
-            super.impl_processCSS();
+        private void doProcessCSS() {
+            CSSBridgeHelper.superProcessCSS(this);
 
             if (getSkin() == null) {
                 // try to create default skin
                 final Skin<?> defaultSkin = createDefaultSkin();
                 if (defaultSkin != null) {
                     skinProperty().set(defaultSkin);
-                    super.impl_processCSS();
+                    CSSBridgeHelper.superProcessCSS(this);
                 } else {
                     final String msg = "The -fx-skin property has not been defined in CSS for " + this +
                             " and createDefaultSkin() returned null.";
                     final List<CssParser.ParseError> errors = StyleManager.getErrors();
                     if (errors != null) {

@@ -1188,6 +1183,38 @@
             }
         }
 
     }
 
+    /*
+     * Used to access internal methods of CSSBridge.
+     */
+    static final class CSSBridgeHelper extends PaneHelper {
+        private static final CSSBridgeHelper theInstance;
+
+        static {
+            theInstance = new CSSBridgeHelper();
+        }
+
+        private static CSSBridgeHelper getInstance() {
+            return theInstance;
+        }
+
+        public static void initHelper(CSSBridge cssBridge) {
+            setHelper(cssBridge, getInstance());
+        }
+
+        public static void superProcessCSS(Node node) {
+            ((CSSBridgeHelper) getHelper(node)).superProcessCSSImpl(node);
+        }
+
+        void superProcessCSSImpl(Node node) {
+            super.processCSSImpl(node);
+        }
+
+        protected void processCSSImpl(Node node) {
+            ((CSSBridge) node).doProcessCSS();
+        }
+
+    }
+
 }
< prev index next >