From c31728a92bdc7a39c2399a8055940c6d2a1f97e3 Mon Sep 17 00:00:00 2001 From: Georg-Notebook Date: Thu, 18 Mar 2021 23:37:43 +0100 Subject: [PATCH] langde von conf.ini -> langde.ini verschoben + fixed alert -> del log, del tour, input errors (nurZahlen, nurPositive, keinText, zuerstTourDannLog) + Logo --- .gitignore | 1 - .idea/.gitignore | 8 ++ .idea/libraries/javadoc.xml | 11 ++ .idea/libraries/lib.xml | 17 +++ .idea/libraries/log4j_log4j_1_2_17.xml | 10 ++ .idea/libraries/org_ini4j_ini4j_0_5_4.xml | 10 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 7 + Tourplaner.iml | 15 +- conf.ini.sample | 40 +----- langde.ini | 33 +++++ log/log4j/log.out | 147 ++------------------ src/tourplaner/business/AlertHelper.java | 5 +- src/tourplaner/business/ConfigHelper.java | 19 +++ src/tourplaner/tourplaner.fxml | 2 +- src/tourplaner/ui/TourplanerController.java | 61 ++++---- src/tourplaner/viewmodels/ViewModel.java | 36 ++--- 18 files changed, 198 insertions(+), 238 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/libraries/javadoc.xml create mode 100644 .idea/libraries/lib.xml create mode 100644 .idea/libraries/log4j_log4j_1_2_17.xml create mode 100644 .idea/libraries/org_ini4j_ini4j_0_5_4.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 langde.ini diff --git a/.gitignore b/.gitignore index 9cc0c79..2abc955 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -.idea/ out/ conf.ini diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..31da31e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../:\FH_OFFLINE\Tourplaner\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/libraries/javadoc.xml b/.idea/libraries/javadoc.xml new file mode 100644 index 0000000..c36730c --- /dev/null +++ b/.idea/libraries/javadoc.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..aea825f --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/log4j_log4j_1_2_17.xml b/.idea/libraries/log4j_log4j_1_2_17.xml new file mode 100644 index 0000000..7d424aa --- /dev/null +++ b/.idea/libraries/log4j_log4j_1_2_17.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/org_ini4j_ini4j_0_5_4.xml b/.idea/libraries/org_ini4j_ini4j_0_5_4.xml new file mode 100644 index 0000000..062cea2 --- /dev/null +++ b/.idea/libraries/org_ini4j_ini4j_0_5_4.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1763e15 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3fbca3e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..8306744 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Tourplaner.iml b/Tourplaner.iml index 1f2f651..4417e38 100644 --- a/Tourplaner.iml +++ b/Tourplaner.iml @@ -1,25 +1,14 @@ - - - - - file://$MODULE_DIR$/src/tourplaner/business/ConfigHelper.java - - - - - + - - - + \ No newline at end of file diff --git a/conf.ini.sample b/conf.ini.sample index c0ba04a..b92bbcb 100644 --- a/conf.ini.sample +++ b/conf.ini.sample @@ -1,6 +1,9 @@ [start] message = Tour Planer App gestartet +[lang] +lang = langde + [db] dbname = tourplaner url = @@ -11,39 +14,4 @@ pw = [hilfe] gitrepo = https://git.dergeorg.at/dergeorg/tourplaner doxygendoc = https://git.dergeorg.at/dergeorg/tourplaner -javadoc = https://git.dergeorg.at/dergeorg/tourplaner - - -[langde] -achtung = ACHTUNG -openbrowsererror = TourplanerController -> Browser: -browserexception = Browser Exception -browserexceptionmsg = Error beim öffnen des Browsers -suchfeldleer = Suchfeld ist leer! -suchtextzuerst = Bitte zuerst den Suchtext in das Suchfeld eingeben! -keinetourselected = Keine Tour ausgewählt! -tournametitle = Tourname -tournameheader = Bitte geben Sie den Namen der Tour an! -tournamemsg = Name: -namevergebenheader = Name bereits vergeben! -namevergebenmsg1 = Der Name ' -namevergebenmsg2 = ' ist bereits vergeben, bitte verwenden Sie einen andern! -startpunkttitle = Tour Startpunkt -startpunktheader = Bitte geben Sie den Startpunkt der Tour an! -startpunktmsg = Startpunkt: -zielpunkttitle = Tour zielpunkt -zielpunktheader = Bitte geben Sie den Zielpunkt der Tour an! -zielpunktmsg = Zielpunkt: -deltournoselect = ViewModel -> DelTour -deltournoselectmsg = Bitte wählen Sie zuerst eine Tour aus, bevor Sie auf löschen klicken! -exceptionstackheader = Exception stacktrace: -keinelogsvorhanden = Fügen Sie erst ein Log hinzu um es anzuzeigen! -datum = Datum -dauer = Dauer -strecke = Strecke -streckemsg = Strecke des Logeintrages -dauermsg = Dauer des Logeintrages -doppelpunkt = : -fktnichtimplementiert = Diese Funktion ist noch nicht Implementiert -vergessenodernochnichtsoweit = Entweder hat DerGeorg darauf vergessen oder ist noch nicht so weit gekommen um das zu machen! -logtournotselectedmsg = Bitte wählen Sie zuerst eine Tour aus, bevor sie einen log Eintrag erstellen! \ No newline at end of file +javadoc = https://git.dergeorg.at/dergeorg/tourplaner \ No newline at end of file diff --git a/langde.ini b/langde.ini new file mode 100644 index 0000000..82dc7e6 --- /dev/null +++ b/langde.ini @@ -0,0 +1,33 @@ +[langde] +achtung = ACHTUNG +openbrowsererror = TourplanerController -> Browser: +browserexception = Browser Exception +browserexceptionmsg = Error beim öffnen des Browsers +suchfeldleer = Suchfeld ist leer! +suchtextzuerst = Bitte zuerst den Suchtext in das Suchfeld eingeben! +keinetourselected = Keine Tour ausgewählt! +tournametitle = Tourname +tournameheader = Bitte geben Sie den Namen der Tour an! +tournamemsg = Name: +namevergebenheader = Name bereits vergeben! +namevergebenmsg1 = Der Name ' +namevergebenmsg2 = ' ist bereits vergeben, bitte verwenden Sie einen andern! +startpunkttitle = Tour Startpunkt +startpunktheader = Bitte geben Sie den Startpunkt der Tour an! +startpunktmsg = Startpunkt: +zielpunkttitle = Tour zielpunkt +zielpunktheader = Bitte geben Sie den Zielpunkt der Tour an! +zielpunktmsg = Zielpunkt: +deltournoselect = ViewModel -> DelTour +deltournoselectmsg = Bitte wählen Sie zuerst eine Tour aus, bevor Sie auf löschen klicken! +exceptionstackheader = Exception stacktrace: +keinelogsvorhanden = Fügen Sie erst ein Log hinzu um es anzuzeigen! +datum = Datum +dauer = Dauer +strecke = Strecke +streckemsg = Strecke des Logeintrages +dauermsg = Dauer des Logeintrages +doppelpunkt = : +fktnichtimplementiert = Diese Funktion ist noch nicht Implementiert +vergessenodernochnichtsoweit = Entweder hat DerGeorg darauf vergessen oder ist noch nicht so weit gekommen um das zu machen! +logtournotselectedmsg = Bitte wählen Sie zuerst eine Tour aus, bevor sie einen log Eintrag erstellen! \ No newline at end of file diff --git a/log/log4j/log.out b/log/log4j/log.out index 6a5e15f..ee626a4 100644 --- a/log/log4j/log.out +++ b/log/log4j/log.out @@ -1,139 +1,8 @@ -Tour planer Startet! -Tour planer Startet! -App started -2021-02-26 15:59:44 INFO TourPlaner:15 - App started -2021-02-26 16:06:01 FATAL TourPlanerConfig:27 - C:\Users\georg\OneDrive\FH\Swe\Tourplaner\conf.ini (Das System kann die angegebene Datei nicht finden) -2021-02-26 16:08:31 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:27:46 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:27:46 ERROR PresenterMain:33 - -/C:/Users/georg/OneDrive/FH/Swe/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:56 - -2021-02-26 21:27:46 INFO PostgresHelper:15 - User Table created -2021-02-26 21:27:46 ERROR ClassNotFoundException:33 - org.postgresql.Driver -2021-02-26 21:27:46 ERROR NullPointerException:33 - -2021-02-26 21:30:59 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:30:59 ERROR PresenterMain:33 - -/C:/Users/georg/OneDrive/FH/Swe/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:56 - -2021-02-26 21:30:59 INFO PostgresHelper:15 - User Table created -2021-02-26 21:31:01 ERROR PSQLException:33 - Connection to postgres.dergeorg.at:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-02-26 21:31:01 ERROR NullPointerException:33 - -2021-02-26 21:32:19 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:32:19 ERROR PresenterMain:33 - -/C:/Users/georg/OneDrive/FH/Swe/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:56 - -2021-02-26 21:32:19 INFO PostgresHelper:15 - User Table created -2021-02-26 21:32:21 ERROR PSQLException:33 - Connection to postgres.dergeorg.at:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-02-26 21:32:21 ERROR NullPointerException:33 - -2021-02-26 21:33:05 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:33:05 ERROR PresenterMain:33 - -/C:/Users/georg/OneDrive/FH/Swe/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:56 - -2021-02-26 21:33:05 INFO PostgresHelper:15 - User Table created -2021-02-26 21:33:07 ERROR PSQLException:33 - Connection to postgres.dergeorg.at:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-02-26 21:33:07 ERROR NullPointerException:33 - -2021-02-26 21:35:08 INFO TourPlaner:15 - Tour Planer App gestartet -2021-02-26 21:35:08 ERROR PresenterMain:33 - -/C:/Users/georg/OneDrive/FH/Swe/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:56 - -2021-02-26 21:35:08 INFO PostgresHelper:15 - User Table created -2021-02-26 21:35:10 ERROR PSQLException:33 - Connection to postgres.dergeorg.at:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-02-26 21:35:10 ERROR NullPointerException:33 - -2021-03-03 13:12:33 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 13:12:34 INFO PostgresHelper:15 - User Table created -2021-03-03 13:16:04 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 13:16:04 ERROR PresenterMain:33 - -/C:/Users/georg/Documents/FH/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:163 - -2021-03-03 13:16:04 INFO PostgresHelper:15 - User Table created -2021-03-03 13:20:58 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 13:20:58 ERROR PresenterMain:33 - -/C:/Users/georg/Documents/FH/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:163 - -2021-03-03 13:20:58 INFO PostgresHelper:15 - User Table created -2021-03-03 15:48:05 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 15:48:05 ERROR PresenterMain:33 - -/C:/Users/georg/Documents/FH/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:163 - -2021-03-03 15:48:05 INFO PostgresHelper:15 - User Table created -2021-03-03 15:50:47 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 15:50:47 ERROR PresenterMain:33 - -/C:/Users/georg/Documents/FH/Tourplaner/out/production/Tourplaner/tourplaner/ui/tourplaner.fxml:163 - -2021-03-03 15:50:47 INFO PostgresHelper:15 - User Table created -2021-03-03 15:52:06 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-03 15:52:07 INFO PostgresHelper:15 - User Table created -2021-03-16 22:03:23 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-16 22:03:23 INFO PostgresHelper:15 - User Table created -2021-03-16 22:03:25 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-16 22:03:25 ERROR NullPointerException:33 - -2021-03-16 22:03:58 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-16 22:03:58 INFO PostgresHelper:15 - User Table created -2021-03-16 22:04:00 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-16 22:04:00 ERROR NullPointerException:33 - -2021-03-16 22:04:06 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-16 22:04:06 INFO PostgresHelper:15 - User Table created -2021-03-16 22:04:08 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-16 22:04:08 ERROR NullPointerException:33 - -2021-03-17 13:13:25 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 13:13:25 INFO PostgresHelper:15 - User Table created -2021-03-17 13:13:27 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 13:13:27 ERROR NullPointerException:33 - -2021-03-17 14:39:16 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 14:39:16 INFO PostgresHelper:15 - User Table created -2021-03-17 14:39:18 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 14:39:18 ERROR NullPointerException:33 - -2021-03-17 14:46:45 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 14:46:45 INFO PostgresHelper:15 - User Table created -2021-03-17 14:46:47 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 14:46:47 ERROR NullPointerException:33 - -2021-03-17 14:48:46 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 14:48:46 INFO PostgresHelper:15 - User Table created -2021-03-17 14:48:48 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 14:48:48 ERROR NullPointerException:33 - -2021-03-17 15:20:09 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 15:20:09 INFO PostgresHelper:15 - User Table created -2021-03-17 15:20:11 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 15:20:11 ERROR NullPointerException:33 - -2021-03-17 15:36:24 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! -2021-03-17 15:38:41 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! -2021-03-17 16:02:24 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:02:24 INFO PostgresHelper:15 - User Table created -2021-03-17 16:02:26 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:02:26 ERROR NullPointerException:33 - -2021-03-17 16:03:16 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:03:16 INFO PostgresHelper:15 - User Table created -2021-03-17 16:03:18 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:03:18 ERROR NullPointerException:33 - -2021-03-17 16:04:18 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:04:18 INFO PostgresHelper:15 - User Table created -2021-03-17 16:04:20 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:04:20 ERROR NullPointerException:33 - -2021-03-17 16:04:26 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:04:26 INFO PostgresHelper:15 - User Table created -2021-03-17 16:04:28 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:04:28 ERROR NullPointerException:33 - -2021-03-17 16:06:47 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:06:47 INFO PostgresHelper:15 - User Table created -2021-03-17 16:06:49 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:06:49 ERROR NullPointerException:33 - -2021-03-17 16:06:55 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 16:06:55 INFO PostgresHelper:15 - User Table created -2021-03-17 16:06:57 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 16:06:57 ERROR NullPointerException:33 - -2021-03-17 17:02:33 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 17:02:33 INFO PostgresHelper:15 - User Table created -2021-03-17 17:02:35 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 17:02:35 ERROR NullPointerException:33 - -2021-03-17 17:02:38 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 17:02:38 INFO PostgresHelper:15 - User Table created -2021-03-17 17:02:40 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 17:02:40 ERROR NullPointerException:33 - -2021-03-17 17:08:23 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 17:08:23 INFO PostgresHelper:15 - User Table created -2021-03-17 17:08:25 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 17:08:25 ERROR NullPointerException:33 - -2021-03-17 17:08:31 INFO TourPlaner:15 - Tour Planer App gestartet -2021-03-17 17:08:31 INFO PostgresHelper:15 - User Table created -2021-03-17 17:08:33 ERROR PSQLException:33 - Connection to 192.168.1.116:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. -2021-03-17 17:08:33 ERROR NullPointerException:33 - +2021-03-18 22:41:23 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:48:51 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:53:17 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:57:20 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:57:28 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:58:33 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 22:58:34 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! +2021-03-18 23:05:00 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt! diff --git a/src/tourplaner/business/AlertHelper.java b/src/tourplaner/business/AlertHelper.java index 9f46327..79bd7c0 100644 --- a/src/tourplaner/business/AlertHelper.java +++ b/src/tourplaner/business/AlertHelper.java @@ -72,7 +72,7 @@ public class AlertHelper { PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); String exceptionText = sw.toString(); - Label label = new Label(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "exceptionstackheader")); + Label label = new Label(ConfigHelper.getLangIniString("exceptionstackheader")); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); @@ -145,10 +145,11 @@ public class AlertHelper { int resultInt = Integer.parseInt(result.get()); returnText.set(resultInt); }catch (NumberFormatException e){ - AlertHelper.warn(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), "Bitte nur Zahlen eingeben!", "Bitte geben sie nur Zahlen von 0 - 10 an!"); + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), "Bitte nur Zahlen eingeben!", "Bitte geben sie nur Zahlen von 0 - 10 an!"); returnText.set(-1); } }); + return returnText.get(); } diff --git a/src/tourplaner/business/ConfigHelper.java b/src/tourplaner/business/ConfigHelper.java index c2ad72d..d052aa1 100644 --- a/src/tourplaner/business/ConfigHelper.java +++ b/src/tourplaner/business/ConfigHelper.java @@ -11,6 +11,7 @@ import java.io.IOException; public class ConfigHelper { public static String standartConfig = "conf.ini"; // Config.ini befindet sich im Root Verzeichnis + public static String standartLangDe = "langde.ini"; // langde.ini befindet sich im Root Verzeichnis /** * Liest einen Int aus der Config aus @@ -48,6 +49,16 @@ public class ConfigHelper { return ini.get(sectionName, optionName, String.class); } + /** + * Liest einen String aus der Lang datei aus + * Die Sprache wird im config file umgestellt + * @param optionName Options Name + * @return Den angeforderten String + */ + public static String getLangIniString(String optionName){ + return ConfigHelper.getIniString(ConfigHelper.getStandartLangde(), ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "lang", "lang"),optionName); + } + /** * Setzt ein String in der Config * @param filename Speicherort @@ -92,4 +103,12 @@ public class ConfigHelper { public static String getStandartConfig() { return standartConfig; } + + /** + * Gibt den namen des standard langde file zurück + * @return Name des standard langde files + */ + public static String getStandartLangde() { + return standartLangDe; + } } diff --git a/src/tourplaner/tourplaner.fxml b/src/tourplaner/tourplaner.fxml index a1aab58..6193249 100644 --- a/src/tourplaner/tourplaner.fxml +++ b/src/tourplaner/tourplaner.fxml @@ -51,7 +51,7 @@ - + diff --git a/src/tourplaner/ui/TourplanerController.java b/src/tourplaner/ui/TourplanerController.java index 7bc8300..5795c5c 100644 --- a/src/tourplaner/ui/TourplanerController.java +++ b/src/tourplaner/ui/TourplanerController.java @@ -80,10 +80,10 @@ public class TourplanerController implements Initializable { uriString); desktop.browse(oURL); } catch (URISyntaxException | IOException e) { - LogHelper.error(e.getMessage(), ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "openbrowsererror") + appname); - AlertHelper.exerror(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "browserexception"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "openbrowsererror") + appname, - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "browserexceptionmsg"), e); + LogHelper.error(e.getMessage(), ConfigHelper.getLangIniString("openbrowsererror") + appname); + AlertHelper.exerror(ConfigHelper.getLangIniString("browserexception"), + ConfigHelper.getLangIniString("openbrowsererror") + appname, + ConfigHelper.getLangIniString("browserexceptionmsg"), e); } } @@ -105,7 +105,7 @@ public class TourplanerController implements Initializable { nameCol.setCellValueFactory(new PropertyValueFactory("name")); //Log anzeigen - logTableView.setPlaceholder(new Label( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinelogsvorhanden"))); + logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinelogsvorhanden"))); logTableView.setItems(this.viewModel.getLogData()); logDauerCol.setCellValueFactory(new PropertyValueFactory("dauer")); logStreckeCol.setCellValueFactory(new PropertyValueFactory("strecke")); @@ -137,9 +137,10 @@ public class TourplanerController implements Initializable { @FXML private void delTour(){ this.beschreibungTableView.getItems().removeIf(s -> true); //löscht alles aus der tabelle - this.titleTextView.setText(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected")); + this.titleTextView.setText(ConfigHelper.getLangIniString("keinetourselected")); this.viewModel.delTour(); - logTableView.setPlaceholder(new Label( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"))); + this.viewModel.setSelectedTour(null); + logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected"))); } /** @@ -150,9 +151,9 @@ public class TourplanerController implements Initializable { private void suche(){ String sucheInput = this.sucheInput.getText(); if(sucheInput.isEmpty()){ - AlertHelper.warn(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "suchfeldleer"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "suchtextzuerst")); + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("suchfeldleer"), + ConfigHelper.getLangIniString("suchtextzuerst")); }else { this.viewModel.suche(sucheInput); } @@ -166,9 +167,9 @@ public class TourplanerController implements Initializable { private void addLog(){ Tour selectedTour = this.viewModel.getSelectedTour(); if (selectedTour == null){ - AlertHelper.warn(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "logtournotselectedmsg")); + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("keinetourselected"), + ConfigHelper.getLangIniString("logtournotselectedmsg")); }else { ObservableList tourData = this.viewModel.getTourData(); tourData.forEach(s -> { @@ -185,19 +186,19 @@ public class TourplanerController implements Initializable { double neueStrecke = -1; LocalDate neuesDatum = null; while (neuesDatum == null) { - neuesDatum = AlertHelper.datePicker(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "datum")); + neuesDatum = AlertHelper.datePicker(ConfigHelper.getLangIniString("datum")); } while (neueDauer == -1) { - neueDauer = AlertHelper.inputNumber(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "dauer"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "dauermsg"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "dauer") + - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "doppelpunkt")); + neueDauer = AlertHelper.inputNumber(ConfigHelper.getLangIniString("dauer"), + ConfigHelper.getLangIniString("dauermsg"), + ConfigHelper.getLangIniString("dauer") + + ConfigHelper.getLangIniString("doppelpunkt")); } while (neueStrecke == -1) { - neueStrecke = AlertHelper.inputNumber(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "strecke"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "streckemsg"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "strecke") + - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "doppelpunkt")); + neueStrecke = AlertHelper.inputNumber(ConfigHelper.getLangIniString("strecke"), + ConfigHelper.getLangIniString("streckemsg"), + ConfigHelper.getLangIniString("strecke") + + ConfigHelper.getLangIniString("doppelpunkt")); } Log newLog = new Log(newId.get(), neueDauer + "", neuesDatum, neueStrecke); @@ -213,6 +214,10 @@ public class TourplanerController implements Initializable { Log selectedLog = this.viewModel.getSelectedLog(); if(selectedLog != null) { this.viewModel.delLog(selectedLog.getId()); + }else{ + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("keinetourselected"), + ConfigHelper.getLangIniString("deltournoselectmsg")); } } @@ -239,10 +244,10 @@ public class TourplanerController implements Initializable { TourListView.setOrientation(Orientation.VERTICAL); TourListView.setItems(this.viewModel.getTourNamen()); //Tabs zu Tour -> rechts oben - beschreibungTableView.setPlaceholder(new Label( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"))); - titleTextView.setText( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected")); + beschreibungTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected"))); + titleTextView.setText( ConfigHelper.getLangIniString("keinetourselected")); //Log -> rechts unten - logTableView.setPlaceholder(new Label( ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"))); + logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected"))); } @@ -251,9 +256,9 @@ public class TourplanerController implements Initializable { */ @FXML public void nimpButton(){ - AlertHelper.inform(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "fktnichtimplementiert"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "vergessenodernochnichtsoweit")); + AlertHelper.inform(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("fktnichtimplementiert"), + ConfigHelper.getLangIniString("vergessenodernochnichtsoweit")); } } diff --git a/src/tourplaner/viewmodels/ViewModel.java b/src/tourplaner/viewmodels/ViewModel.java index fa340b6..1157d89 100644 --- a/src/tourplaner/viewmodels/ViewModel.java +++ b/src/tourplaner/viewmodels/ViewModel.java @@ -27,27 +27,27 @@ public class ViewModel { */ public void addTour(){ while(this.neueTourName == null) { - this.neueTourName = AlertHelper.inputText(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "tournametitle"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "tournameheader"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "tournamemsg")); + this.neueTourName = AlertHelper.inputText(ConfigHelper.getLangIniString("tournametitle"), + ConfigHelper.getLangIniString("tournameheader"), + ConfigHelper.getLangIniString("tournamemsg")); if (getTour(this.neueTourName) != null) { - AlertHelper.warn(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "namevergebenheader"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "namevergebenmsg1") + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("namevergebenheader"), + ConfigHelper.getLangIniString("namevergebenmsg1") + this.neueTourName + - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "namevergebenmsg2")); + ConfigHelper.getLangIniString("namevergebenmsg2")); this.neueTourName = null; } } while(this.neueTourStart == null){ - this.neueTourStart = AlertHelper.inputText(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "startpunkttitle"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "startpunktheader"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "startpunktmsg")); + this.neueTourStart = AlertHelper.inputText(ConfigHelper.getLangIniString("startpunkttitle"), + ConfigHelper.getLangIniString("startpunktheader"), + ConfigHelper.getLangIniString("startpunktmsg")); } while(this.neueTourZiel == null){ - this.neueTourZiel = AlertHelper.inputText(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "zielpunkttitle"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "zielpunktheader"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "zielpunktmsg")); + this.neueTourZiel = AlertHelper.inputText(ConfigHelper.getLangIniString("zielpunkttitle"), + ConfigHelper.getLangIniString("zielpunktheader"), + ConfigHelper.getLangIniString("zielpunktmsg")); } if (getTour(this.neueTourName) == null) { tourData.add(new Tour(this.neueTourName, "TBD", "TBD", 0, this.neueTourStart, this.neueTourZiel)); @@ -202,11 +202,11 @@ public class ViewModel { tourNamen.removeIf(s -> s.equals(tourname)); logData.removeIf(s -> true); }catch (NullPointerException e){ - LogHelper.error(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "deltournoselect")); - AlertHelper.warn(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "achtung"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "keinetourselected"), - ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "langde", "deltournoselectmsg")); + LogHelper.error(ConfigHelper.getLangIniString("keinetourselected"), + ConfigHelper.getLangIniString("deltournoselect")); + AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), + ConfigHelper.getLangIniString("keinetourselected"), + ConfigHelper.getLangIniString("deltournoselectmsg")); } }