From 1b4ebf91a1d5746bfd2fe2e658b9f40161a419b8 Mon Sep 17 00:00:00 2001
From: tobias <tobias@thecodedev.de>
Date: Sun, 15 Sep 2019 20:56:50 +0200
Subject: [PATCH] Improve search result dialog

---
 .../main/java/de/tobias/playpad/Strings.java    |  3 ++-
 .../listener/DesktopSearchController.java       | 17 +++++++++++++++--
 PlayWall/src/main/resources/lang/_de.properties |  5 ++++-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/PlayWall/src/main/java/de/tobias/playpad/Strings.java b/PlayWall/src/main/java/de/tobias/playpad/Strings.java
index 77ebb297..b0dd8185 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/Strings.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/Strings.java
@@ -239,7 +239,8 @@ public class Strings {
 	// Search
 	public static final String SEARCH_BUTTON = "Search.Button";
 	public static final String SEARCH_PLACEHOLDER = "Search.Placeholder";
-	public static final String SEARCH_ALERT_NO_MATCHES = "Search.Alert.NoMatches";
+	public static final String SEARCH_ALERT_NO_MATCHES_HEADER = "Search.Alert.NoMatches.Header";
+	public static final String SEARCH_ALERT_NO_MATCHES_CONTENT = "Search.Alert.NoMatches.Content";
 
 	// UI - Dialog - Page - Delete
 	public static final String UI_DIALOG_PAGE_DELETE_HEADER = "UI.Dialog.Page.Delete.Header";
diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/listener/DesktopSearchController.java b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/listener/DesktopSearchController.java
index 28db0d83..a00f2083 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/listener/DesktopSearchController.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/listener/DesktopSearchController.java
@@ -1,5 +1,7 @@
 package de.tobias.playpad.layout.desktop.listener;
 
+import de.thecodelabs.utils.application.ApplicationUtils;
+import de.thecodelabs.utils.ui.Alerts;
 import de.thecodelabs.utils.util.Localization;
 import de.tobias.playpad.Strings;
 import de.tobias.playpad.pad.Pad;
@@ -7,6 +9,7 @@ import de.tobias.playpad.project.Project;
 import de.tobias.playpad.viewcontroller.main.IMainViewController;
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
+import javafx.scene.control.Alert;
 import javafx.scene.control.TextField;
 
 import java.util.List;
@@ -47,7 +50,12 @@ public class DesktopSearchController implements EventHandler<ActionEvent> {
 		}
 
 		if (searchResult.isEmpty()) {
-			mainView.showInfoMessage(Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES));
+			Alerts.getInstance().createAlert(
+					Alert.AlertType.INFORMATION, ApplicationUtils.getApplication().getInfo().getName(),
+					Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES_HEADER),
+					Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES_CONTENT, currentSearchTerm),
+					mainView.getStage()
+			).showAndWait();
 			return;
 		}
 
@@ -58,7 +66,12 @@ public class DesktopSearchController implements EventHandler<ActionEvent> {
 				result.getController().getView().highlightView(HIGHLIGHT_DURATION);
 			}
 		} else {
-			mainView.showInfoMessage(Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES));
+			Alerts.getInstance().createAlert(
+					Alert.AlertType.INFORMATION, ApplicationUtils.getApplication().getInfo().getName(),
+					Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES_HEADER),
+					Localization.getString(Strings.SEARCH_ALERT_NO_MATCHES_CONTENT, currentSearchTerm),
+					mainView.getStage()
+			).showAndWait();
 			currentIndex = 0;
 		}
 	}
diff --git a/PlayWall/src/main/resources/lang/_de.properties b/PlayWall/src/main/resources/lang/_de.properties
index 706ec7a5..d3e6f30a 100755
--- a/PlayWall/src/main/resources/lang/_de.properties
+++ b/PlayWall/src/main/resources/lang/_de.properties
@@ -218,10 +218,13 @@ DnDMode.Move=Tauschen
 # Main Layout
 MainLayout.Desktop=Desktopmodus
 MainLayout.Touch=Touchmodus
+
 # Suche
 Search.Button=Suchen
 Search.Placeholder=Suche
-Search.Alert.NoMatches=Keine Treffer gefunden.
+Search.Alert.NoMatches.Header=Kachelsuche
+Search.Alert.NoMatches.Content=Keine weiteren Treffer zu '{}' gefunden.
+
 # UI - Dialog - Page - Delete
 UI.Dialog.Page.Delete.Header=Seite l\u00F6schen
 UI.Dialog.Page.Delete.Content=M\u00F6chten Sie die Seite unwiederbringlich l\u00F6schen?
-- 
GitLab