Commit 1d505095 authored by LULUDBR\Lulu's avatar LULUDBR\Lulu
Browse files

goal wrench added

parent a07f27ac
...@@ -8,15 +8,16 @@ import edu.kit.iti.formal.psdbg.interpreter.data.KeyData; ...@@ -8,15 +8,16 @@ import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade; import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade;
import edu.kit.iti.formal.psdbg.termmatcher.Matchings; import edu.kit.iti.formal.psdbg.termmatcher.Matchings;
import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath; import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath;
import javafx.beans.property.ListProperty; import javafx.beans.Observable;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.*;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import java.util.Collections; import java.util.Collections;
...@@ -26,6 +27,8 @@ import java.util.Map; ...@@ -26,6 +27,8 @@ import java.util.Map;
public class SequentMatcher extends BorderPane { public class SequentMatcher extends BorderPane {
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
@FXML @FXML
private SequentView sequentView; private SequentView sequentView;
...@@ -43,6 +46,7 @@ public class SequentMatcher extends BorderPane { ...@@ -43,6 +46,7 @@ public class SequentMatcher extends BorderPane {
public SequentMatcher() { public SequentMatcher() {
Utils.createWithFXML(this); Utils.createWithFXML(this);
selectedGoalNodeToShow.addListener((observable, oldValue, newValue) -> { selectedGoalNodeToShow.addListener((observable, oldValue, newValue) -> {
sequentView.setGoal(newValue.getData().getGoal()); sequentView.setGoal(newValue.getData().getGoal());
sequentView.setNode(newValue.getData().getNode()); sequentView.setNode(newValue.getData().getNode());
...@@ -55,6 +59,9 @@ public class SequentMatcher extends BorderPane { ...@@ -55,6 +59,9 @@ public class SequentMatcher extends BorderPane {
selectedGoalNodeToShow.setValue(nnew) selectedGoalNodeToShow.setValue(nnew)
); );
goalView.setCellFactory(GoalNodeListCell::new);
goals.addListener((observable, oldValue, newValue) -> goalView.setItems(newValue)); goals.addListener((observable, oldValue, newValue) -> goalView.setItems(newValue));
matchingsView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { matchingsView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
...@@ -90,6 +97,11 @@ public class SequentMatcher extends BorderPane { ...@@ -90,6 +97,11 @@ public class SequentMatcher extends BorderPane {
} }
} }
public void showGoalOptions(MouseEvent actionEvent) {
Node n = (Node) actionEvent.getTarget();
goalOptionsMenu.show(n, actionEvent.getScreenX(), actionEvent.getScreenY());
}
public void startMatch() { public void startMatch() {
Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true); Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings); ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
...@@ -152,6 +164,7 @@ public class SequentMatcher extends BorderPane { ...@@ -152,6 +164,7 @@ public class SequentMatcher extends BorderPane {
} }
public void setSelectedGoalNodeToShow(GoalNode<KeyData> selectedGoalNodeToShow) { public void setSelectedGoalNodeToShow(GoalNode<KeyData> selectedGoalNodeToShow) {
this.selectedGoalNodeToShow.set(selectedGoalNodeToShow); this.selectedGoalNodeToShow.set(selectedGoalNodeToShow);
} }
...@@ -172,4 +185,29 @@ public class SequentMatcher extends BorderPane { ...@@ -172,4 +185,29 @@ public class SequentMatcher extends BorderPane {
public void setMatchingresults(ObservableList<GoalNode<KeyData>> matchingresults) { public void setMatchingresults(ObservableList<GoalNode<KeyData>> matchingresults) {
this.matchingresults.set(matchingresults); this.matchingresults.set(matchingresults);
} }
/**
* Cells for GoalView
*/
private class GoalNodeListCell extends ListCell<GoalNode<KeyData>> {
public GoalNodeListCell(ListView<GoalNode<KeyData>> goalNodeListView) {
itemProperty().addListener(this::update);
goalOptionsMenu.selectedViewOptionProperty().addListener(this::update);
}
private void update(Observable observable) {
if (getItem() == null) {
setText("");
return;
}
KeyData item = getItem().getData();
String text = "n/a";
if (goalOptionsMenu.getSelectedViewOption() != null) {
text = goalOptionsMenu.getSelectedViewOption().getText(item);
}
//setStyle("-fx-font-size: 12pt;");
setText(text);
}
}
} }
...@@ -9,17 +9,27 @@ ...@@ -9,17 +9,27 @@
<?import javafx.scene.control.TextArea?> <?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView?>
<?import edu.kit.iti.formal.psdbg.gui.controls.SectionPane?>
<fx:root xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1" <fx:root xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1"
type="edu.kit.iti.formal.psdbg.gui.controls.SequentMatcher"> type="edu.kit.iti.formal.psdbg.gui.controls.SequentMatcher">
<center> <center>
<SplitPane orientation="VERTICAL"> <SplitPane orientation="VERTICAL">
<items> <items>
<VBox prefHeight="5" prefWidth="1150.0"> <SectionPane title="Current Goals">
<Label id="title" alignment="CENTER" contentDisplay="TOP" prefHeight="0.0" prefWidth="107.0" <headerRight>
style="-fx-font-weight: bold; -fx-font-size: 110%;" text="Sequent Matcher"/> <Button onMouseClicked="#showGoalOptions">
<Label text="Goal List"/> <graphic>
<ListView fx:id="goalView"/> <MaterialDesignIconView glyphName="WRENCH"/>
</VBox> </graphic>
</Button>
</headerRight>
<center>
<VBox prefHeight="5" prefWidth="1150.0">
<ListView fx:id="goalView"/>
</VBox>
</center>
</SectionPane>
<SplitPane dividerPositions="0.4189895470383275" prefHeight="500" prefWidth="800"> <SplitPane dividerPositions="0.4189895470383275" prefHeight="500" prefWidth="800">
<items> <items>
<VBox prefHeight="250.0" prefWidth="250"> <VBox prefHeight="250.0" prefWidth="250">
......
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