Commit e5c867a9 authored by Sarah Grebing's avatar Sarah Grebing

Reworked some bindings and corrected formatting

parent 539f3116
Pipeline #10848 failed with stage
in 1 minute and 44 seconds
......@@ -17,13 +17,13 @@
<developer>
<name>Sarah Grebing</name>
<email>sarah.grebing@kit.edu</email>
<organization>Karlruhe Institute of Technology</organization>
<organization>Karlsruhe Institute of Technology</organization>
</developer>
<developer>
<name>Alexander Weigl</name>
<email>weigl@kit.edu</email>
<organization>Karlruhe Institute of Technology</organization>
<organization>Karlsruhe Institute of Technology</organization>
</developer>
</developers>
......
package edu.kit.formal.gui;/**
* Created by sarah on 5/26/17.
package edu.kit.formal.gui;
/**
* Main Entry for Debugger GUI
* @author S. Grebing
*/
import edu.kit.formal.gui.controller.DebuggerMainWindowController;
......
......@@ -2,7 +2,6 @@ package edu.kit.formal.gui.controller;
import edu.kit.formal.gui.FileUtils;
import edu.kit.formal.gui.model.RootModel;
import edu.kit.formal.interpreter.Interpreter;
import edu.kit.formal.interpreter.KeYProofFacade;
import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData;
......@@ -32,12 +31,12 @@ public class DebuggerMainWindowController implements Initializable {
Pane rootPane;
@FXML
SplitPane splitPane;
@FXML
ScrollPane scrollPaneCode;
/***********************************************************************************************************
* Code Area
* **********************************************************************************************************/
@FXML
ScrollPane scrollPaneCode;
@FXML
ScriptArea scriptArea;
/***********************************************************************************************************
......@@ -65,11 +64,15 @@ public class DebuggerMainWindowController implements Initializable {
ListGoalView goalView;
ExecutorService executorService = null;
KeYProofFacade facade;
/**
* Model for the DebuggerController containing the neccessary references to objects needed for controlling backend through UI
*/
private RootModel model;
@Setter
private Interpreter<KeyData> interpreter;
@Setter
private Debugger debugger;
private Stage stage;
@FXML
......@@ -104,7 +107,9 @@ public class DebuggerMainWindowController implements Initializable {
protected void loadKeYFile() {
File keyFile = openFileChooserDialog("Select KeY File", "KeY Files", "key", "java", "script");
this.model.setKeYFile(keyFile);
buildKeYProofFacade();
if (keyFile != null) {
buildKeYProofFacade();
}
}
......@@ -113,26 +118,18 @@ public class DebuggerMainWindowController implements Initializable {
this.stage = stage;
}
/**
* @param title
* @param description
* @param fileEndings
* @return
* Needs to be set from calling method
* @param model
*/
private File openFileChooserDialog(String title, String description, String... fileEndings) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(title);
fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(description, fileEndings));
fileChooser.setInitialDirectory(new File("/home/sarah/Documents/KIT_Mitarbeiter/ProofScriptingLanguage/src/test/resources/edu/kit/formal/interpreter/contraposition/"));
File file = fileChooser.showOpenDialog(this.stage);
return file;
}
public void setModel(RootModel model) {
this.model = model;
}
/**
*
*/
public void init() {
facade = new KeYProofFacade(this.model);
scriptArea.setRootModel(this.model);
......@@ -148,6 +145,9 @@ public class DebuggerMainWindowController implements Initializable {
}
/**
* Spawns a thread that builds the proof environment as facade with interpreter
*/
private void buildKeYProofFacade() {
executorService = Executors.newFixedThreadPool(2);
executorService.execute(() -> {
......@@ -159,4 +159,23 @@ public class DebuggerMainWindowController implements Initializable {
}
/**
* Creates a filechooser dialog
*
* @param title of the dialog
* @param description of the files
* @param fileEndings file that should be shown
* @return
*/
private File openFileChooserDialog(String title, String description, String... fileEndings) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(title);
fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(description, fileEndings));
fileChooser.setInitialDirectory(new File("/home/sarah/Documents/KIT_Mitarbeiter/ProofScriptingLanguage/src/test/resources/edu/kit/formal/interpreter/contraposition/"));
File file = fileChooser.showOpenDialog(this.stage);
return file;
}
}
......@@ -3,6 +3,9 @@ package edu.kit.formal.gui.controller;
import edu.kit.formal.gui.model.RootModel;
import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ListCell;
......@@ -16,9 +19,9 @@ import java.io.IOException;
* Created by sarah on 5/27/17.
*/
public class ListGoalView extends VBox {
protected SimpleListProperty<GoalNode<KeyData>> localGoalListProperty = new SimpleListProperty<>();
@FXML
private ListView<GoalNode<KeyData>> listOfGoals;
private ListView<GoalNode<KeyData>> listOfGoalsView;
@FXML
private TextArea goalNodeView;
......@@ -37,7 +40,7 @@ public class ListGoalView extends VBox {
throw new RuntimeException(exception);
}
listOfGoals.setCellFactory(list -> new GoalNodeCell());
listOfGoalsView.setCellFactory(list -> new GoalNodeCell());
}
......@@ -46,12 +49,22 @@ public class ListGoalView extends VBox {
this.rootModel = rootModel;
}
/**
* Set Bindings and listener
*/
public void init() {
this.listOfGoals.itemsProperty().bind(this.rootModel.currentGoalNodesProperty());
// this.listOfGoals.itemsProperty().bind(this.rootModel.currentGoalNodesProperty());
goalNodeView.textProperty().bind(listOfGoals.getSelectionModel().selectedItemProperty().asString());
listOfGoalsView.itemsProperty().bind(this.rootModel.currentGoalNodesProperty());
listOfGoalsView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<GoalNode<KeyData>>() {
@Override
public void changed(ObservableValue<? extends GoalNode<KeyData>> observable, GoalNode<KeyData> oldValue, GoalNode<KeyData> newValue) {
goalNodeView.setText(newValue.toCellTextForKeYData());
}
});
}
private static class GoalNodeCell extends ListCell<GoalNode<KeyData>> {
@Override
......
......@@ -10,32 +10,32 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.Getter;
import lombok.Setter;
import java.io.File;
/**
* Model for the root window
* Created by sarah on 5/26/17.
* @author S. Grebing
*/
public class RootModel {
/**
* Current laoded ScriptFile
* Property: current loaded ScriptFile
*/
private final SimpleObjectProperty<File> scriptFile;
/**
* Current loaded KeY File
* Property: current loaded KeY File
*/
private final SimpleObjectProperty<File> keYFile;
/**
* Current loaded script string
* Property: current loaded script string
*/
private final SimpleObjectProperty<String> currentScript;
/**
* The list of goal nodes in the current state (depending on interpreter state)
* ListProperty: list of goal nodes in the current state (depending on interpreter state)
*/
private ListProperty<GoalNode<KeyData>> currentGoalNodes;
......@@ -45,6 +45,7 @@ public class RootModel {
private SimpleObjectProperty<GoalNode<KeyData>> currentSelectedGoalNode;
@Getter
@Setter
private State<KeyData> currentState;
......@@ -57,18 +58,10 @@ public class RootModel {
}
public GoalNode<KeyData> getCurrentSelectedGoalNode() {
return currentSelectedGoalNode.get();
}
public void setCurrentSelectedGoalNode(GoalNode currentSelectedGoalNode) {
this.currentSelectedGoalNode.set(currentSelectedGoalNode);
}
public SimpleObjectProperty<GoalNode<KeyData>> currentSelectedGoalNodeProperty() {
return currentSelectedGoalNode;
}
/*****************************************************************************************************************
* Property Getter and Setter
***************************************************************************************************************/
public File getScriptFile() {
return scriptFile.get();
}
......@@ -117,8 +110,19 @@ public class RootModel {
return currentGoalNodes;
}
public GoalNode<KeyData> getCurrentSelectedGoalNode() {
return currentSelectedGoalNode.get();
}
public void setCurrentState(State<KeyData> currentState) {
this.currentState = currentState;
public void setCurrentSelectedGoalNode(GoalNode<KeyData> currentSelectedGoalNode) {
this.currentSelectedGoalNode.set(currentSelectedGoalNode);
}
public SimpleObjectProperty<GoalNode<KeyData>> currentSelectedGoalNodeProperty() {
return currentSelectedGoalNode;
}
}
......@@ -46,7 +46,7 @@
AnchorPane.topAnchor="0.0"
SplitPane.resizableWithParent="true">
<!--<children>
<ListView fx:id="listOfGoals" prefHeight="200.0" prefWidth="200.0"/>
<ListView fx:id="listOfGoalsView" prefHeight="200.0" prefWidth="200.0"/>
<TextArea fx:id="goalNodeView" prefHeight="200.0" prefWidth="200.0"/>
</children>-->
</ListGoalView>
......
......@@ -4,7 +4,7 @@
<fx:root xmlns:fx="http://javafx.com/fxml" type="javafx.scene.layout.VBox"
prefHeight="369.0" prefWidth="295.0">
<children>
<ListView fx:id="listOfGoals" prefHeight="200.0" prefWidth="200.0"/>
<ListView fx:id="listOfGoalsView" prefHeight="200.0" prefWidth="200.0"/>
<TextArea fx:id="goalNodeView" prefHeight="200.0" prefWidth="200.0"/>
</children>
</fx:root>
\ No newline at end of file
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