Commit f1d17156 authored by LULUDBR\Lulu's avatar LULUDBR\Lulu

No Matchings - Label replacing MatchingsView for when Matchings not found

parent 62978d4f
Pipeline #16348 failed with stages
in 1 minute and 40 seconds
......@@ -14,11 +14,13 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
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 javafx.scene.layout.Pane;
import java.util.Collections;
import java.util.HashMap;
......@@ -30,7 +32,7 @@ public class SequentMatcher extends BorderPane {
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
@FXML
private SequentView sequentView;
private SequentViewMatcher sequentView;
@FXML
private ListView<GoalNode<KeyData>> goalView;
......@@ -39,13 +41,17 @@ public class SequentMatcher extends BorderPane {
private TextArea matchpattern;
@FXML
private ListView<Map<String, MatchPath>> matchingsView;
private ListView<Map<String, MatchPath>> matchingsView;
@FXML
private Label nomatchings;
private Map<PosInOccurrence, Range> cursorPosition = new HashMap<>();
public SequentMatcher() {
Utils.createWithFXML(this);
getStyleClass().add("sequent-view"); //TODO
selectedGoalNodeToShow.addListener((observable, oldValue, newValue) -> {
sequentView.setGoal(newValue.getData().getGoal());
......@@ -69,7 +75,8 @@ public class SequentMatcher extends BorderPane {
newValue.forEach((name, mp) -> {
PosInOccurrence pio = mp.pio();
Range r = cursorPosition.get(pio);
sequentView.setStyle(r.start(), r.end(), Collections.singleton("sequent-highlight"));
sequentView.setStyleClass(r.start(),r.end(), "sequent-highlight"); //TODO
System.out.println("Highlight " + r.start() + " " + r.end());
});
......@@ -106,11 +113,17 @@ public class SequentMatcher extends BorderPane {
Matchings matchings = MatcherFacade.matches(matchpattern.getText(), getSelectedGoalNodeToShow().getData().getNode().sequent(), true);
ObservableList<Map<String, MatchPath>> resultlist = FXCollections.observableArrayList(matchings);
//If no matchings found, add "No matchings found"
if (resultlist.isEmpty()) {
System.out.println("No matchings found for this sequent");
matchingsView.setVisible(false);
nomatchings.setVisible(true);
} else {
nomatchings.setVisible(false);
matchingsView.setItems(resultlist);
matchingsView.setVisible(true);
}
matchingsView.setItems(resultlist);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<?import edu.kit.iti.formal.psdbg.gui.controls.SequentView?>
<?import edu.kit.iti.formal.psdbg.gui.controls.SequentViewMatcher?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
......@@ -9,8 +9,10 @@
<?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?>
<?import javafx.scene.layout.Pane?>
<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>
......@@ -33,7 +35,7 @@
<SectionPane title="Sequent" minHeight="0.0" minWidth="0.0" prefHeight="633.0"
prefWidth="341.0">
<center>
<SequentView fx:id="sequentView"/>
<SequentViewMatcher fx:id="sequentView"/>
</center>
</SectionPane>
<SplitPane dividerPositions="0.28551136363636365" layoutX="11.0" layoutY="12.0"
......@@ -48,14 +50,16 @@
</VBox>
<VBox prefHeight="349.0">
<Label text="Matches"/>
<ListView fx:id="matchingsView"/>
<Pane>
<Label fx:id ="nomatchings" text="No matchings found" visible="false"/>
<ListView fx:id="matchingsView" prefWidth="650"/>
</Pane>
</VBox>
</SplitPane>
</SplitPane>
</SplitPane>
</center>
<top>
</top>
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0"/>
</padding>
......
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