< prev index next >

modules/javafx.graphics/src/main/java/javafx/scene/Node.java

Print this page

        

@@ -1825,10 +1825,31 @@
      */
     public final BooleanProperty disableProperty() {
         return getMiscProperties().disableProperty();
     }
 
+    /**
+     * Indicates whether this {@code Node} is sensitive to CSS processing.<p>
+     * Nodes with {@code cssSensitive} set to {@code false} and
+     * their subtrees will be skipped during CSS processing.
+     *
+     * @return is this {@code Node} sensitive to CSS processing
+     * @defaultValue true
+     * @since 10
+     */
+    public final BooleanProperty cssSensitiveProperty() {
+        return getMiscProperties().cssSensitiveProperty();
+    }
+
+    public final void setCssSensitive(boolean value) {
+        cssSensitiveProperty().set(value);
+    }
+
+    public final boolean isCssSensitive() {
+        return (miscProperties == null) ? true
+                : miscProperties.isCssSensitive();
+    }
 
 //    /**
 //     * TODO document - null by default, could be non-null in subclasses (e.g. Control)
 //     */
 //    public final ObjectProperty<InputMap<?>> inputMapProperty() {

@@ -6716,10 +6737,11 @@
         private ObjectProperty<CacheHint> cacheHint;
         private ObjectProperty<Node> clip;
         private ObjectProperty<Cursor> cursor;
         private ObjectProperty<DepthTest> depthTest;
         private BooleanProperty disable;
+        private BooleanProperty cssSensitive;
         private ObjectProperty<Effect> effect;
         private ObjectProperty<InputMethodRequests> inputMethodRequests;
         private BooleanProperty mouseTransparent;
         private DoubleProperty viewOrder;
 

@@ -7073,10 +7095,35 @@
                 };
             }
             return disable;
         }
 
+        public final boolean isCssSensitive() {
+            return (cssSensitive == null) ? true : cssSensitive.get();
+        }
+
+        public final BooleanProperty cssSensitiveProperty() {
+            if (cssSensitive == null) {
+                cssSensitive = new BooleanPropertyBase(true) {
+                    @Override
+                    protected void invalidated() {
+                    }
+
+                    @Override
+                    public Object getBean() {
+                        return Node.this;
+                    }
+
+                    @Override
+                    public String getName() {
+                        return "cssSensitive";
+                    }
+                };
+            }
+            return cssSensitive;
+        }
+
         public final Effect getEffect() {
             return (effect == null) ? DEFAULT_EFFECT : effect.get();
         }
 
         public final ObjectProperty<Effect> effectProperty() {

@@ -9428,10 +9475,14 @@
     // There is no check of the CSS state of a child since reapply takes precedence
     // over other CSS states.
     //
     private void reapplyCss() {
 
+        if (isCssSensitive() == false) {
+            return;
+        }
+
         // Hang on to current styleHelper so we can know whether
         // createStyleHelper returned the same styleHelper
         final CssStyleHelper oldStyleHelper = styleHelper;
 
         // CSS state is "REAPPLY"

@@ -9499,10 +9550,14 @@
             {
                 Parent me = (Parent)this;
                 // clear the flag first in case the flag is set to something
                 // other than clean by downstream processing.
                 me.cssFlag = CssFlags.CLEAN;
+
+                if (isCssSensitive() == false) {
+                    return;
+                }
                 List<Node> children = me.getChildren();
                 for (int i=0, max=children.size(); i<max; i++) {
                     children.get(i).processCSS();
                 }
                 break;

@@ -9556,10 +9611,14 @@
      * </code></pre>
      * @since JavaFX 8.0
      */
     public final void applyCss() {
 
+        if (isCssSensitive() == false) {
+            return;
+        }
+
         if (getScene() == null) {
             return;
         }
 
         // update, unless reapply

@@ -9624,10 +9683,14 @@
 
         // Clear the flag first in case the flag is set to something
         // other than clean by downstream processing.
         cssFlag = CssFlags.CLEAN;
 
+        if (isCssSensitive() == false) {
+            return;
+        }
+
         // Transition to the new state and apply styles
         if (styleHelper != null && getScene() != null) {
             styleHelper.transitionToState(this);
         }
     }
< prev index next >