diff -r fb2dc010dd91 apps/experiments/Modena/src/modena/SamplePage.java --- a/apps/experiments/Modena/src/modena/SamplePage.java Wed Feb 06 13:12:50 2013 -0800 +++ b/apps/experiments/Modena/src/modena/SamplePage.java Wed Feb 06 19:17:09 2013 -0800 @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.Map; import javafx.application.Platform; +import javafx.css.PseudoClass; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.geometry.Pos; @@ -83,11 +84,11 @@ import javafx.scene.layout.VBoxBuilder; import javafx.scene.paint.Color; import javafx.scene.web.HTMLEditorBuilder; +import static modena.SamplePageChartHelper.*; import static modena.SamplePageHelpers.*; import static modena.SamplePageTableHelper.*; import static modena.SamplePageTreeHelper.*; import static modena.SamplePageTreeTableHelper.*; -import static modena.SamplePageChartHelper.*; /** * Page showing every control in every state @@ -98,19 +99,27 @@ private Map content = new HashMap<>(); private Node withState(Node node, String state) { - node.getProperties().put("javafx.scene.Node.pseudoClassOverride", state); + if (node != null && state != null) { + // stop user from being able to change state + node.setMouseTransparent(true); + node.setFocusTraversable(false); + // set state to chosen state + final String[] pseudoClasses = (state).split("[\\s,]+"); + for (String pseudoClass : pseudoClasses) { + node.pseudoClassStateChanged(PseudoClass.getPseudoClass(pseudoClass), true); + } + } return node; } private Node withState(final Node node, final String state, final String subNodeStyleClass, final String subNodeState) { - if (state!=null) node.getProperties().put("javafx.scene.Node.pseudoClassOverride", state); + withState(node, state); Platform.runLater(new Runnable() { @Override public void run() { - // TODO: node.lookup(subNodeStyleClass) is null if stage is not shown if (node != null) { Node subNode = node.lookup(subNodeStyleClass); if (subNode != null) { - node.lookup(subNodeStyleClass).getProperties().put("javafx.scene.Node.pseudoClassOverride", subNodeState); + withState(node.lookup(subNodeStyleClass), subNodeState); } else { System.err.println("node = " + node+" node.lookup("+subNodeStyleClass+") = " + subNode); } diff -r fb2dc010dd91 javafx-ui-common/src/javafx/scene/Node.java --- a/javafx-ui-common/src/javafx/scene/Node.java Wed Feb 06 13:12:50 2013 -0800 +++ b/javafx-ui-common/src/javafx/scene/Node.java Wed Feb 06 19:17:09 2013 -0800 @@ -598,16 +598,6 @@ public final ObservableMap getProperties() { if (properties == null) { properties = FXCollections.observableMap(new HashMap()); - if (PSEUDO_CLASS_OVERRIDE_ENABLED) { - // listen for when the user sets the PSEUDO_CLASS_OVERRIDE_KEY to new value - properties.addListener(new MapChangeListener(){ - @Override public void onChanged(Change change) { - if (PSEUDO_CLASS_OVERRIDE_KEY.equals(change.getKey()) && getScene() != null) { - updatePseudoClassOverride(); - } - } - }); - } } return properties; } @@ -780,11 +770,6 @@ } oldScene = _scene; - // we need to check if a override has been set, if so we need to apply it to the node now - // that it may have a valid scene - if (PSEUDO_CLASS_OVERRIDE_ENABLED) { - updatePseudoClassOverride(); - } } @Override @@ -7843,12 +7828,6 @@ * @param active whether or not the state is active */ public final void pseudoClassStateChanged(PseudoClass pseudoClass, boolean active) { - // check if a override has been set, if so ignore all calls - if (PSEUDO_CLASS_OVERRIDE_ENABLED && hasProperties()) { - final Object pseudoClassOverride = getProperties().get(PSEUDO_CLASS_OVERRIDE_KEY); - if (pseudoClassOverride instanceof String) return; - } - final Set pseudoClassState = styleHelper.getPseudoClassSet(); if (active) { @@ -8065,31 +8044,6 @@ private static final PseudoClass FOCUSED_PSEUDOCLASS_STATE = PseudoClass.getPseudoClass("focused"); private static final PseudoClass SHOW_MNEMONICS_PSEUDOCLASS_STATE = PseudoClass.getPseudoClass("show-mnemonics"); - private static final boolean PSEUDO_CLASS_OVERRIDE_ENABLED = AccessController.doPrivileged( - new PrivilegedAction() { - public Boolean run() { - return Boolean.getBoolean("javafx.pseudoClassOverrideEnabled"); - } - }); - private static final String PSEUDO_CLASS_OVERRIDE_KEY = "javafx.scene.Node.pseudoClassOverride"; - - /** - * Called to get current pseudo class override and apply it to this node - */ - private void updatePseudoClassOverride() { - if (PSEUDO_CLASS_OVERRIDE_ENABLED && properties != null) { - final Object pseudoClassOverride = getProperties().get(PSEUDO_CLASS_OVERRIDE_KEY); - if (pseudoClassOverride instanceof String) { - final Set pseudoClassState = styleHelper.getPseudoClassSet(); - pseudoClassState.clear(); - final String[] pseudoClasses = ((String)pseudoClassOverride).split("[\\s,]+"); - for(String pc: pseudoClasses) { - pseudoClassState.add(PseudoClass.getPseudoClass(pc)); - } - } - } - } - private static abstract class LazyTransformProperty extends ReadOnlyObjectProperty {