Commit 00595db7 authored by Lulu Luong's avatar Lulu Luong

variable assigment window added

parent 6ede00a5
Pipeline #28102 passed with stages
in 3 minutes and 9 seconds
......@@ -123,6 +123,9 @@ public class KeyData {
return programStatementsLabel;
}
public void getVarAssignment() {
}
public Goal getGoal() {
return goal;
......
......@@ -3,13 +3,15 @@ package edu.kit.iti.formal.psdbg.gui.controls;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.util.function.Function;
......@@ -20,6 +22,9 @@ public class GoalOptionsMenu extends ContextMenu {
@FXML
private RadioMenuItem rmiShowSequent, rmiCFL, rmiCFS, rmiBranchLabels, rmiNodeNames, rmiRuleNames;
@FXML
private MenuItem showVarAssignment;
private ObjectProperty<ViewOption> selectedViewOption = new SimpleObjectProperty<>();
private BiMap<Toggle, ViewOption> optionMap = HashBiMap.create(6);
......@@ -44,6 +49,24 @@ public class GoalOptionsMenu extends ContextMenu {
});
selectedViewOption.setValue(ViewOption.SEQUENT);
showVarAssignment.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Show Variable Assignment pressed");
//TODO: get var assign info
VariableAssignment varAssign = null;
Stage stage = new Stage();
stage.setTitle("Variable Assignment");
VariableAssignmentWindow vaw = new VariableAssignmentWindow(varAssign);
Scene scene = new Scene(vaw);
stage.setScene(scene);
stage.show();
}
});
}
......@@ -67,6 +90,7 @@ public class GoalOptionsMenu extends ContextMenu {
NAME(KeyData::getNameLabel),
SEQUENT(item -> item.getNode().sequent().toString());
private final Function<KeyData, String> projection;
ViewOption(Function<KeyData, String> toString) {
......@@ -77,4 +101,6 @@ public class GoalOptionsMenu extends ContextMenu {
return projection.apply(item);
}
}
}
\ No newline at end of file
package edu.kit.iti.formal.psdbg.gui.controls;
import edu.kit.iti.formal.psdbg.gui.controls.Utils;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.BorderPane;
public class VariableAssignmentWindow extends BorderPane {
@FXML
TableView tableView;
public VariableAssignmentWindow(VariableAssignment assignment) {
Utils.createWithFXML(this);
tableView.setEditable(false);
TableColumn varCol = new TableColumn("Variable");
TableColumn typeCol = new TableColumn("Type");
TableColumn valCol = new TableColumn("Value");
tableView.getColumns().addAll(varCol, typeCol, valCol);
if(assignment != null) {
//iterate over types map
assignment.getTypes().forEach((k,v) -> {
varCol.getColumns().add(k);
typeCol.getColumns().add(v);
valCol.getColumns().add(assignment.getValue(k));
});
}
}
}
......@@ -15,6 +15,8 @@
<RadioMenuItem fx:id="rmiNodeNames" text="Show _Node Names " toggleGroup="$toggleProjection"/>
<RadioMenuItem fx:id="rmiRuleNames" text="Show _Rule Names " toggleGroup="$toggleProjection"/>
<MenuItem fx:id="showVarAssignment" text="Show _Variable Assignment" />
<Menu fx:id="a" text="Filter by...">
<MenuItem fx:id="removeFilter" text="Remove Filters"/>
<SeparatorMenuItem/>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
type="edu.kit.iti.formal.psdbg.gui.controls.VariableAssignmentWindow"
prefHeight="400.0" prefWidth="600.0">
<center>
<TableView fx:id="tableView"></TableView>
</center>
</fx: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