public class UpdateNode {
+ private UpdateNode parent;
private UpdateStatus status;
private UpdateOp op;
private Resource r;
private String label;
+ private boolean visible = true;
private Collection<UpdateNode> children = new ArrayList<UpdateNode>();
this.status = status;
this.op = op;
this.r = op.getResource();
- this.label = getLabel(g, r);
+ init(g);
}
public UpdateNode(ReadGraph g, UpdateStatus status, Resource r) throws DatabaseException {
this.status = status;
this.op = null;
this.r = r;
+ init(g);
+ }
+
+ protected void init(ReadGraph g) throws DatabaseException {
this.label = getLabel(g, r);
}
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);
public UpdateOp getOp() {
return op;
}
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ 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);
+ }
}