< prev index next >

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

Print this page

 9350      * @param pseudoClass the pseudo-class that has changed state
 9351      * @param active whether or not the state is active
 9352      * @since JavaFX 8.0
 9353      */
 9354     public final void pseudoClassStateChanged(PseudoClass pseudoClass, boolean active) {
 9355 
 9356         final boolean modified = active
 9357                 ? pseudoClassStates.add(pseudoClass)
 9358                 : pseudoClassStates.remove(pseudoClass);
 9359 
 9360         if (modified && styleHelper != null) {
 9361             final boolean isTransition = styleHelper.pseudoClassStateChanged(pseudoClass);
 9362             if (isTransition) {
 9363                 requestCssStateTransition();
 9364             }
 9365         }
 9366    }
 9367 
 9368     // package so that StyleHelper can get at it
 9369     final ObservableSet<PseudoClass> pseudoClassStates = new PseudoClassState();


 9370     /**
 9371      * @return The active pseudo-class states of this Node, wrapped in an unmodifiable ObservableSet
 9372      * @since JavaFX 8.0
 9373      */
 9374     public final ObservableSet<PseudoClass> getPseudoClassStates() {
 9375 
 9376         return FXCollections.unmodifiableObservableSet(pseudoClassStates);
 9377 
 9378     }
 9379 
 9380     // Walks up the tree telling each parent that the pseudo class state of
 9381     // this node has changed.
 9382     final void notifyParentsOfInvalidatedCSS() {
 9383         SubScene subScene = getSubScene();
 9384         Parent root = (subScene != null) ?
 9385                 subScene.getRoot() : getScene().getRoot();
 9386 
 9387         if (!root.isDirty(DirtyBits.NODE_CSS)) {
 9388             // Ensure that Scene.root is marked as dirty. If the scene isn't
 9389             // dirty, nothing will get repainted. This bit is cleared from
 9390             // Scene in doCSSPass().
 9391             NodeHelper.markDirty(root, DirtyBits.NODE_CSS);
 9392             if (subScene != null) {
 9393                 // If the node is part of a subscene, then we must ensure that
 9394                 // the we not only mark subScene.root dirty, but continue and
 9395                 // call subScene.notifyParentsOfInvalidatedCSS() until
 9396                 // Scene.root gets marked dirty, via the recursive call:
 9397                 subScene.cssFlag = CssFlags.UPDATE;

 9350      * @param pseudoClass the pseudo-class that has changed state
 9351      * @param active whether or not the state is active
 9352      * @since JavaFX 8.0
 9353      */
 9354     public final void pseudoClassStateChanged(PseudoClass pseudoClass, boolean active) {
 9355 
 9356         final boolean modified = active
 9357                 ? pseudoClassStates.add(pseudoClass)
 9358                 : pseudoClassStates.remove(pseudoClass);
 9359 
 9360         if (modified && styleHelper != null) {
 9361             final boolean isTransition = styleHelper.pseudoClassStateChanged(pseudoClass);
 9362             if (isTransition) {
 9363                 requestCssStateTransition();
 9364             }
 9365         }
 9366    }
 9367 
 9368     // package so that StyleHelper can get at it
 9369     final ObservableSet<PseudoClass> pseudoClassStates = new PseudoClassState();
 9370     final ObservableSet<PseudoClass> unmodifiablePseudoClassStates =
 9371             FXCollections.unmodifiableObservableSet(pseudoClassStates);
 9372     /**
 9373      * @return The active pseudo-class states of this Node, wrapped in an unmodifiable ObservableSet
 9374      * @since JavaFX 8.0
 9375      */
 9376     public final ObservableSet<PseudoClass> getPseudoClassStates() {
 9377         return unmodifiablePseudoClassStates;


 9378     }
 9379 
 9380     // Walks up the tree telling each parent that the pseudo class state of
 9381     // this node has changed.
 9382     final void notifyParentsOfInvalidatedCSS() {
 9383         SubScene subScene = getSubScene();
 9384         Parent root = (subScene != null) ?
 9385                 subScene.getRoot() : getScene().getRoot();
 9386 
 9387         if (!root.isDirty(DirtyBits.NODE_CSS)) {
 9388             // Ensure that Scene.root is marked as dirty. If the scene isn't
 9389             // dirty, nothing will get repainted. This bit is cleared from
 9390             // Scene in doCSSPass().
 9391             NodeHelper.markDirty(root, DirtyBits.NODE_CSS);
 9392             if (subScene != null) {
 9393                 // If the node is part of a subscene, then we must ensure that
 9394                 // the we not only mark subScene.root dirty, but continue and
 9395                 // call subScene.notifyParentsOfInvalidatedCSS() until
 9396                 // Scene.root gets marked dirty, via the recursive call:
 9397                 subScene.cssFlag = CssFlags.UPDATE;
< prev index next >