Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
f2597ce9
Commit
f2597ce9
authored
Nov 06, 2018
by
Lulu Luong
Browse files
#45
parent
587cb51a
Pipeline
#31419
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java
View file @
f2597ce9
...
...
@@ -20,6 +20,7 @@ import edu.kit.iti.formal.psdbg.examples.Examples;
import
edu.kit.iti.formal.psdbg.fmt.DefaultFormatter
;
import
edu.kit.iti.formal.psdbg.gui.ProofScriptDebugger
;
import
edu.kit.iti.formal.psdbg.gui.controls.*
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.AbstractTreeNode
;
import
edu.kit.iti.formal.psdbg.gui.graph.Graph
;
import
edu.kit.iti.formal.psdbg.gui.graph.GraphView
;
import
edu.kit.iti.formal.psdbg.gui.model.DebuggerMainModel
;
...
...
@@ -1325,7 +1326,7 @@ public class DebuggerMain implements Initializable {
if
(
startnode
==
null
)
return
;
stg
.
createGraph
(
startnode
,
FACADE
.
getProof
().
root
());
TreeItem
<
TreeNode
>
item
=
(
stg
.
toView
());
TreeItem
<
Abstract
TreeNode
>
item
=
(
stg
.
toView
());
scriptTreeView
.
setTree
(
item
);
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTree/AbstractTreeNode.java
View file @
f2597ce9
...
...
@@ -29,7 +29,7 @@ public class AbstractTreeNode {
}
public
TreeNode
toTreeNode
()
{
return
new
TreeNode
(
"
no to string method yet
"
,
null
);
return
new
TreeNode
(
"
Proof
"
,
null
);
}
}
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTreeGraph.java
View file @
f2597ce9
...
...
@@ -44,10 +44,7 @@ public class ScriptTreeGraph {
private
HashMap
<
Node
,
PTreeNode
>
foreachNodes
;
/**
* Contains color of nodes
*/
public
MapProperty
<
Node
,
String
>
colorOfNodes
=
new
SimpleMapProperty
<
Node
,
String
>(
FXCollections
.
observableHashMap
());
public
void
createGraph
(
PTreeNode
<
KeyData
>
rootPTreeNode
,
Node
root
)
{
...
...
@@ -174,30 +171,30 @@ public class ScriptTreeGraph {
}
mapping
.
size
();
mapping
.
forEach
((
node
,
abstractTreeNode
)
->
System
.
out
.
println
(
"node.serialNr() = "
+
node
.
serialNr
()
+
" "
+
abstractTreeNode
.
toTreeNode
().
label
));
//
mapping.forEach((node, abstractTreeNode) -> System.out.println("node.serialNr() = " + node.serialNr() + " " + abstractTreeNode.toTreeNode().label));
}
/**
* returns treeItem that represents current Script tree
* @return
*/
public
TreeItem
<
TreeNode
>
toView
()
{
TreeItem
<
TreeNode
>
treeItem
;
public
TreeItem
<
Abstract
TreeNode
>
toView
()
{
TreeItem
<
Abstract
TreeNode
>
treeItem
;
if
(
rootNode
==
null
)
{
treeItem
=
new
TreeItem
<>(
new
TreeNode
(
"Proof"
,
null
));
treeItem
=
new
TreeItem
<>(
new
Abstract
TreeNode
(
null
));
DummyGoalNode
dummy
=
new
DummyGoalNode
(
null
,
false
);
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
dummy
.
toTreeNode
()
));
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
dummy
));
return
treeItem
;
}
treeItem
=
new
TreeItem
<>(
new
TreeNode
(
"Proof"
,
rootNode
.
getNode
()
));
treeItem
=
new
TreeItem
<>(
new
Abstract
TreeNode
(
null
));
List
<
AbstractTreeNode
>
children
=
mapping
.
get
(
rootNode
.
getNode
()).
getChildren
();
if
(
children
==
null
)
return
treeItem
;
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
mapping
.
get
(
rootNode
.
getNode
())
.
toTreeNode
()
));
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
mapping
.
get
(
rootNode
.
getNode
())));
while
(
children
.
size
()
==
1
)
{
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
children
.
get
(
0
)
.
toTreeNode
()
));
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
children
.
get
(
0
)));
children
=
children
.
get
(
0
).
getChildren
();
if
(
children
==
null
)
return
treeItem
;
}
...
...
@@ -209,15 +206,15 @@ public class ScriptTreeGraph {
return
treeItem
;
}
private
TreeItem
<
TreeNode
>
rekursiveToView
(
AbstractTreeNode
current
){
TreeItem
<
TreeNode
>
treeItem
=
new
TreeItem
<>(
current
.
toTreeNode
()
);
//
private
TreeItem
<
Abstract
TreeNode
>
rekursiveToView
(
AbstractTreeNode
current
){
TreeItem
<
Abstract
TreeNode
>
treeItem
=
new
TreeItem
<>(
current
);
//
List
<
AbstractTreeNode
>
children
=
current
.
getChildren
();
while
(
children
!=
null
&&
children
.
size
()
==
1
)
{
if
(
children
.
get
(
0
)
==
null
)
return
treeItem
;
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
children
.
get
(
0
)
.
toTreeNode
()
));
treeItem
.
getChildren
().
add
(
new
TreeItem
<>(
children
.
get
(
0
)));
children
=
children
.
get
(
0
).
getChildren
();
}
if
(
children
==
null
)
{
...
...
@@ -554,8 +551,6 @@ public class ScriptTreeGraph {
}
colorOfNodes
.
putIfAbsent
(
branchlabels
.
get
(
i
).
getNode
(),
"gray"
);
}
...
...
@@ -580,54 +575,9 @@ public class ScriptTreeGraph {
front
.
forEach
(
k
->
replacePlaceholder
(
k
,
new
DummyGoalNode
(
k
,
k
.
isClosed
())));
}
private
TreeCell
<
TreeNode
>
cellFactory
(
TreeView
<
TreeNode
>
nodeTreeView
)
{
TextFieldTreeCell
<
TreeNode
>
tftc
=
new
TextFieldTreeCell
<>();
StringConverter
<
TreeNode
>
stringConverter
=
new
StringConverter
<
TreeNode
>()
{
@Override
public
String
toString
(
TreeNode
object
)
{
return
object
.
label
;
}
@Override
public
TreeNode
fromString
(
String
string
)
{
return
null
;
}
};
tftc
.
setConverter
(
stringConverter
);
tftc
.
itemProperty
().
addListener
((
p
,
o
,
n
)
->
{
if
(
n
!=
null
)
repaint
(
tftc
);
});
//colorOfNodes.addListener((InvalidationListener) o -> repaint(tftc));
return
tftc
;
}
private
void
repaint
(
TextFieldTreeCell
<
TreeNode
>
tftc
)
{
TreeNode
item
=
tftc
.
getItem
();
Node
n
=
item
.
node
;
tftc
.
setStyle
(
""
);
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
)
+
";"
);
}
}
//TODO for Screenshot tftc.setStyle("-fx-font-size: 18pt");
/* if (colorOfNodes.containsKey(n)) {
tftc.setStyle("-fx-border-color: "+colorOfNodes.get(n)+";");
}*/
}
//expandRootToItem(tftc.getTreeItem());
}
}
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTreeView.java
View file @
f2597ce9
...
...
@@ -2,10 +2,7 @@ package edu.kit.iti.formal.psdbg.gui.controls;
import
de.uka.ilkd.key.proof.Node
;
import
edu.kit.iti.formal.psdbg.gui.controller.DebuggerMain
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.AbstractTreeNode
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.BranchLabelNode
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.DummyGoalNode
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.ScriptTreeNode
;
import
edu.kit.iti.formal.psdbg.gui.controls.ScriptTree.*
;
import
javafx.beans.property.MapProperty
;
import
javafx.beans.property.SimpleMapProperty
;
import
javafx.collections.FXCollections
;
...
...
@@ -26,9 +23,15 @@ public class ScriptTreeView extends BorderPane {
@Setter
private
ScriptTreeGraph
stg
;
/**
* Contains color of nodes
*/
private
MapProperty
<
Node
,
String
>
colorOfNodes
=
new
SimpleMapProperty
<
Node
,
String
>(
FXCollections
.
observableHashMap
());
@FXML
TreeView
<
TreeNode
>
treeView
;
TreeView
<
AbstractTreeNode
>
treeView
;
public
ScriptTreeView
(
DebuggerMain
main
)
{
Utils
.
createWithFXML
(
this
);
...
...
@@ -36,21 +39,21 @@ public class ScriptTreeView extends BorderPane {
}
public
void
setTree
(
TreeItem
<
TreeNode
>
tree
)
{
public
void
setTree
(
TreeItem
<
Abstract
TreeNode
>
tree
)
{
treeView
.
setRoot
(
tree
);
}
private
TreeCell
<
TreeNode
>
cellFactory
(
TreeView
<
TreeNode
>
nodeTreeView
)
{
private
TreeCell
<
Abstract
TreeNode
>
cellFactory
(
TreeView
<
Abstract
TreeNode
>
nodeTreeView
)
{
TextFieldTreeCell
<
TreeNode
>
tftc
=
new
TextFieldTreeCell
<>();
StringConverter
<
TreeNode
>
stringConverter
=
new
StringConverter
<
TreeNode
>()
{
TextFieldTreeCell
<
Abstract
TreeNode
>
tftc
=
new
TextFieldTreeCell
<>();
StringConverter
<
Abstract
TreeNode
>
stringConverter
=
new
StringConverter
<
Abstract
TreeNode
>()
{
@Override
public
String
toString
(
TreeNode
object
)
{
return
object
.
label
;
public
String
toString
(
Abstract
TreeNode
object
)
{
return
object
.
toTreeNode
().
label
;
}
@Override
public
TreeNode
fromString
(
String
string
)
{
public
Abstract
TreeNode
fromString
(
String
string
)
{
return
null
;
}
};
...
...
@@ -123,24 +126,35 @@ public class ScriptTreeView extends BorderPane {
return treeItem;
}
*/
private
void
repaint
(
TextFieldTreeCell
<
TreeNode
>
tftc
)
{
TreeNode
item
=
tftc
.
getItem
();
Node
n
=
item
.
n
ode
;
private
void
repaint
(
TextFieldTreeCell
<
Abstract
TreeNode
>
tftc
)
{
Abstract
TreeNode
item
=
tftc
.
getItem
();
Node
n
=
item
.
getN
ode
()
;
tftc
.
setStyle
(
""
);
if
(
n
!=
null
)
{
if
(
n
.
leaf
()
&&
!
item
.
label
.
contains
(
"BRANCH"
))
{
if
(
item
instanceof
ScriptTreeNode
)
{
tftc
.
setStyle
(
"-fx-text-fill: grey"
);
}
else
if
(
item
instanceof
BranchLabelNode
)
{
tftc
.
setStyle
(
"-fx-text-fill: blue"
);
}
else
if
(
item
instanceof
ForeachTreeNode
)
{
}
else
if
(
item
instanceof
DummyGoalNode
)
{
if
(
n
.
isClosed
())
{
stg
.
colorOfNodes
.
putIfAbsent
(
n
,
"lightseagreen"
);
//tftc.setStyle("-fx-background-color: greenyellow");
tftc
.
setStyle
(
"-fx-background-color: lightgreen"
);
}
else
{
stg
.
colorOfNodes
.
putIfAbsent
(
n
,
"indianred"
);
tftc
.
setStyle
(
"-fx-background-color: indianred"
);
//colorOfNodes.putIfAbsent(n, "indianred");
}
}
//tftc.setStyle("-fx-background-color: greenyellow");
//tftc.setStyle("-fx-background-color: " + stg.colorOfNodes.get(n) + ";");
if
(
stg
.
colorOfNodes
.
containsKey
(
n
))
{
tftc
.
setStyle
(
"-fx-background-color: "
+
stg
.
colorOfNodes
.
get
(
n
)
+
";"
);
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment