]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java
Added new interface for user filters
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / model / UpdateNode.java
index 3a7953174bd3ffb6b080af45cbe8f039ed5ced72..b786586c9a3daef1c2b562707e1b07779d107a54 100644 (file)
@@ -12,6 +12,7 @@ import org.simantics.layer0.Layer0;
 
 public class UpdateNode {
 
+    private UpdateNode parent;
        private UpdateStatus status;
        private UpdateOp op;
        private Resource r;
@@ -69,6 +70,7 @@ public class UpdateNode {
        
        public void addChild(UpdateNode node) {
                children.add(node);
+               node.parent = this;
                if (op != null && node.op != null) {
                        if (!op.getSubOps().contains(node.op)) {
                                op.addSubOp(node.op);
@@ -111,6 +113,21 @@ public class UpdateNode {
                this.visible = visible;
                if (op != null)
                        op.visible = visible;
+               if (visible) {
+                   if (parent != null && !parent.visible)
+                       parent.setVisible(true);
+               } else {
+                   for (UpdateNode n : children)
+                       n.setVisible(false);
+               }
        }
+       
+       public void setAllVisible(boolean visible) {
+        this.visible = visible;
+        if (op != null)
+            op.visible = visible;
+        for (UpdateNode n : children)
+             n.setAllVisible(visible);
+    }
 
 }