< prev index next >

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

Print this page

        

@@ -48,10 +48,12 @@
 import javafx.scene.input.ContextMenuEvent;
 import javafx.scene.layout.Region;
 import com.sun.javafx.application.PlatformImpl;
 import javafx.css.CssMetaData;
 import com.sun.javafx.css.StyleManager;
+import com.sun.javafx.scene.NodeHelper;
+import com.sun.javafx.scene.control.ControlHelper;
 import javafx.css.StyleableObjectProperty;
 import javafx.css.StyleableStringProperty;
 import javafx.css.converter.StringConverter;
 import com.sun.javafx.scene.control.Logging;
 import javafx.css.Styleable;

@@ -79,10 +81,17 @@
  * @since JavaFX 2.0
  */
 public abstract class Control extends Region implements Skinnable {
 
     static {
+        ControlHelper.setControlAccessor(new ControlHelper.ControlAccessor() {
+            @Override
+            public void doProcessCSS(Node node) {
+                ((Control) node).doProcessCSS();
+            }
+        });
+
         // Ensures that the default application user agent stylesheet is loaded
         if (Application.getUserAgentStylesheet() == null) {
             PlatformImpl.setDefaultPlatformUserAgentStylesheet();
         }
     }

@@ -289,16 +298,16 @@
 
             // clear out the styleable properties so that the list is rebuilt
             // next time they are requested.
             styleableProperties = null;
 
-            // 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.
-            impl_reapplyCSS();
+            NodeHelper.reapplyCSS(Control.this);
 
             // 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);

@@ -404,10 +413,14 @@
      *                                                                         *
      * Constructors                                                            *
      *                                                                         *
      **************************************************************************/
 
+    {
+        // To initialize the class helper at the begining each constructor of this class
+        ControlHelper.initHelper(this);
+    }
     /**
      *  Create a new Control.
      */
     protected Control() {
         // focusTraversable is styleable through css. Calling setFocusTraversable

@@ -860,25 +873,23 @@
      */
     protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
         return getClassCssMetaData();
     }
 
-    /**
-     * @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() {
+    private void doProcessCSS() {
 
-        super.impl_processCSS();
+        ControlHelper.superProcessCSS(this);
 
         if (getSkin() == null) {
             // try to create default skin
             final Skin<?> defaultSkin = createDefaultSkin();
             if (defaultSkin != null) {
                 skinProperty().set(defaultSkin);
-                super.impl_processCSS();
+                ControlHelper.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) {
< prev index next >