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

Print this page

        

*** 597,606 **** --- 597,610 ---- if (impl_isDirty(DirtyBits.NODE_TRANSFORM)) { peer.setTransformMatrix(localToParentTx); } + if (impl_isDirty(DirtyBits.NODE_PRIORITY_ORDER)) { + peer.setPriorityOrder(getPriorityOrder()); + } + if (impl_isDirty(DirtyBits.NODE_BOUNDS)) { peer.setContentBounds(_geomBounds); } if (impl_isDirty(DirtyBits.NODE_TRANSFORMED_BOUNDS)) {
*** 5217,5226 **** --- 5221,5263 ---- private static final double EPSILON_ABSOLUTE = 1.0e-5; static boolean almostZero(double a) { return ((a < EPSILON_ABSOLUTE) && (a > -EPSILON_ABSOLUTE)); } + + /* ************************************************************************* + * * + * PriorityOrder Handling * + * * + **************************************************************************/ + public final void setPriorityOrder(double value) { + priorityOrderProperty().set(value); + } + + public final double getPriorityOrder() { + return (miscProperties == null) ? DEFAULT_PRIORITY_ORDER + : miscProperties.getPriorityOrder(); + } + + /** + * Defines the traversal order of this {@code Node} within its parent. + * <p> + * This property is used to alter the rendering and picking order of a node + * within its parent without disturbing its child physical index, which makes + * it useful for animating a node's ordering such as transparency sorting. + * <p> + * The parent will traverse its children in a specific order. The children are + * traversed in decreasing priorityOrder order. The child with the highest + * priorityOrder is visited first, followed by the next higher priortyOrder + * child, and so on, till the child with the lowest priorityOrder visited last. + * + * @defaultValue 0.0 + */ + public final DoubleProperty priorityOrderProperty() { + return getMiscProperties().priorityOrderProperty(); + } + /*************************************************************************** * * * Transformations * * * **************************************************************************/
*** 6416,6425 **** --- 6453,6463 ---- } return miscProperties; } + private static final double DEFAULT_PRIORITY_ORDER = 0; private static final boolean DEFAULT_CACHE = false; private static final CacheHint DEFAULT_CACHE_HINT = CacheHint.DEFAULT; private static final Node DEFAULT_CLIP = null; private static final Cursor DEFAULT_CURSOR = null; private static final DepthTest DEFAULT_DEPTH_TEST = DepthTest.INHERIT;
*** 6439,6448 **** --- 6477,6524 ---- private ObjectProperty<DepthTest> depthTest; private BooleanProperty disable; private ObjectProperty<Effect> effect; private ObjectProperty<InputMethodRequests> inputMethodRequests; private BooleanProperty mouseTransparent; + private DoubleProperty priorityOrder; + + public double getPriorityOrder() { + return (priorityOrder == null) ? DEFAULT_PRIORITY_ORDER : priorityOrder.get(); + } + + public final DoubleProperty priorityOrderProperty() { + if (priorityOrder == null) { + priorityOrder = new StyleableDoubleProperty(DEFAULT_PRIORITY_ORDER) { + @Override + public void invalidated() { + Parent p = getParent(); + if (p != null) { + // Parent will be responsible to update peers of children + p.markSortedChildrenDirty(); + } else { + impl_markDirty(DirtyBits.NODE_PRIORITY_ORDER); + } + } + + @Override + public CssMetaData getCssMetaData() { + return StyleableProperties.PRIORITY_ORDER; + } + + @Override + public Object getBean() { + return Node.this; + } + + @Override + public String getName() { + return "priorityOrder"; + } + }; + } + return priorityOrder; + } public final Bounds getBoundsInParent() { return boundsInParentProperty().get(); }
*** 8709,8718 **** --- 8785,8810 ---- @Override public StyleableProperty<Number> getStyleableProperty(Node node) { return (StyleableProperty<Number>)node.translateZProperty(); } }; + private static final CssMetaData<Node,Number> PRIORITY_ORDER = + new CssMetaData<Node,Number>("-fx-priority-order", + SizeConverter.getInstance(), 0.0) { + + @Override + public boolean isSettable(Node node) { + return node.miscProperties == null + || node.miscProperties.priorityOrder == null + || !node.miscProperties.priorityOrder.isBound(); + } + + @Override + public StyleableProperty<Number> getStyleableProperty(Node node) { + return (StyleableProperty<Number>)node.priorityOrderProperty(); + } + }; private static final CssMetaData<Node,Boolean> VISIBILITY = new CssMetaData<Node,Boolean>("visibility", new StyleConverter<String,Boolean>() { @Override
*** 8749,8758 **** --- 8841,8851 ---- styleables.add(BLEND_MODE); styleables.add(ROTATE); styleables.add(SCALE_X); styleables.add(SCALE_Y); styleables.add(SCALE_Z); + styleables.add(PRIORITY_ORDER); styleables.add(TRANSLATE_X); styleables.add(TRANSLATE_Y); styleables.add(TRANSLATE_Z); styleables.add(VISIBILITY); STYLEABLES = Collections.unmodifiableList(styleables);