Commit 984a7e74 authored by Sarah Grebing's avatar Sarah Grebing

Now with first version of contractchooser which also allows to choose a contract and load it

parent 06ee58fb
Pipeline #10906 failed with stage
in 1 minute and 54 seconds
...@@ -4,6 +4,7 @@ import de.uka.ilkd.key.speclang.Contract; ...@@ -4,6 +4,7 @@ import de.uka.ilkd.key.speclang.Contract;
import javafx.beans.property.SimpleListProperty; import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import lombok.Getter;
import org.controlsfx.dialog.WizardPane; import org.controlsfx.dialog.WizardPane;
/** /**
...@@ -12,6 +13,7 @@ import org.controlsfx.dialog.WizardPane; ...@@ -12,6 +13,7 @@ import org.controlsfx.dialog.WizardPane;
public class ContractChooser extends WizardPane { public class ContractChooser extends WizardPane {
ListView listOfContractsView; ListView listOfContractsView;
@Getter
SimpleObjectProperty<Contract> chosen; SimpleObjectProperty<Contract> chosen;
public ContractChooser(SimpleListProperty<Contract> contracts, Contract chosenContract) { public ContractChooser(SimpleListProperty<Contract> contracts, Contract chosenContract) {
...@@ -28,6 +30,7 @@ public class ContractChooser extends WizardPane { ...@@ -28,6 +30,7 @@ public class ContractChooser extends WizardPane {
this.listOfContractsView.setVisible(true); this.listOfContractsView.setVisible(true);
this.setContent(listOfContractsView); this.setContent(listOfContractsView);
this.setVisible(true); this.setVisible(true);
this.chosen = new SimpleObjectProperty<Contract>();
} }
} }
...@@ -7,6 +7,7 @@ import edu.kit.formal.interpreter.KeYProofFacade; ...@@ -7,6 +7,7 @@ import edu.kit.formal.interpreter.KeYProofFacade;
import edu.kit.formal.interpreter.data.GoalNode; import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.dbg.Debugger; import edu.kit.formal.interpreter.dbg.Debugger;
import javafx.beans.property.SimpleObjectProperty;
import javafx.concurrent.Service; import javafx.concurrent.Service;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
...@@ -134,29 +135,38 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -134,29 +135,38 @@ public class DebuggerMainWindowController implements Initializable {
protected void loadJavaFile() { protected void loadJavaFile() {
File javaFile = openFileChooserDialog("Select Java File", "Java Files", "java", "script"); File javaFile = openFileChooserDialog("Select Java File", "Java Files", "java", "script");
this.model.setJavaFile(javaFile); this.model.setJavaFile(javaFile);
if (javaFile != null) { if (javaFile != null) {
facade = new KeYProofFacade(model); facade = new KeYProofFacade(model);
cls.setRefToRootModel(this.model); cls.setRefToRootModel(this.model);
cls.start(); cls.start();
cls.setOnSucceeded(event -> { cls.setOnSucceeded(event -> {
model.getLoadedContracts().addAll((List<Contract>) event.getSource().getValue()); model.getLoadedContracts().addAll((List<Contract>) event.getSource().getValue());
contractChooserDialog.setFlow(new Wizard.LinearFlow(new ContractChooser(this.model.loadedContractsProperty(), this.model.getChosenContract()))); ContractChooser page = new ContractChooser(this.model.loadedContractsProperty(), this.model.getChosenContract());
// contractChooserDialog.setFlow(new Wizard.LinearFlow(new ContractChooser(this.model.loadedContractsProperty(), this.model.getChosenContract())));
contractChooserDialog.showAndWait().ifPresent(result -> { contractChooserDialog.setFlow(new Wizard.LinearFlow(page));
contractChooserDialog.showAndWait().ifPresent(result -> {
if (result == ButtonType.FINISH) { if (result == ButtonType.FINISH) {
// System.out.println(contractChooserDialog.getSettings());
System.out.println("Wizard finished, loaded contracts: " + model.getChosenContract()); SimpleObjectProperty<Contract> chosenContractProp = page.getChosen();
model.setChosenContract(chosenContractProp.getValue());
if (this.model.getChosenContract() != null) {
buildJavaProofFacade();
System.out.println("Proof Facade is built");
} else {
System.out.println("Something went wrong");
}
} }
}); });
}); });
/*
if (chosen != null) {
this.model.setChosenContract(chosen);
buildJavaProofFacade();
}*/
} }
} }
......
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