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

goal wrench added

parent a07f27ac
......@@ -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.Matchings;
import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath;
import javafx.beans.property.ListProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.Observable;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import java.util.Collections;
......@@ -26,6 +27,8 @@ import java.util.Map;
public class SequentMatcher extends BorderPane {
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
@FXML
private SequentView sequentView;
......@@ -43,6 +46,7 @@ public class SequentMatcher extends BorderPane {
public SequentMatcher() {
Utils.createWithFXML(this);
selectedGoalNodeToShow.addListener((observable, oldValue, newValue) -> {
sequentView.setGoal(newValue.getData().getGoal());
sequentView.setNode(newValue.getData().getNode());
......@@ -55,6 +59,9 @@ public class SequentMatcher extends BorderPane {
selectedGoalNodeToShow.setValue(nnew)
);
goalView.setCellFactory(GoalNodeListCell::new);
goals.addListener((observable, oldValue, newValue) -> goalView.setItems(newValue));
matchingsView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
......@@ -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() {
Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
......@@ -152,6 +164,7 @@ public class SequentMatcher extends BorderPane {
}
public void setSelectedGoalNodeToShow(GoalNode<KeyData> selectedGoalNodeToShow) {
this.selectedGoalNodeToShow.set(selectedGoalNodeToShow);
}
......@@ -172,4 +185,29 @@ public class SequentMatcher extends BorderPane {
public void setMatchingresults(ObservableList<GoalNode<KeyData>> 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 @@
<?import javafx.scene.control.TextArea?>
<?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"
type="edu.kit.iti.formal.psdbg.gui.controls.SequentMatcher">
<center>
<SplitPane orientation="VERTICAL">
<items>
<VBox prefHeight="5" prefWidth="1150.0">
<Label id="title" alignment="CENTER" contentDisplay="TOP" prefHeight="0.0" prefWidth="107.0"
style="-fx-font-weight: bold; -fx-font-size: 110%;" text="Sequent Matcher"/>
<Label text="Goal List"/>
<ListView fx:id="goalView"/>
</VBox>
<SectionPane title="Current Goals">
<headerRight>
<Button onMouseClicked="#showGoalOptions">
<graphic>
<MaterialDesignIconView glyphName="WRENCH"/>
</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">
<items>
<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