diff --git a/src/main/java/dk/cs/aau/huppaal/HUPPAAL.java b/src/main/java/dk/cs/aau/huppaal/HUPPAAL.java index a5ff33f8..82db962d 100644 --- a/src/main/java/dk/cs/aau/huppaal/HUPPAAL.java +++ b/src/main/java/dk/cs/aau/huppaal/HUPPAAL.java @@ -252,7 +252,7 @@ public void start(final Stage stage) throws Exception { searchStage = new Stage(); searchBox = new HBox(); searchStage.initStyle(StageStyle.UNDECORATED); - searchStage.setScene(new Scene(PresentationFxmlLoader.loadSetRootGetElement("SpotlightSearchPresentation.fxml", searchBox), + searchStage.setScene(new Scene(PresentationFxmlLoader.loadSetRootGetElement("ProjectSearchPresentation.fxml", searchBox), screen.getBounds().getWidth() * 0.4, screen.getBounds().getHeight() * 0.6)); searchStage.initModality(Modality.WINDOW_MODAL); diff --git a/src/main/java/dk/cs/aau/huppaal/controllers/SpotlightSearchController.java b/src/main/java/dk/cs/aau/huppaal/controllers/ProjectSearchController.java similarity index 86% rename from src/main/java/dk/cs/aau/huppaal/controllers/SpotlightSearchController.java rename to src/main/java/dk/cs/aau/huppaal/controllers/ProjectSearchController.java index 23ef326e..aeb5fd25 100644 --- a/src/main/java/dk/cs/aau/huppaal/controllers/SpotlightSearchController.java +++ b/src/main/java/dk/cs/aau/huppaal/controllers/ProjectSearchController.java @@ -5,7 +5,7 @@ import dk.cs.aau.huppaal.abstractions.Component; import dk.cs.aau.huppaal.abstractions.Edge; import dk.cs.aau.huppaal.abstractions.Location; -import dk.cs.aau.huppaal.presentations.SpotlightSearchResultPresentation; +import dk.cs.aau.huppaal.presentations.ProjectSearchResultPresentation; import javafx.application.Platform; import javafx.fxml.Initializable; import javafx.scene.layout.HBox; @@ -18,7 +18,7 @@ import java.util.ResourceBundle; import java.util.regex.Pattern; -public class SpotlightSearchController implements Initializable { +public class ProjectSearchController implements Initializable { public HBox root; public JFXTextField searchTextField; public VBox resultsBox; @@ -41,7 +41,7 @@ private void initializeFocus() { private void initializeSearchTextField() { searchTextField.textProperty().addListener((obs, oldValue, newValue) -> { int maxSearchSize = 100; - var newLabels = new ArrayList(); + var newLabels = new ArrayList(); Pattern searchTerm; try { searchTerm = Pattern.compile(newValue, Pattern.CASE_INSENSITIVE); @@ -52,19 +52,19 @@ private void initializeSearchTextField() { var components = getComponentNames(searchTerm); for(var c : components) { if(newLabels.size() < maxSearchSize) - newLabels.add(new SpotlightSearchResultPresentation(c).withClickEffect(this::closeStage)); + newLabels.add(new ProjectSearchResultPresentation(c).withClickEffect(this::closeStage)); } var locations = getLocations(searchTerm); for (var l : locations) { if(newLabels.size() < maxSearchSize) - newLabels.add(new SpotlightSearchResultPresentation(l.getKey(), l.getValue()).withClickEffect(this::closeStage)); + newLabels.add(new ProjectSearchResultPresentation(l.getKey(), l.getValue()).withClickEffect(this::closeStage)); } var edges = getEdges(searchTerm); for (var e : edges) { if(newLabels.size() < maxSearchSize) - newLabels.add(new SpotlightSearchResultPresentation(e.getKey(), e.getValue()).withClickEffect(this::closeStage)); + newLabels.add(new ProjectSearchResultPresentation(e.getKey(), e.getValue()).withClickEffect(this::closeStage)); } Platform.runLater(() -> { @@ -75,7 +75,7 @@ private void initializeSearchTextField() { searchTextField.setOnAction(e -> { if(resultsBox.getChildren() != null && resultsBox.getChildren().size() > 0) - ((SpotlightSearchResultPresentation) resultsBox.getChildren().get(0)).click(); + ((ProjectSearchResultPresentation) resultsBox.getChildren().get(0)).click(); }); } diff --git a/src/main/java/dk/cs/aau/huppaal/presentations/SpotlightSearchResultPresentation.java b/src/main/java/dk/cs/aau/huppaal/presentations/ProjectSearchResultPresentation.java similarity index 85% rename from src/main/java/dk/cs/aau/huppaal/presentations/SpotlightSearchResultPresentation.java rename to src/main/java/dk/cs/aau/huppaal/presentations/ProjectSearchResultPresentation.java index af18191e..3085e528 100644 --- a/src/main/java/dk/cs/aau/huppaal/presentations/SpotlightSearchResultPresentation.java +++ b/src/main/java/dk/cs/aau/huppaal/presentations/ProjectSearchResultPresentation.java @@ -13,14 +13,12 @@ import javafx.scene.layout.Region; import org.kordamp.ikonli.javafx.FontIcon; -import java.util.Optional; - -public class SpotlightSearchResultPresentation extends HBox { +public class ProjectSearchResultPresentation extends HBox { private Runnable clickEvent = () -> {}; private Runnable onClickEffect = () -> {}; - public SpotlightSearchResultPresentation(Component parent, Edge edge) { + public ProjectSearchResultPresentation(Component parent, Edge edge) { this("gmi-near-me", Color.GREEN.getColor(Color.Intensity.I800), edge.generatePeakyString()); initializeContext(parent.getName()); this.clickEvent = () -> { @@ -29,7 +27,7 @@ public SpotlightSearchResultPresentation(Component parent, Edge edge) { }; } - public SpotlightSearchResultPresentation(Component parent, Location location) { + public ProjectSearchResultPresentation(Component parent, Location location) { this("gmi-adjust", Color.PURPLE.getColor(Color.Intensity.I800), location.getMostDescriptiveIdentifier()); initializeContext(parent.getName()); this.clickEvent = () -> { @@ -38,12 +36,12 @@ public SpotlightSearchResultPresentation(Component parent, Location location) { }; } - public SpotlightSearchResultPresentation(Component component) { + public ProjectSearchResultPresentation(Component component) { this("gmi-branding-watermark", Color.BLUE.getColor(Color.Intensity.I800), component.getName()); this.clickEvent = () -> SelectHelper.selectComponent(component.getName()); } - private SpotlightSearchResultPresentation(String icon, javafx.scene.paint.Color iconColor, String name) { + private ProjectSearchResultPresentation(String icon, javafx.scene.paint.Color iconColor, String name) { initializeIcon(icon, iconColor); initializeName(name); initializeHover(); @@ -97,7 +95,7 @@ public void click() { onClickEffect.run(); } - public SpotlightSearchResultPresentation withClickEffect(Runnable r) { + public ProjectSearchResultPresentation withClickEffect(Runnable r) { onClickEffect = r; return this; } diff --git a/src/main/resources/dk/cs/aau/huppaal/presentations/SpotlightSearchPresentation.fxml b/src/main/resources/dk/cs/aau/huppaal/presentations/ProjectSearchPresentation.fxml similarity index 91% rename from src/main/resources/dk/cs/aau/huppaal/presentations/SpotlightSearchPresentation.fxml rename to src/main/resources/dk/cs/aau/huppaal/presentations/ProjectSearchPresentation.fxml index 26fd3214..294f0232 100644 --- a/src/main/resources/dk/cs/aau/huppaal/presentations/SpotlightSearchPresentation.fxml +++ b/src/main/resources/dk/cs/aau/huppaal/presentations/ProjectSearchPresentation.fxml @@ -7,7 +7,7 @@ xmlns="http://javafx.com/javafx/8.0.76-ea" type="HBox" fx:id="root" - fx:controller="dk.cs.aau.huppaal.controllers.SpotlightSearchController"> + fx:controller="dk.cs.aau.huppaal.controllers.ProjectSearchController">