PGNode and associated interfaces now removed

Richard Bair richard.bair at
Wed Jul 10 21:59:12 PDT 2013

I have just fixed, an old long-standing bit of technical debt. The short summary is, instead of each NG node implementing a PG node an the scene graph Nodes working with those peers via the PG interface, they now talk to the NG nodes directly. This is possible now that all the code is in the graphics module (instead of spread around the universe in the old project structure).

The longest part of this patch (some 6 hours by my reckoning) was in refactoring the Scene Graph tests so that they would continue to function as before. Instead of having StubRectangle implementing PGRectangle (and having a factory creation method in StubToolkit), the RectangleTest now handles this book keeping internally. Example can be found at the end of this message.

The net result is that we no longer have createPGXXX methods on Toolkit, and we now can work directly against the NG nodes. Each Scene Graph node creates its NG node directly. This was virtually 100% a simple translation of unrolling "cake" (other than the tests).


    public static final class StubRectangle extends Rectangle {
        public StubRectangle() {

        public StubRectangle(double width, double height) {
            super(width, height);

        public StubRectangle(double width, double height, Paint fill) {
            super(width, height, fill);

        public StubRectangle(double x, double y, double width, double height) {
            super(x, y, width, height);

        protected NGNode impl_createPeer() {
            return new StubNGRectangle();

    public static final class StubNGRectangle extends NGRectangle {
        // for tests
        private float x;
        private float y;
        private float width;
        private float height;
        private float arcWidth;
        private float arcHeight;

        public void setX(float x) {this.x = x;}
        public void setY(float y) {this.y = y;}
        public void setWidth(float width) {this.width = width;}
        public void setHeight(float height) {this.height = height;}
        public void setArcWidth(float arcWidth) {this.arcWidth = arcWidth;}
        public void setArcHeight(float arcHeight) {this.arcHeight = arcHeight;}
        public float getArcHeight() {return arcHeight;}
        public float getArcWidth() {return arcWidth;}
        public float getHeight() {return height;}
        public float getWidth() {return width;}
        public float getX() {return x;}
        public float getY() {return y;}

        public void updateRectangle(float x, float y, float width, float height, float arcWidth, float arcHeight) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.arcWidth = arcWidth;
            this.arcHeight = arcHeight;

        private BaseTransform transformMatrix;
        public void setTransformMatrix(BaseTransform tx) {
            this.transformMatrix = tx;

        public BaseTransform getTransformMatrix() {
            return transformMatrix;

More information about the openjfx-dev mailing list