X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2FPipelineComponent.java;h=735916db6df2b31a0bae9bf7c880ce29c4d95194;hb=eb67906ff85a83b2f71b823110e5c3d12da8bfc2;hp=c0feb668d183ff090dad98fa81ed844cce02ab0b;hpb=a1e1faa6915445e786f482170576b9c9d0f5d982;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java index c0feb668..735916db 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java @@ -133,17 +133,20 @@ public abstract class PipelineComponent extends GeometryNode { @RelatedSetObj(Plant3D.URIs.HasNext) public void setNext(PipelineComponent comp) { if (next == comp) - return; + return; if (this.next != null) - this.next._removeRef(this); - this.next = comp; - this.syncnext = false; - if (DEBUG) System.out.println(this + " next " + comp); - syncNext(); - firePropertyChanged(Plant3D.URIs.HasNext); - if (comp != null) - comp.sync(); - + this.next._removeRef(this); + _setNext(comp); + this.syncnext = false; + if (DEBUG) System.out.println(this + " next " + comp); + syncNext(); + firePropertyChanged(Plant3D.URIs.HasNext); + if (comp != null) + comp.sync(); + } + + protected void _setNext(PipelineComponent comp) { + this.next = comp; } @@ -158,15 +161,19 @@ public abstract class PipelineComponent extends GeometryNode { return; if (this.previous != null) this.previous._removeRef(this); - this.previous = comp; + _setPrevious(comp); this.syncprev = false; if (DEBUG) System.out.println(this + " prev " + comp); syncPrevious(); firePropertyChanged(Plant3D.URIs.HasPrevious); if (comp != null) comp.sync(); - } + + protected void _setPrevious(PipelineComponent comp) { + this.previous = comp; + } + private PipelineComponent branch0; @RelatedGetObj(Plant3D.URIs.HasBranch0) @@ -264,13 +271,13 @@ public abstract class PipelineComponent extends GeometryNode { // Control point structure is left into illegal state. private void _removeRef(PipelineComponent comp) { if (next == comp) { - next = null; + _setNext(null); syncnext = false; if (DEBUG) System.out.println(this + " remove next " + comp); firePropertyChanged(Plant3D.URIs.HasNext); syncNext(); } else if (previous == comp) { - previous = null; + _setPrevious(null); syncprev = false; if (DEBUG) System.out.println(this + " remove prev " + comp); firePropertyChanged(Plant3D.URIs.HasPrevious);