555 private void doCSSPass() {
556 final Parent sceneRoot = getRoot();
557 //
558 // RT-17547: when the tree is synchronized, the dirty bits are
559 // are cleared but the cssFlag might still be something other than
560 // clean.
561 //
562 // Before RT-17547, the code checked the dirty bit. But this is
563 // superfluous since the dirty bit will be set if the flag is not clean,
564 // but the flag will never be anything other than clean if the dirty
565 // bit is not set. The dirty bit is still needed, however, since setting
566 // it ensures a pulse if no other dirty bits have been set.
567 //
568 // For the purpose of showing the change, the dirty bit
569 // check code was commented out and not removed.
570 //
571 // if (sceneRoot.isDirty(com.sun.javafx.scene.DirtyBits.NODE_CSS)) {
572 if (sceneRoot.cssFlag != CssFlags.CLEAN) {
573 // The dirty bit isn't checked but we must ensure it is cleared.
574 // The cssFlag is set to clean in either Node.processCSS or
575 // Node.impl_processCSS(boolean)
576 sceneRoot.clearDirty(com.sun.javafx.scene.DirtyBits.NODE_CSS);
577 sceneRoot.processCSS();
578 }
579 }
580
581 void doLayoutPass() {
582 final Parent r = getRoot();
583 if (r != null) {
584 r.layout();
585 }
586 }
587
588 /**
589 * The peer of this scene
590 */
591 private TKScene peer;
592
593 /*
594 * Get Scene's peer
595 */
937 widthPropertyImpl().set(value);
938 }
939
940 public final double getWidth() {
941 return width == null ? 0.0 : width.get();
942 }
943
944 public final ReadOnlyDoubleProperty widthProperty() {
945 return widthPropertyImpl().getReadOnlyProperty();
946 }
947
948 private ReadOnlyDoubleWrapper widthPropertyImpl() {
949 if (width == null) {
950 width = new ReadOnlyDoubleWrapper() {
951
952 @Override
953 protected void invalidated() {
954 final Parent _root = getRoot();
955 //TODO - use a better method to update mirroring
956 if (_root.getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) {
957 _root.impl_transformsChanged();
958 }
959 if (_root.isResizable()) {
960 resizeRootOnSceneSizeChange(get() - _root.getLayoutX() - _root.getTranslateX(), _root.getLayoutBounds().getHeight());
961 }
962
963 getEffectiveCamera().setViewWidth(get());
964 }
965
966 @Override
967 public Object getBean() {
968 return Scene.this;
969 }
970
971 @Override
972 public String getName() {
973 return "width";
974 }
975 };
976 }
977 return width;
1602 }
1603 /**
1604 * A ObservableList of string URLs linking to the stylesheets to use with this scene's
1605 * contents. For additional information about using CSS with the
1606 * scene graph, see the <a href="doc-files/cssref.html">CSS Reference
1607 * Guide</a>.
1608 */
1609 private final ObservableList<String> stylesheets = new TrackableObservableList<String>() {
1610 @Override
1611 protected void onChanged(Change<String> c) {
1612 StyleManager.getInstance().stylesheetsChanged(Scene.this, c);
1613 // RT-9784 - if stylesheet is removed, reset styled properties to
1614 // their initial value.
1615 c.reset();
1616 while(c.next()) {
1617 if (c.wasRemoved() == false) {
1618 continue;
1619 }
1620 break; // no point in resetting more than once...
1621 }
1622 getRoot().impl_reapplyCSS();
1623 }
1624 };
1625
1626 /**
1627 * Gets an observable list of string URLs linking to the stylesheets to use
1628 * with this scene's contents.
1629 * <p>
1630 * The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL
1631 * does not have a [scheme:] component, the URL is considered to be the [path] component only.
1632 * Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to
1633 * the root of the application's classpath.
1634 * </p>
1635 * <code><pre>
1636 *
1637 * package com.example.javafx.app;
1638 *
1639 * import javafx.application.Application;
1640 * import javafx.scene.Group;
1641 * import javafx.scene.Scene;
1642 * import javafx.stage.Stage;
1658 * For additional information about using CSS with the scene graph,
1659 * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1660 *
1661 * @return the list of stylesheets to use with this scene
1662 */
1663 public final ObservableList<String> getStylesheets() { return stylesheets; }
1664
1665 private ObjectProperty<String> userAgentStylesheet = null;
1666
1667 /**
1668 * @return the userAgentStylesheet property.
1669 * @see #getUserAgentStylesheet()
1670 * @see #setUserAgentStylesheet(String)
1671 * @since JavaFX 8u20
1672 */
1673 public final ObjectProperty<String> userAgentStylesheetProperty() {
1674 if (userAgentStylesheet == null) {
1675 userAgentStylesheet = new SimpleObjectProperty<String>(Scene.this, "userAgentStylesheet", null) {
1676 @Override protected void invalidated() {
1677 StyleManager.getInstance().forget(Scene.this);
1678 getRoot().impl_reapplyCSS();
1679 }
1680 };
1681 }
1682 return userAgentStylesheet;
1683 }
1684
1685 /**
1686 * Get the URL of the user-agent stylesheet that will be used by this Scene. If the URL has not been set,
1687 * the platform-default user-agent stylesheet will be used.
1688 * <p>
1689 * For additional information about using CSS with the scene graph,
1690 * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1691 * </p>
1692 * @return The URL of the user-agent stylesheet that will be used by this Scene,
1693 * or null if has not been set.
1694 * @since JavaFX 8u20
1695 */
1696 public final String getUserAgentStylesheet() {
1697 return userAgentStylesheet == null ? null : userAgentStylesheet.get();
1698 }
3990 currCursor = newCursor;
3991 }
3992 }
3993
3994 public void updateCursorFrame() {
3995 final CursorFrame newCursorFrame =
3996 (currCursor != null)
3997 ? currCursor.getCurrentFrame()
3998 : Cursor.DEFAULT.getCurrentFrame();
3999 if (currCursorFrame != newCursorFrame) {
4000 if (Scene.this.peer != null) {
4001 Scene.this.peer.setCursor(newCursorFrame);
4002 }
4003
4004 currCursorFrame = newCursorFrame;
4005 }
4006 }
4007
4008 private PickResult pickNode(PickRay pickRay) {
4009 PickResultChooser r = new PickResultChooser();
4010 Scene.this.getRoot().impl_pickNode(pickRay, r);
4011 return r.toPickResult();
4012 }
4013 }
4014
4015 /*******************************************************************************
4016 * *
4017 * Key Event Handling *
4018 * *
4019 ******************************************************************************/
4020
4021 class KeyHandler {
4022 private void setFocusOwner(final Node value) {
4023 // Cancel IM composition if there is one in progress.
4024 // This needs to be done before the focus owner is switched as it
4025 // generates event that needs to be delivered to the old focus owner.
4026 if (oldFocusOwner != null) {
4027 final Scene s = oldFocusOwner.getScene();
4028 if (s != null) {
4029 final TKScene peer = s.getPeer();
4030 if (peer != null) {
|
555 private void doCSSPass() {
556 final Parent sceneRoot = getRoot();
557 //
558 // RT-17547: when the tree is synchronized, the dirty bits are
559 // are cleared but the cssFlag might still be something other than
560 // clean.
561 //
562 // Before RT-17547, the code checked the dirty bit. But this is
563 // superfluous since the dirty bit will be set if the flag is not clean,
564 // but the flag will never be anything other than clean if the dirty
565 // bit is not set. The dirty bit is still needed, however, since setting
566 // it ensures a pulse if no other dirty bits have been set.
567 //
568 // For the purpose of showing the change, the dirty bit
569 // check code was commented out and not removed.
570 //
571 // if (sceneRoot.isDirty(com.sun.javafx.scene.DirtyBits.NODE_CSS)) {
572 if (sceneRoot.cssFlag != CssFlags.CLEAN) {
573 // The dirty bit isn't checked but we must ensure it is cleared.
574 // The cssFlag is set to clean in either Node.processCSS or
575 // NodeHelper.processCSS
576 sceneRoot.clearDirty(com.sun.javafx.scene.DirtyBits.NODE_CSS);
577 sceneRoot.processCSS();
578 }
579 }
580
581 void doLayoutPass() {
582 final Parent r = getRoot();
583 if (r != null) {
584 r.layout();
585 }
586 }
587
588 /**
589 * The peer of this scene
590 */
591 private TKScene peer;
592
593 /*
594 * Get Scene's peer
595 */
937 widthPropertyImpl().set(value);
938 }
939
940 public final double getWidth() {
941 return width == null ? 0.0 : width.get();
942 }
943
944 public final ReadOnlyDoubleProperty widthProperty() {
945 return widthPropertyImpl().getReadOnlyProperty();
946 }
947
948 private ReadOnlyDoubleWrapper widthPropertyImpl() {
949 if (width == null) {
950 width = new ReadOnlyDoubleWrapper() {
951
952 @Override
953 protected void invalidated() {
954 final Parent _root = getRoot();
955 //TODO - use a better method to update mirroring
956 if (_root.getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) {
957 NodeHelper.transformsChanged(_root);
958 }
959 if (_root.isResizable()) {
960 resizeRootOnSceneSizeChange(get() - _root.getLayoutX() - _root.getTranslateX(), _root.getLayoutBounds().getHeight());
961 }
962
963 getEffectiveCamera().setViewWidth(get());
964 }
965
966 @Override
967 public Object getBean() {
968 return Scene.this;
969 }
970
971 @Override
972 public String getName() {
973 return "width";
974 }
975 };
976 }
977 return width;
1602 }
1603 /**
1604 * A ObservableList of string URLs linking to the stylesheets to use with this scene's
1605 * contents. For additional information about using CSS with the
1606 * scene graph, see the <a href="doc-files/cssref.html">CSS Reference
1607 * Guide</a>.
1608 */
1609 private final ObservableList<String> stylesheets = new TrackableObservableList<String>() {
1610 @Override
1611 protected void onChanged(Change<String> c) {
1612 StyleManager.getInstance().stylesheetsChanged(Scene.this, c);
1613 // RT-9784 - if stylesheet is removed, reset styled properties to
1614 // their initial value.
1615 c.reset();
1616 while(c.next()) {
1617 if (c.wasRemoved() == false) {
1618 continue;
1619 }
1620 break; // no point in resetting more than once...
1621 }
1622 getRoot().reapplyCSS();
1623 }
1624 };
1625
1626 /**
1627 * Gets an observable list of string URLs linking to the stylesheets to use
1628 * with this scene's contents.
1629 * <p>
1630 * The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL
1631 * does not have a [scheme:] component, the URL is considered to be the [path] component only.
1632 * Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to
1633 * the root of the application's classpath.
1634 * </p>
1635 * <code><pre>
1636 *
1637 * package com.example.javafx.app;
1638 *
1639 * import javafx.application.Application;
1640 * import javafx.scene.Group;
1641 * import javafx.scene.Scene;
1642 * import javafx.stage.Stage;
1658 * For additional information about using CSS with the scene graph,
1659 * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1660 *
1661 * @return the list of stylesheets to use with this scene
1662 */
1663 public final ObservableList<String> getStylesheets() { return stylesheets; }
1664
1665 private ObjectProperty<String> userAgentStylesheet = null;
1666
1667 /**
1668 * @return the userAgentStylesheet property.
1669 * @see #getUserAgentStylesheet()
1670 * @see #setUserAgentStylesheet(String)
1671 * @since JavaFX 8u20
1672 */
1673 public final ObjectProperty<String> userAgentStylesheetProperty() {
1674 if (userAgentStylesheet == null) {
1675 userAgentStylesheet = new SimpleObjectProperty<String>(Scene.this, "userAgentStylesheet", null) {
1676 @Override protected void invalidated() {
1677 StyleManager.getInstance().forget(Scene.this);
1678 getRoot().reapplyCSS();
1679 }
1680 };
1681 }
1682 return userAgentStylesheet;
1683 }
1684
1685 /**
1686 * Get the URL of the user-agent stylesheet that will be used by this Scene. If the URL has not been set,
1687 * the platform-default user-agent stylesheet will be used.
1688 * <p>
1689 * For additional information about using CSS with the scene graph,
1690 * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1691 * </p>
1692 * @return The URL of the user-agent stylesheet that will be used by this Scene,
1693 * or null if has not been set.
1694 * @since JavaFX 8u20
1695 */
1696 public final String getUserAgentStylesheet() {
1697 return userAgentStylesheet == null ? null : userAgentStylesheet.get();
1698 }
3990 currCursor = newCursor;
3991 }
3992 }
3993
3994 public void updateCursorFrame() {
3995 final CursorFrame newCursorFrame =
3996 (currCursor != null)
3997 ? currCursor.getCurrentFrame()
3998 : Cursor.DEFAULT.getCurrentFrame();
3999 if (currCursorFrame != newCursorFrame) {
4000 if (Scene.this.peer != null) {
4001 Scene.this.peer.setCursor(newCursorFrame);
4002 }
4003
4004 currCursorFrame = newCursorFrame;
4005 }
4006 }
4007
4008 private PickResult pickNode(PickRay pickRay) {
4009 PickResultChooser r = new PickResultChooser();
4010 Scene.this.getRoot().pickNode(pickRay, r);
4011 return r.toPickResult();
4012 }
4013 }
4014
4015 /*******************************************************************************
4016 * *
4017 * Key Event Handling *
4018 * *
4019 ******************************************************************************/
4020
4021 class KeyHandler {
4022 private void setFocusOwner(final Node value) {
4023 // Cancel IM composition if there is one in progress.
4024 // This needs to be done before the focus owner is switched as it
4025 // generates event that needs to be delivered to the old focus owner.
4026 if (oldFocusOwner != null) {
4027 final Scene s = oldFocusOwner.getScene();
4028 if (s != null) {
4029 final TKScene peer = s.getPeer();
4030 if (peer != null) {
|