Commit 0de0b416 authored by Sarah Grebing's avatar Sarah Grebing

Fix for coloring of nodes

parent a20c0eba
Pipeline #16881 failed with stages
in 105 minutes and 57 seconds
......@@ -1119,6 +1119,7 @@ public class DebuggerMain implements Initializable {
ptree.setProof(proof);
ptree.setRoot(pnode);
ptree.addNodeColor(pnode, "blueviolet");
ptree.setDeactivateRefresh(true);
......@@ -1133,20 +1134,23 @@ public class DebuggerMain implements Initializable {
.map(Goal::node)
.collect(Collectors.toSet());
ptree.getSentinels().addAll(sentinels);
sentinels.forEach(node -> ptree.addNodeColor(node, "blueviolet"));
} else {
Set<Node> sentinels = new HashSet<>();
Iterator<Node> nodeIterator = beforeNode.getData().getNode().leavesIterator();
while (nodeIterator.hasNext()) {
Node next = nodeIterator.next();
sentinels.add(next.parent());
sentinels.add(next);
}
ptree.getSentinels().addAll(sentinels);
sentinels.forEach(node -> ptree.addNodeColor(node, "blueviolet"));
//traverseProofTreeAndAddSentinelsToLeaves();
}
ptree.expandRootToLeaves();
ptree.expandRootToSentinels();
//TODO set coloring of starting and end node
DockNode node = new DockNode(ptree, "Proof Tree for Step Into: " +
original.getStatement().accept(new ShortCommandPrinter())
......
......@@ -14,6 +14,7 @@ import javafx.application.Platform;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;
import javafx.collections.ObservableSet;
import javafx.fxml.FXML;
import javafx.scene.control.*;
......@@ -42,7 +43,7 @@ public class ProofTree extends BorderPane {
private SetProperty<Node> sentinels = new SimpleSetProperty<>(FXCollections.observableSet());
private MapProperty colorOfNodes = new SimpleMapProperty<>(FXCollections.observableHashMap());
private MapProperty<Node, String> colorOfNodes = new SimpleMapProperty<Node, String>(FXCollections.observableHashMap());
@FXML
private TreeView<TreeNode> treeProof;
......@@ -128,6 +129,7 @@ public class ProofTree extends BorderPane {
*
* @param candidate
*/
private static void expandRootToItem(TreeItem candidate) {
if (candidate != null) {
expandRootToItem(candidate.getParent());
......@@ -156,14 +158,17 @@ public class ProofTree extends BorderPane {
}
}
public void addNodeColor() {
public void addNodeColor(Node n, String color) {
this.colorOfNodes.put(n, color);
}
public void expandRootToLeaves() {
public void expandRootToSentinels() {
if (getTreeProof().getRoot() == null) {
if (root.get() != null) {
TreeItem<TreeNode> item = populate(root.get().serialNr() + ": " + toString(root.get()), root.get());
//new TreeItem<>(new TreeNode(root.get().serialNr() + ": " + toString(root.get()), root.get()));
TreeItem<TreeNode> item = populate("Proof", root.get());
//populate(root.get().serialNr() + ": " + toString(root.get()), root.get());
//val treeNode = new TreeNode("Proof", root.get());
treeProof.setRoot(item);
}
......@@ -171,6 +176,7 @@ public class ProofTree extends BorderPane {
//expandRootToLeaves(getTreeProof().getRoot());
}
public TreeView<TreeNode> getTreeProof() {
return treeProof;
}
......@@ -416,38 +422,47 @@ public class ProofTree extends BorderPane {
TreeNode item = tftc.getItem();
Node n = item.node;
tftc.setStyle("");
if (n != null && n.leaf() && !item.label.contains("BRANCH")) {
if (n.isClosed()) {
colorOfNodes.putIfAbsent(n, "seagreen");
//tftc.setStyle("-fx-background-color: greenyellow");
} else {
colorOfNodes.putIfAbsent(n, "darkred");
}
if (colorOfNodes.containsKey(n)) {
tftc.setStyle("-fx-background-color: " + colorOfNodes.get(n) + ";");
if (n != null) {
if (n.leaf() && !item.label.contains("BRANCH")) {
if (n.isClosed()) {
colorOfNodes.putIfAbsent(n, "lightseagreen");
//tftc.setStyle("-fx-background-color: greenyellow");
} else {
colorOfNodes.putIfAbsent(n, "indianred");
}
if (colorOfNodes.containsKey(n)) {
tftc.setStyle("-fx-background-color: " + colorOfNodes.get(n) + ";");
}
}
/* if (colorOfNodes.containsKey(n)) {
tftc.setStyle("-fx-border-color: "+colorOfNodes.get(n)+";");
}*/
}
expandRootToItem(tftc.getTreeItem());
}
public Object getColorOfNodes() {
return colorOfNodes.get();
public MapProperty<Node, String> colorOfNodesProperty() {
return colorOfNodes;
}
public void setColorOfNodes(Object colorOfNodes) {
this.colorOfNodes.set(colorOfNodes);
public ObservableMap<Node, String> getColorOfNodes() {
return colorOfNodes.get();
}
public MapProperty colorOfNodesProperty() {
return colorOfNodes;
public void setColorOfNodes(ObservableMap<Node, String> colorOfNodes) {
this.colorOfNodes.set(colorOfNodes);
}
public Node getRoot() {
return root.get();
}
public void setRoot(Node root) {
this.root.set(root);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment