Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
792aea12c4 | |||
e56e77dce0 | |||
0402252029 | |||
f45e890fdd | |||
34c11dd6ae | |||
f189928634 | |||
d92f538129 | |||
f2aa9576ba | |||
96b3c864e4 | |||
830bb54e9f | |||
a578df5184 | |||
4c06425cd2 |
28
Doxyfile
28
Doxyfile
@ -38,27 +38,27 @@ PROJECT_NAME = Tourplaner
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 0.0.2
|
PROJECT_NUMBER = 1
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
# quick idea about the purpose of the project. Keep the description short.
|
# quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF = DGTP
|
PROJECT_BRIEF = tpl
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
||||||
# in the documentation. The maximum height of the logo should not exceed 55
|
# in the documentation. The maximum height of the logo should not exceed 55
|
||||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||||
# the logo to the output directory.
|
# the logo to the output directory.
|
||||||
|
|
||||||
PROJECT_LOGO =
|
PROJECT_LOGO = D:/FH_OFFLINE/tourplaner/logo_sm.png
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||||
# into which the generated documentation will be written. If a relative path is
|
# into which the generated documentation will be written. If a relative path is
|
||||||
# entered, it will be relative to the location where doxygen was started. If
|
# entered, it will be relative to the location where doxygen was started. If
|
||||||
# left blank the current directory will be used.
|
# left blank the current directory will be used.
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = C:\Users\georg\OneDrive\FH\Swe\Tourplaner\doxygendoc
|
OUTPUT_DIRECTORY = D:\FH_OFFLINE\tourplaner\doxygendoc
|
||||||
|
|
||||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||||
# directories (in 2 levels) under the output directory of each output format and
|
# directories (in 2 levels) under the output directory of each output format and
|
||||||
@ -864,7 +864,7 @@ WARN_LOGFILE =
|
|||||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = C:\Users\georg\OneDrive\FH\Swe\Tourplaner\src\tourplaner
|
INPUT = D:\FH_OFFLINE\tourplaner\src
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
@ -1304,7 +1304,7 @@ HTML_EXTRA_FILES =
|
|||||||
# Minimum value: 0, maximum value: 359, default value: 220.
|
# Minimum value: 0, maximum value: 359, default value: 220.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_COLORSTYLE_HUE = 220
|
HTML_COLORSTYLE_HUE = 359
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
||||||
# in the HTML output. For a value of 0 the output will use grayscales only. A
|
# in the HTML output. For a value of 0 the output will use grayscales only. A
|
||||||
@ -1312,7 +1312,7 @@ HTML_COLORSTYLE_HUE = 220
|
|||||||
# Minimum value: 0, maximum value: 255, default value: 100.
|
# Minimum value: 0, maximum value: 255, default value: 100.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_COLORSTYLE_SAT = 100
|
HTML_COLORSTYLE_SAT = 0
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
|
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
|
||||||
# luminance component of the colors in the HTML output. Values below 100
|
# luminance component of the colors in the HTML output. Values below 100
|
||||||
@ -1323,7 +1323,7 @@ HTML_COLORSTYLE_SAT = 100
|
|||||||
# Minimum value: 40, maximum value: 240, default value: 80.
|
# Minimum value: 40, maximum value: 240, default value: 80.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_COLORSTYLE_GAMMA = 80
|
HTML_COLORSTYLE_GAMMA = 240
|
||||||
|
|
||||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||||
# page will contain the date and time when the page was generated. Setting this
|
# page will contain the date and time when the page was generated. Setting this
|
||||||
@ -1582,7 +1582,7 @@ DISABLE_INDEX = NO
|
|||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
GENERATE_TREEVIEW = YES
|
GENERATE_TREEVIEW = NO
|
||||||
|
|
||||||
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
||||||
# doxygen will group on one line in the generated HTML documentation.
|
# doxygen will group on one line in the generated HTML documentation.
|
||||||
@ -1790,7 +1790,7 @@ EXTRA_SEARCH_MAPPINGS =
|
|||||||
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_LATEX = YES
|
GENERATE_LATEX = NO
|
||||||
|
|
||||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
|
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
|
||||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||||
@ -2050,7 +2050,7 @@ RTF_SOURCE_CODE = NO
|
|||||||
# classes and files.
|
# classes and files.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
GENERATE_MAN = YES
|
GENERATE_MAN = NO
|
||||||
|
|
||||||
# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
|
# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
|
||||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||||
@ -2128,7 +2128,7 @@ XML_NS_MEMB_FILE_SCOPE = NO
|
|||||||
# that can be used to generate PDF.
|
# that can be used to generate PDF.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
GENERATE_DOCBOOK = YES
|
GENERATE_DOCBOOK = NO
|
||||||
|
|
||||||
# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
|
# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
|
||||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
|
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
|
||||||
@ -2336,7 +2336,7 @@ EXTERNAL_PAGES = YES
|
|||||||
# powerful graphs.
|
# powerful graphs.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
CLASS_DIAGRAMS = YES
|
CLASS_DIAGRAMS = NO
|
||||||
|
|
||||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||||
# then run dia to produce the diagram and insert it in the documentation. The
|
# then run dia to produce the diagram and insert it in the documentation. The
|
||||||
@ -2358,7 +2358,7 @@ HIDE_UNDOC_RELATIONS = YES
|
|||||||
# set to NO
|
# set to NO
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HAVE_DOT = NO
|
HAVE_DOT = YES
|
||||||
|
|
||||||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
||||||
# to run in parallel. When set to 0 doxygen will base this on the number of
|
# to run in parallel. When set to 0 doxygen will base this on the number of
|
||||||
|
16
README.md
16
README.md
@ -1,8 +1,16 @@
|
|||||||
# Tourplaner
|
# Tourplaner
|
||||||
|
* JavaDoc: https://dergeorg.at/javadoc
|
||||||
|
* DoxygenDoc: https://dergeorg.at/doxygendoc/html
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
* DB informationen müssen in das config.ini.sample unter [db] eingetragen werden
|
* DB informationen müssen in das config.ini.sample unter ```[db]``` eingetragen werden
|
||||||
* Datei muss in config.ini umbenannt werden
|
* Datei muss in config.ini umbenannt werden
|
||||||
* [langde] beinhaltet alle Deutschen Texte der Gui
|
* ```langde.ini``` beinhaltet alle Deutschen Texte der Gui
|
||||||
* [start] beinhaltet den Title und infos die beim start verabeitet werden
|
* ```langen.ini``` beinhaltet alle Englischen Texte der Gui
|
||||||
* [hilfe] beinhaltet die Links zu den Hilfeseiten
|
* Bei ```[map] -> key``` muss ein API Key zu Mapquest eingegeben werden
|
||||||
|
* Bei ```[report] -> path``` kann der Path eingestellt werden, wo die Reports gespeichert werden
|
||||||
|
* Bei ```[map] -> path``` kann der Path eingestellt werden, wo die Maps gespeichert werden
|
||||||
|
|
||||||
|
# UML
|
||||||
|
```[UML.svg]``` (https://git.dergeorg.at/dergeorg/tourplaner/src/branch/master/uml.svg)
|
||||||
|

|
@ -15,6 +15,6 @@ create unique index tour_tourname_uindex
|
|||||||
|
|
||||||
alter table tour add constraint tour_pk primary key (tourname);
|
alter table tour add constraint tour_pk primary key (tourname);
|
||||||
|
|
||||||
#// Log Table
|
// Log Table
|
||||||
|
|
||||||
create table log(tourname varchar constraint log_tour_tourname_fk references tour,id varchar,bemerkung varchar,datum date,strecke decimal,avg decimal,hightmeter decimal,pause decimal,gegangen decimal,dauer decimal);
|
create table log(tourname varchar constraint log_tour_tourname_fk references tour,id varchar,bemerkung varchar,datum date,strecke decimal,avg decimal,hightmeter decimal,pause decimal,gegangen decimal,dauer decimal, rating varchar);
|
@ -106,4 +106,7 @@ rsummrepo = Zusammengefasster Report
|
|||||||
bewertung = Bewertung
|
bewertung = Bewertung
|
||||||
bewertungmsg = Bitte die Bewertung zwischen 0 und 5 eingeben
|
bewertungmsg = Bitte die Bewertung zwischen 0 und 5 eingeben
|
||||||
bewertungeror = Bitte nur Bewertungen von 0 und 5 eingeben
|
bewertungeror = Bitte nur Bewertungen von 0 und 5 eingeben
|
||||||
bewertungerror2 = Bitte nur Zahlen zum Bewerten
|
bewertungerror2 = Bitte nur Zahlen zum Bewerten
|
||||||
|
|
||||||
|
copybtn = Kopieren
|
||||||
|
rating = Bewertung
|
@ -107,4 +107,7 @@ rsummrepo = Summary Report
|
|||||||
bewertung = Rating
|
bewertung = Rating
|
||||||
bewertungmsg = Please enter a rating from 0 to 5
|
bewertungmsg = Please enter a rating from 0 to 5
|
||||||
bewertungeror = Please enter only a rating from 0 to 5
|
bewertungeror = Please enter only a rating from 0 to 5
|
||||||
bewertungerror2 = Please only enter numbers for rating
|
bewertungerror2 = Please only enter numbers for rating
|
||||||
|
|
||||||
|
copybtn = Copy
|
||||||
|
rating = Rating
|
@ -10,8 +10,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class ConfigHelper {
|
public class ConfigHelper {
|
||||||
|
|
||||||
public static String standartConfig = "conf.ini"; // Config.ini befindet sich im Root Verzeichnis
|
public static final 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
|
* Liest einen Int aus der Config aus
|
||||||
@ -103,12 +102,4 @@ public class ConfigHelper {
|
|||||||
public static String getStandartConfig() {
|
public static String getStandartConfig() {
|
||||||
return standartConfig;
|
return standartConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gibt den namen des standard langde file zurück
|
|
||||||
* @return Name des standard langde files
|
|
||||||
*/
|
|
||||||
public static String getStandartLangde() {
|
|
||||||
return standartLangDe;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class DirectionMap {
|
public class DirectionMap {
|
||||||
private double dauer, strecke;
|
private double dauer, strecke;
|
||||||
private String start, end, tourname, file, filepdf;
|
private String sessionId;
|
||||||
private Image map, mappdf;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt die Map als image und alle Daten zur berechneten Route
|
* Holt die Map als image und alle Daten zur berechneten Route
|
||||||
@ -21,16 +20,13 @@ public class DirectionMap {
|
|||||||
* @throws IOException Fehler beim Image der Map
|
* @throws IOException Fehler beim Image der Map
|
||||||
*/
|
*/
|
||||||
public DirectionMap (String start, String ende, String tourname) throws IOException {
|
public DirectionMap (String start, String ende, String tourname) throws IOException {
|
||||||
this.map = getMap(start, ende, ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "size"));
|
|
||||||
this.mappdf = getMap(start, ende, ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "sizePdf"));
|
|
||||||
this.start = start;
|
|
||||||
this.end = ende;
|
|
||||||
this.tourname = tourname;
|
|
||||||
this.file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + this.tourname + ".jpg";
|
|
||||||
this.filepdf = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + this.tourname + "_pdf.jpg";
|
|
||||||
FileHelper.saveImage(this.map, "jpg", new File(this.file));
|
|
||||||
FileHelper.saveImage(this.mappdf, "jpg", new File(this.filepdf));
|
|
||||||
getDirections(start, ende);
|
getDirections(start, ende);
|
||||||
|
Image map = getMap(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "size"));
|
||||||
|
Image mappdf = getMap(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "sizePdf"));
|
||||||
|
String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + ".jpg";
|
||||||
|
String filepdf = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + "_pdf.jpg";
|
||||||
|
FileHelper.saveImage(map, "jpg", new File(file));
|
||||||
|
FileHelper.saveImage(mappdf, "jpg", new File(filepdf));
|
||||||
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
|
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
|
||||||
FileHelper.openDefault(file);
|
FileHelper.openDefault(file);
|
||||||
}
|
}
|
||||||
@ -59,8 +55,8 @@ public class DirectionMap {
|
|||||||
* @return Image von der Map
|
* @return Image von der Map
|
||||||
* @throws IOException Fehler beim Get der Map
|
* @throws IOException Fehler beim Get der Map
|
||||||
*/
|
*/
|
||||||
private Image getMap(String start, String ende, String size) throws IOException {
|
private Image getMap(String size) throws IOException {
|
||||||
return HttpHelper.httpGetImage("https://www.mapquestapi.com/staticmap/v5/map?start="+start+"&end="+ende+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
|
return HttpHelper.httpGetImage("https://www.mapquestapi.com/staticmap/v5/map?session="+this.sessionId+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,12 +66,10 @@ public class DirectionMap {
|
|||||||
* @throws IOException Fehler beim besorgen der infos über die Tour
|
* @throws IOException Fehler beim besorgen der infos über die Tour
|
||||||
*/
|
*/
|
||||||
private void getDirections(String start, String ende) throws IOException {
|
private void getDirections(String start, String ende) throws IOException {
|
||||||
System.out.println("LOCS: " + start + ende);
|
|
||||||
String json = HttpHelper.httpGetJsonString("https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false");
|
String json = HttpHelper.httpGetJsonString("https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false");
|
||||||
System.out.println("JSON: " + json);
|
|
||||||
System.out.println("URL https://www.mapquestapi.com/directions/v2/route?key="+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key")+"&from="+start+"&to="+ende+"&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false");
|
|
||||||
this.strecke = JsonHelper.getDoubleFromJson(json, "distance");
|
this.strecke = JsonHelper.getDoubleFromJson(json, "distance");
|
||||||
this.dauer = formatetTimeToMinutes(JsonHelper.getStingFromJson(json, "formattedTime"));
|
this.dauer = formatetTimeToMinutes(JsonHelper.getStingFromJson(json, "formattedTime"));
|
||||||
|
this.sessionId = JsonHelper.getStingFromJson(json, "sessionId");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,10 +3,8 @@ package tourplaner.business;
|
|||||||
import tourplaner.data.DbConnect;
|
import tourplaner.data.DbConnect;
|
||||||
import tourplaner.object.Log;
|
import tourplaner.object.Log;
|
||||||
import tourplaner.object.Tour;
|
import tourplaner.object.Tour;
|
||||||
import tourplaner.ui.AlertHelper;
|
|
||||||
import tourplaner.ui.ProgressBar;
|
import tourplaner.ui.ProgressBar;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -15,8 +13,7 @@ import java.util.ArrayList;
|
|||||||
*/
|
*/
|
||||||
public class Exporter {
|
public class Exporter {
|
||||||
|
|
||||||
private ArrayList<Tour> touren;
|
private final String path;
|
||||||
private String path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt den Exporter mit dem gegebenen Path
|
* Erstellt den Exporter mit dem gegebenen Path
|
||||||
@ -32,9 +29,9 @@ public class Exporter {
|
|||||||
*/
|
*/
|
||||||
public void doExport() throws IOException {
|
public void doExport() throws IOException {
|
||||||
ProgressBar progressBar = new ProgressBar("Export...");
|
ProgressBar progressBar = new ProgressBar("Export...");
|
||||||
int step = progressBar.getProgressSize(4, 100);
|
|
||||||
ArrayList<Tour> data = new DbConnect().getAllTouren();
|
|
||||||
|
|
||||||
|
ArrayList<Tour> data = new DbConnect().getAllTouren(progressBar, 15);
|
||||||
|
int step = progressBar.getProgressSize(4, 100);
|
||||||
progressBar.addProgress(step);
|
progressBar.addProgress(step);
|
||||||
FileWriter fileWriter = new FileWriter(EinheitenAdder.addJson(this.path));
|
FileWriter fileWriter = new FileWriter(EinheitenAdder.addJson(this.path));
|
||||||
progressBar.addProgress(step);
|
progressBar.addProgress(step);
|
||||||
@ -48,29 +45,33 @@ public class Exporter {
|
|||||||
/**
|
/**
|
||||||
* Führt den Imput aus: File holen, Daten in db erstellen
|
* Führt den Imput aus: File holen, Daten in db erstellen
|
||||||
*/
|
*/
|
||||||
public void doImport() {
|
public void doImport(ProgressBar progressBar, int progressMax) {
|
||||||
ProgressBar progressBar = new ProgressBar("Import...");
|
|
||||||
try {
|
try {
|
||||||
this.touren = JsonHelper.getTourenFromJson(new FileReader(EinheitenAdder.addJson(this.path)));
|
ArrayList<Tour> touren = JsonHelper.getTourenFromJson(new FileReader(EinheitenAdder.addJson(this.path)));
|
||||||
DbConnect dbConnect = new DbConnect();
|
DbConnect dbConnect = new DbConnect();
|
||||||
dbConnect.delAllData();
|
ArrayList<Tour> allTours = dbConnect.getAllTouren(progressBar, 15);
|
||||||
progressBar.addProgress(5);
|
int size = progressBar.getProgressSize(allTours.size(), 35);
|
||||||
int size = progressBar.getProgressSize(this.touren.size() * 3, 100);
|
allTours.forEach(t -> {
|
||||||
for (Tour tour:this.touren) {
|
TourPlaner.delTour(t.getName());
|
||||||
|
progressBar.addProgress(size);
|
||||||
|
});
|
||||||
|
|
||||||
|
int finalSize = progressBar.getProgressSize(touren.size() * 3, progressMax);
|
||||||
|
for (Tour tour: touren) {
|
||||||
new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName());
|
new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName());
|
||||||
progressBar.addProgress(size);
|
progressBar.addProgress(finalSize);
|
||||||
dbConnect.addTour(tour);
|
dbConnect.addTour(tour);
|
||||||
progressBar.addProgress(size);
|
progressBar.addProgress(finalSize);
|
||||||
ArrayList<Log> logs = tour.getLogs();
|
ArrayList<Log> logs = tour.getLogs();
|
||||||
for (Log log:logs) {
|
for (Log log:logs) {
|
||||||
dbConnect.addLog(tour.getName(), log);
|
dbConnect.addLog(tour.getName(), log);
|
||||||
}
|
}
|
||||||
progressBar.addProgress(size);
|
progressBar.addProgress(finalSize);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(progressMax);
|
||||||
}
|
}
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(progressMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,6 @@ public class JsonHelper {
|
|||||||
return getJObj(json).get("route").getAsJsonObject().get(gets).getAsDouble();
|
return getJObj(json).get("route").getAsJsonObject().get(gets).getAsDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Erzeugt ein Json aus einem Object
|
|
||||||
* @param obj Das Objekt
|
|
||||||
* @return Json des Objektes
|
|
||||||
*/
|
|
||||||
public static String getJsonFromObj(Object obj){
|
|
||||||
return new Gson().toJson(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erzeugt ein Json aus einem Object
|
* Erzeugt ein Json aus einem Object
|
||||||
* @param obj Das Objekt
|
* @param obj Das Objekt
|
||||||
|
@ -15,15 +15,6 @@ public class LogHelper{
|
|||||||
getLog(name).info(msg);
|
getLog(name).info(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Log info in file und Console
|
|
||||||
* @param msg Nachricht in dem Log
|
|
||||||
* @param name Name des Log Eintrags
|
|
||||||
*/
|
|
||||||
public static void warn(String msg, String name){
|
|
||||||
getLog(name).warn(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log info in file und Console
|
* Log info in file und Console
|
||||||
* @param msg Nachricht in dem Log
|
* @param msg Nachricht in dem Log
|
||||||
@ -41,15 +32,6 @@ public class LogHelper{
|
|||||||
getLog(e.getClass().getName()).error(e.getMessage());
|
getLog(e.getClass().getName()).error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Log info in file und Console
|
|
||||||
* @param msg Nachricht in dem Log
|
|
||||||
* @param name Name des Log Eintrags
|
|
||||||
*/
|
|
||||||
public static void fatal(String msg, String name){
|
|
||||||
getLog(name).fatal(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instanziert den Logger
|
* Instanziert den Logger
|
||||||
* @param name Name des Loggers
|
* @param name Name des Loggers
|
||||||
|
@ -7,6 +7,7 @@ import tourplaner.object.Log;
|
|||||||
import tourplaner.object.Tour;
|
import tourplaner.object.Tour;
|
||||||
|
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
|
import tourplaner.ui.ProgressBar;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -25,25 +26,22 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public class Reporter {
|
public class Reporter {
|
||||||
|
|
||||||
private static Font catFont = new Font(Font.TIMES_ROMAN, 18,
|
private static final Font catFont = new Font(Font.TIMES_ROMAN, 18,
|
||||||
Font.BOLD);
|
Font.BOLD);
|
||||||
private static Font redFont = new Font(Font.TIMES_ROMAN, 12,
|
private static final Font subFont = new Font(Font.TIMES_ROMAN, 16,
|
||||||
Font.NORMAL, Color.RED);
|
|
||||||
private static Font subFont = new Font(Font.TIMES_ROMAN, 16,
|
|
||||||
Font.BOLD);
|
|
||||||
private static Font smallBold = new Font(Font.TIMES_ROMAN, 12,
|
|
||||||
Font.BOLD);
|
Font.BOLD);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt den Summary Report
|
* Erstellt den Summary Report
|
||||||
*/
|
*/
|
||||||
public static void sumReport(){
|
public static void sumReport(ProgressBar progressBar, int maxLevel){
|
||||||
ArrayList<Tour> tours = TourPlaner.getAllTours();
|
ArrayList<Tour> tours = TourPlaner.getAllTours(progressBar, maxLevel);
|
||||||
String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "report", "path") + "summary.pdf";
|
String file = ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "report", "path") + "summary.pdf";
|
||||||
try {
|
try {
|
||||||
Document document = new Document();
|
Document document = new Document();
|
||||||
PdfWriter.getInstance(document, new FileOutputStream(file));
|
PdfWriter.getInstance(document, new FileOutputStream(file));
|
||||||
document.open();
|
document.open();
|
||||||
|
addMetaData(document, new Tour("Summary", "String dauer", "String mapJson", 1, "String start", "String ziel"));
|
||||||
addSumRepo(document, tours);
|
addSumRepo(document, tours);
|
||||||
|
|
||||||
document.close();
|
document.close();
|
||||||
@ -177,6 +175,7 @@ public class Reporter {
|
|||||||
subCatPart.add(new Paragraph(EinheitenAdder.addKm(ConfigHelper.getLangIniString("logstrecke") + " " + log.getStrecke())));
|
subCatPart.add(new Paragraph(EinheitenAdder.addKm(ConfigHelper.getLangIniString("logstrecke") + " " + log.getStrecke())));
|
||||||
subCatPart.add(new Paragraph(EinheitenAdder.addMeter(ConfigHelper.getLangIniString("loghight") + " " + log.getHightmeter())));
|
subCatPart.add(new Paragraph(EinheitenAdder.addMeter(ConfigHelper.getLangIniString("loghight") + " " + log.getHightmeter())));
|
||||||
subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + " " + log.getBemerkung()));
|
subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + " " + log.getBemerkung()));
|
||||||
|
subCatPart.add(new Paragraph( "Rating " + log.getRating()));
|
||||||
}
|
}
|
||||||
// now add all this to the document
|
// now add all this to the document
|
||||||
document.add(catPart);
|
document.add(catPart);
|
||||||
@ -192,53 +191,4 @@ public class Reporter {
|
|||||||
paragraph.add(new Paragraph(" "));
|
paragraph.add(new Paragraph(" "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// private static void createTable(Section subCatPart)
|
|
||||||
// throws BadElementException {
|
|
||||||
// PdfPTable table = new PdfPTable(5);
|
|
||||||
//
|
|
||||||
// // t.setBorderColor(BaseColor.GRAY);
|
|
||||||
// // t.setPadding(4);
|
|
||||||
// // t.setSpacing(4);
|
|
||||||
// // t.setBorderWidth(1);
|
|
||||||
//
|
|
||||||
// PdfPCell c1 = new PdfPCell(new Phrase("NR"));
|
|
||||||
// c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
||||||
// table.addCell(c1);
|
|
||||||
//
|
|
||||||
// c1 = new PdfPCell(new Phrase("Datum"));
|
|
||||||
// c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
||||||
// table.addCell(c1);
|
|
||||||
//
|
|
||||||
// c1 = new PdfPCell(new Phrase("Entfernung"));
|
|
||||||
// c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
||||||
// table.addCell(c1);
|
|
||||||
//
|
|
||||||
// c1 = new PdfPCell(new Phrase("Höhenmeter"));
|
|
||||||
// c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
||||||
// table.addCell(c1);
|
|
||||||
//
|
|
||||||
// c1 = new PdfPCell(new Phrase("AVG Geschwindigkeit"));
|
|
||||||
// c1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
||||||
// table.addCell(c1);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// table.setHeaderRows(1);
|
|
||||||
//
|
|
||||||
// table.addCell("1.0");
|
|
||||||
// table.addCell("1.1");
|
|
||||||
// table.addCell("1.2");
|
|
||||||
// table.addCell("1.3");
|
|
||||||
// table.addCell("1.4");
|
|
||||||
// table.addCell("1.5");
|
|
||||||
//
|
|
||||||
// table.addCell("2.0");
|
|
||||||
// table.addCell("2.1");
|
|
||||||
// table.addCell("2.2");
|
|
||||||
// table.addCell("2.3");
|
|
||||||
// table.addCell("2.4");
|
|
||||||
// table.addCell("2.5");
|
|
||||||
//
|
|
||||||
// subCatPart.add(table);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package tourplaner.business;
|
package tourplaner.business;
|
||||||
|
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import tourplaner.data.DbConnect;
|
import tourplaner.data.DbConnect;
|
||||||
import tourplaner.object.Log;
|
import tourplaner.object.Log;
|
||||||
@ -8,15 +9,16 @@ import tourplaner.ui.ProgressBar;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Haupt Logik des Tourplaners
|
* Haupt Logik des Tourplaners
|
||||||
*/
|
*/
|
||||||
public class TourPlaner{
|
public class TourPlaner{
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt alle DB Tabellen falls nötig
|
* Erstellt alle DB Tabellen falls nötig
|
||||||
@ -29,8 +31,8 @@ public class TourPlaner{
|
|||||||
* Holt alle touren aus der DB
|
* Holt alle touren aus der DB
|
||||||
* @return Alle touren als ArrayList
|
* @return Alle touren als ArrayList
|
||||||
*/
|
*/
|
||||||
public static ArrayList<Tour> getAllTours(){
|
public static ArrayList<Tour> getAllTours(ProgressBar progressBar, int maxLevel){
|
||||||
return new DbConnect().getAllTouren();
|
return new DbConnect().getAllTouren(progressBar, maxLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,16 +63,30 @@ public class TourPlaner{
|
|||||||
* @return false bei error
|
* @return false bei error
|
||||||
*/
|
*/
|
||||||
public static boolean delTour(String tourname){
|
public static boolean delTour(String tourname){
|
||||||
ProgressBar progressBar = new ProgressBar("Del...");
|
|
||||||
int step = progressBar.getProgressSize(3, 100);
|
|
||||||
FileHelper.delFile(new File(getImagePath(tourname)));
|
FileHelper.delFile(new File(getImagePath(tourname)));
|
||||||
progressBar.addProgress(step);
|
|
||||||
FileHelper.delFile(new File(getImagePdfPath(tourname)));
|
FileHelper.delFile(new File(getImagePdfPath(tourname)));
|
||||||
progressBar.addProgress(step);
|
|
||||||
boolean ret = new DbConnect().delTour(tourname);
|
boolean ret = new DbConnect().delTour(tourname);
|
||||||
progressBar.setProgress(100);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Fügt eine Tour hinzu
|
||||||
|
* @param newTour Neue Tour
|
||||||
|
* @param progressBar Aktuelle Progressbar
|
||||||
|
* @param progressMax Maximale anzeige der Progress bar
|
||||||
|
* @return false bei error
|
||||||
|
* @throws IOException Fehler beim hinzufügen der Tour
|
||||||
|
*/
|
||||||
|
public static boolean addTourMax(Tour newTour, ProgressBar progressBar, int progressMax) throws IOException {
|
||||||
|
int step = progressBar.getProgressSize(2, progressMax);
|
||||||
|
DirectionMap directionMap = new DirectionMap(newTour.getStart(), newTour.getZiel(), newTour.getName());
|
||||||
|
progressBar.addProgress(step);
|
||||||
|
newTour.setDauer(directionMap.getDauer()+"");
|
||||||
|
newTour.setStrecke(directionMap.getStrecke());
|
||||||
|
boolean ret = new DbConnect().addTour(newTour);
|
||||||
|
progressBar.setProgress(progressMax);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fügt eine Tour hinzu
|
* Fügt eine Tour hinzu
|
||||||
* @param newTour Neue Tour
|
* @param newTour Neue Tour
|
||||||
@ -79,27 +95,10 @@ public class TourPlaner{
|
|||||||
* @throws IOException Fehler beim hinzufügen der Tour
|
* @throws IOException Fehler beim hinzufügen der Tour
|
||||||
*/
|
*/
|
||||||
public static boolean addTour(Tour newTour, ProgressBar progressBar) throws IOException {
|
public static boolean addTour(Tour newTour, ProgressBar progressBar) throws IOException {
|
||||||
int step = progressBar.getProgressSize(2, 100);
|
return addTourMax(newTour, progressBar, 100);
|
||||||
DirectionMap directionMap = new DirectionMap(newTour.getStart(), newTour.getZiel(), newTour.getName());
|
|
||||||
progressBar.addProgress(step);
|
|
||||||
newTour.setDauer(directionMap.getDauer()+"");
|
|
||||||
newTour.setStrecke(directionMap.getStrecke());
|
|
||||||
boolean ret = new DbConnect().addTour(newTour);
|
|
||||||
progressBar.setProgress(100);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt das Gui Bild
|
|
||||||
* @param tourname Name der Tour
|
|
||||||
* @return Das Bild
|
|
||||||
* @throws IOException Error beim Bild holen
|
|
||||||
*/
|
|
||||||
public static Image getImage(String tourname) throws IOException {
|
|
||||||
return FileHelper.getImage(new File(getImagePath(tourname)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path zu dem Bild für die GUI
|
* Path zu dem Bild für die GUI
|
||||||
* @param tourname Name der Tour
|
* @param tourname Name der Tour
|
||||||
* @return Path zu dem Bild für die GUI
|
* @return Path zu dem Bild für die GUI
|
||||||
@ -117,16 +116,6 @@ public class TourPlaner{
|
|||||||
return ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + "_pdf.jpg";
|
return ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "path") + tourname + "_pdf.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Öffnet ein Bild einer Tour
|
|
||||||
* @param tourname Tourname
|
|
||||||
*/
|
|
||||||
public static void openImage(String tourname){
|
|
||||||
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
|
|
||||||
FileHelper.openDefault(getImagePath(tourname));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt alle Logs einer Tour
|
* Holt alle Logs einer Tour
|
||||||
@ -191,14 +180,42 @@ public class TourPlaner{
|
|||||||
* @param tourname Name der zu suchen ist
|
* @param tourname Name der zu suchen ist
|
||||||
* @return Alle touren die auf den Suchterm passen
|
* @return Alle touren die auf den Suchterm passen
|
||||||
*/
|
*/
|
||||||
public static ArrayList<Tour> sucheTour(String tourname){
|
public static ArrayList<Tour> sucheTour(String tourname, ProgressBar progressBar, int maxProgress){
|
||||||
ArrayList<Tour> touren = new ArrayList<>();
|
ArrayList<Tour> touren = new ArrayList<>();
|
||||||
getAllTours().forEach(t ->{
|
getAllTours(progressBar, maxProgress).forEach(t ->{
|
||||||
if(t.getName().contains(tourname)){
|
ArrayList<Log> logs = t.getLogs();
|
||||||
touren.add(t);
|
ArrayList<String> bemerkungen = new ArrayList<>();
|
||||||
|
for (Log l:logs) {
|
||||||
|
bemerkungen.add(l.getBemerkung().toLowerCase(Locale.ROOT));
|
||||||
|
}
|
||||||
|
bemerkungen.forEach(b -> {
|
||||||
|
if(b.contains(tourname.toLowerCase(Locale.ROOT))){
|
||||||
|
touren.add(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(bemerkungen.contains(tourname.toLowerCase()) || t.getZiel().toLowerCase(Locale.ROOT).contains(tourname.toLowerCase()) || t.getName().toLowerCase(Locale.ROOT).contains(tourname.toLowerCase()) || t.getStart().toLowerCase(Locale.ROOT).contains(tourname.toLowerCase())){
|
||||||
|
if(!touren.contains(t)) {
|
||||||
|
touren.add(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return touren;
|
return touren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine Neue Log id
|
||||||
|
* @param logData Alle log daten
|
||||||
|
* @return Neue log id
|
||||||
|
*/
|
||||||
|
public static String newLogId(ObservableList<Log> logData){
|
||||||
|
AtomicReference<String> newId = new AtomicReference<>();
|
||||||
|
newId.set(UUID.randomUUID().toString());
|
||||||
|
logData.forEach(ss -> {
|
||||||
|
if (ss.getId().equals(newId.get())) {
|
||||||
|
newId.set(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newId.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package tourplaner.data;
|
package tourplaner.data;
|
||||||
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import tourplaner.business.LogHelper;
|
import tourplaner.business.LogHelper;
|
||||||
import tourplaner.object.Log;
|
import tourplaner.object.Log;
|
||||||
import tourplaner.object.Tour;
|
import tourplaner.object.Tour;
|
||||||
import tourplaner.ui.AlertHelper;
|
|
||||||
import tourplaner.ui.ProgressBar;
|
import tourplaner.ui.ProgressBar;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,15 +27,12 @@ public class DbConnect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt alle Tabellen die für den Betrieb der Software bennötigt werden
|
* Erstellt alle Tabellen die für den Betrieb der Software bennötigt werden
|
||||||
* @return True bei erfolg, sonst error
|
|
||||||
*/
|
*/
|
||||||
public boolean init() {
|
public void init() {
|
||||||
ArrayList<Boolean> errors = new ArrayList<>();
|
PostgresHelper.executeUpdateNoLog("create table tour ( tourname varchar not null, dauer decimal, mapjson varchar, start varchar, ziel varchar, strecke decimal);");
|
||||||
errors.add(PostgresHelper.executeUpdateMessage("create table tour ( tourname varchar not null, dauer decimal, mapjson varchar, start varchar, ziel varchar, strecke decimal);", "Tour Table created"));
|
PostgresHelper.executeUpdateNoLog("create unique index tour_tourname_uindex on tour (tourname);");
|
||||||
errors.add(PostgresHelper.executeUpdateMessage("create unique index tour_tourname_uindex on tour (tourname);", "Tour Table unique created"));
|
PostgresHelper.executeUpdateNoLog("alter table tour add constraint tour_pk primary key (tourname);");
|
||||||
errors.add(PostgresHelper.executeUpdateMessage("alter table tour add constraint tour_pk primary key (tourname);", "Tour Table primary created"));
|
PostgresHelper.executeUpdateNoLog("create table log(tourname varchar constraint log_tour_tourname_fk references tour,id varchar,bemerkung varchar,datum date,strecke decimal,avg decimal,hightmeter decimal,pause decimal,gegangen decimal,dauer decimal,rating varchar);");
|
||||||
errors.add(PostgresHelper.executeUpdateMessage("create table log(tourname varchar constraint log_tour_tourname_fk references tour,id varchar,bemerkung varchar,datum date,strecke decimal,avg decimal,hightmeter decimal,pause decimal,gegangen decimal,dauer decimal,rating varchar);", "Log Table created"));
|
|
||||||
return !errors.contains(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,9 +48,7 @@ public class DbConnect {
|
|||||||
ArrayList<Log> logs = getLogs(oldname);
|
ArrayList<Log> logs = getLogs(oldname);
|
||||||
result.add(delLogs(oldname));
|
result.add(delLogs(oldname));
|
||||||
result.add(PostgresHelper.executeUpdate("UPDATE public.tour SET tourname = '"+tour.getName()+"', dauer = 1, mapjson = '"+tour.getMapJson()+"', start = '"+tour.getStart()+"', ziel = '"+tour.getZiel()+"', strecke = "+tour.getStrecke()+" WHERE tourname ='" + oldname + "';"));
|
result.add(PostgresHelper.executeUpdate("UPDATE public.tour SET tourname = '"+tour.getName()+"', dauer = 1, mapjson = '"+tour.getMapJson()+"', start = '"+tour.getStart()+"', ziel = '"+tour.getZiel()+"', strecke = "+tour.getStrecke()+" WHERE tourname ='" + oldname + "';"));
|
||||||
logs.forEach(log -> {
|
logs.forEach(log -> result.add(addLog(tourname, log)));
|
||||||
result.add(addLog(tourname, log));
|
|
||||||
});
|
|
||||||
return !result.contains(false);
|
return !result.contains(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +122,7 @@ public class DbConnect {
|
|||||||
this.c.close();
|
this.c.close();
|
||||||
return logs;
|
return logs;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println(e.getClass().getName() + ": " + e.getMessage());
|
LogHelper.error(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,15 +136,13 @@ public class DbConnect {
|
|||||||
*/
|
*/
|
||||||
public boolean addLog(String tourname, Log log){
|
public boolean addLog(String tourname, Log log){
|
||||||
if(Double.isInfinite(log.getAvgspeed())) log.setAvgspeed(-1.0);
|
if(Double.isInfinite(log.getAvgspeed())) log.setAvgspeed(-1.0);
|
||||||
System.out.println("INSERT INTO public.log (tourname, id, bemerkung, datum, strecke, avg, hightmeter, pause, gegangen, dauer, rating) VALUES ('"+tourname+"', '"+log.getId()+"', '"+log.getBemerkung()+"', '"+log.getDatum()+"', "
|
|
||||||
+log.getStrecke()+", "+log.getAvgspeed()+", "+log.getHightmeter()+", "+log.getPause()+", "+log.getGegangen()+", "+log.getDauer()+",'"+log.getRating()+"')");
|
|
||||||
return PostgresHelper.executeUpdate("INSERT INTO public.log (tourname, id, bemerkung, datum, strecke, avg, hightmeter, pause, gegangen, dauer, rating) VALUES ('"+tourname+"', '"+log.getId()+"', '"+log.getBemerkung()+"', '"+log.getDatum()+"', "
|
return PostgresHelper.executeUpdate("INSERT INTO public.log (tourname, id, bemerkung, datum, strecke, avg, hightmeter, pause, gegangen, dauer, rating) VALUES ('"+tourname+"', '"+log.getId()+"', '"+log.getBemerkung()+"', '"+log.getDatum()+"', "
|
||||||
+log.getStrecke()+", "+log.getAvgspeed()+", "+log.getHightmeter()+", "+log.getPause()+", "+log.getGegangen()+", "+log.getDauer()+",'"+log.getRating()+"')");
|
+log.getStrecke()+", "+log.getAvgspeed()+", "+log.getHightmeter()+", "+log.getPause()+", "+log.getGegangen()+", "+log.getDauer()+",'"+log.getRating()+"')");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean editLog(String tourname, Log log){
|
public boolean editLog(String tourname, Log log){
|
||||||
return PostgresHelper.executeUpdate("UPDATE public.log SET bemerkung = '"+log.getBemerkung()+"', datum = '"+log.getDatum()+"', strecke = "+log.getStrecke()+", avg = "+log.getAvgspeed()+", hightmeter = "+
|
return PostgresHelper.executeUpdate("UPDATE public.log SET bemerkung = '"+log.getBemerkung()+"', datum = '"+log.getDatum()+"', strecke = "+log.getStrecke()+", avg = "+log.getAvgspeed()+", hightmeter = "+
|
||||||
log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+" WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"', rating = '"+log.getRating()+"'");
|
log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+", rating = '"+log.getRating()+"' WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean delLog(String tourname, String id){
|
public boolean delLog(String tourname, String id){
|
||||||
@ -177,17 +167,18 @@ public class DbConnect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt alle Touren aus der Datenbank
|
* Holt alle Touren aus der Datenbank
|
||||||
|
* @param progressBar Aktuelle Progress bar
|
||||||
|
* @param maxLevel Maximales level der progress bar
|
||||||
* @return Null bei fehler, sonst eine List aus den IDs
|
* @return Null bei fehler, sonst eine List aus den IDs
|
||||||
*/
|
*/
|
||||||
public ArrayList<Tour> getAllTouren() {
|
public ArrayList<Tour> getAllTouren(ProgressBar progressBar, int maxLevel) {
|
||||||
this.c = PostgresHelper.con();
|
this.c = PostgresHelper.con();
|
||||||
String tourname, mapjson, start, ziel;
|
String tourname, mapjson, start, ziel;
|
||||||
double dauer, strecke;
|
double dauer, strecke;
|
||||||
ArrayList<Tour> touren = new ArrayList<>();
|
ArrayList<Tour> touren = new ArrayList<>();
|
||||||
ProgressBar progressBar = new ProgressBar("Get...");
|
|
||||||
try {
|
try {
|
||||||
int tourSize = getTourSize();
|
int tourSize = getTourSize();
|
||||||
int step = progressBar.getProgressSize(tourSize, 100);
|
int step = progressBar.getProgressSize(tourSize, maxLevel);
|
||||||
stmt = this.c.createStatement();
|
stmt = this.c.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("select * from tour;");
|
ResultSet rs = stmt.executeQuery("select * from tour;");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
@ -201,18 +192,18 @@ public class DbConnect {
|
|||||||
touren.add(new Tour(tourname, dauer + "", mapjson, strecke, start, ziel, getLogs(tourname)));
|
touren.add(new Tour(tourname, dauer + "", mapjson, strecke, start, ziel, getLogs(tourname)));
|
||||||
progressBar.addProgress(step);
|
progressBar.addProgress(step);
|
||||||
}else {
|
}else {
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(maxLevel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(maxLevel);
|
||||||
rs.close();
|
rs.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
this.c.close();
|
this.c.close();
|
||||||
return touren;
|
return touren;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(maxLevel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,7 +240,7 @@ public class DbConnect {
|
|||||||
this.c.close();
|
this.c.close();
|
||||||
return touren;
|
return touren;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println(e.getClass().getName() + ": " + e.getMessage());
|
LogHelper.error(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,16 @@ package tourplaner.data;
|
|||||||
|
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
import tourplaner.business.LogHelper;
|
import tourplaner.business.LogHelper;
|
||||||
import tourplaner.object.Tour;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hilfsfunktionen für die verwendung der Postgres DB
|
* Hilfsfunktionen für die verwendung der Postgres DB
|
||||||
*/
|
*/
|
||||||
public class PostgresHelper {
|
public class PostgresHelper {
|
||||||
private Connection c;
|
|
||||||
private Statement stmt;
|
|
||||||
/**
|
/**
|
||||||
* Verbindet mit der Datenbank
|
* Verbindet mit der Datenbank
|
||||||
* @return Das Connection Objekt
|
* @return Das Connection Objekt
|
||||||
@ -25,8 +21,6 @@ public class PostgresHelper {
|
|||||||
Connection c = null;
|
Connection c = null;
|
||||||
try {
|
try {
|
||||||
Class.forName("org.postgresql.Driver");
|
Class.forName("org.postgresql.Driver");
|
||||||
System.out.println("jdbc:postgresql://" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "url") + ":" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "port") + "/" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "dbname")+
|
|
||||||
ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "user")+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "pw"));
|
|
||||||
c = DriverManager
|
c = DriverManager
|
||||||
.getConnection("jdbc:postgresql://" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "url") + ":" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "port") + "/" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "dbname"),
|
.getConnection("jdbc:postgresql://" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "url") + ":" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "port") + "/" + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "dbname"),
|
||||||
ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "user"), ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "pw"));
|
ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "user"), ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "db", "pw"));
|
||||||
@ -53,17 +47,38 @@ public class PostgresHelper {
|
|||||||
* @return True bei erfolg, sonst false
|
* @return True bei erfolg, sonst false
|
||||||
*/
|
*/
|
||||||
public static boolean executeUpdate(String sql){
|
public static boolean executeUpdate(String sql){
|
||||||
Connection c = con();
|
|
||||||
Statement stmt;
|
|
||||||
try {
|
try {
|
||||||
stmt = c.createStatement();
|
exUpdate(sql);
|
||||||
stmt.executeUpdate(sql);
|
} catch (SQLException e) {
|
||||||
stmt.close();
|
|
||||||
c.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
LogHelper.error(e.getMessage(), e.getClass().getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Führt ein Sql statement ohne rückgabe aus
|
||||||
|
* @param sql Sql command
|
||||||
|
* @return True bei erfolg, sonst false
|
||||||
|
* @throws SQLException Fehler beim ausführen
|
||||||
|
*/
|
||||||
|
private static boolean exUpdate(String sql) throws SQLException {
|
||||||
|
Connection c = con();
|
||||||
|
Statement stmt;
|
||||||
|
stmt = c.createStatement();
|
||||||
|
stmt.executeUpdate(sql);
|
||||||
|
stmt.close();
|
||||||
|
c.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean executeUpdateNoLog(String sql){
|
||||||
|
try {
|
||||||
|
exUpdate(sql);
|
||||||
|
return true;
|
||||||
|
}catch (Exception e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package tourplaner.object;
|
package tourplaner.object;
|
||||||
|
|
||||||
import jdk.jshell.spi.ExecutionControl;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class Log {
|
public class Log {
|
||||||
private String id, bemerkung, rating;
|
private String id, bemerkung, rating;
|
||||||
@ -26,22 +23,18 @@ public class Log {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setId(String id){
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRating() {
|
public String getRating() {
|
||||||
return rating;
|
return rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRating(String rating) {
|
|
||||||
this.rating = rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBemerkung() {
|
public String getBemerkung() {
|
||||||
return bemerkung;
|
return bemerkung;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBemerkung(String bemerkung) {
|
|
||||||
this.bemerkung = bemerkung;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getAvgspeed() {
|
public double getAvgspeed() {
|
||||||
return avgspeed;
|
return avgspeed;
|
||||||
}
|
}
|
||||||
@ -54,55 +47,28 @@ public class Log {
|
|||||||
return hightmeter;
|
return hightmeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHightmeter(double hightmeter) {
|
|
||||||
this.hightmeter = hightmeter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPause() {
|
public double getPause() {
|
||||||
return pause;
|
return pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPause(double pause) {
|
|
||||||
this.pause = pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getGegangen() {
|
public double getGegangen() {
|
||||||
return gegangen;
|
return gegangen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGegangen(double gegangen) {
|
|
||||||
this.gegangen = gegangen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDauer() {
|
public double getDauer() {
|
||||||
return dauer;
|
return dauer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDauer(double dauer) {
|
|
||||||
this.dauer = dauer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getDatum() {
|
public LocalDate getDatum() {
|
||||||
return datum;
|
return datum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDatum(LocalDate datum) {
|
|
||||||
this.datum = datum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getStrecke() {
|
public double getStrecke() {
|
||||||
return strecke;
|
return strecke;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStrecke(double strecke) {
|
|
||||||
this.strecke = strecke;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,11 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
* Model einer Tour
|
* Model einer Tour
|
||||||
*/
|
*/
|
||||||
public class Tour {
|
public class Tour {
|
||||||
private String dauer, mapJson, name, start, ziel, rating;
|
private String dauer;
|
||||||
|
private String mapJson;
|
||||||
|
private String name;
|
||||||
|
private String start;
|
||||||
|
private String ziel;
|
||||||
private double strecke;
|
private double strecke;
|
||||||
private ArrayList<Log> log;
|
private ArrayList<Log> log;
|
||||||
|
|
||||||
@ -31,16 +35,6 @@ public class Tour {
|
|||||||
this.log = logs;
|
this.log = logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTour(Tour tour){
|
|
||||||
this.dauer = tour.getDauer();
|
|
||||||
this.mapJson = tour.getMapJson();
|
|
||||||
this.strecke = tour.getStrecke();
|
|
||||||
this.name = tour.getName();
|
|
||||||
this.start = tour.getStart();
|
|
||||||
this.ziel = tour.getZiel();
|
|
||||||
this.log = tour.getLogs();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLog(ArrayList<Log> log) {
|
public void setLog(ArrayList<Log> log) {
|
||||||
this.log = log;
|
this.log = log;
|
||||||
}
|
}
|
||||||
@ -96,10 +90,6 @@ public class Tour {
|
|||||||
return mapJson;
|
return mapJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMapJson(String mapJson) {
|
|
||||||
this.mapJson = mapJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getStrecke() {
|
public double getStrecke() {
|
||||||
return strecke;
|
return strecke;
|
||||||
}
|
}
|
||||||
@ -112,23 +102,12 @@ public class Tour {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStart() {
|
public String getStart() {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStart(String start) {
|
|
||||||
this.start = start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getZiel() {
|
public String getZiel() {
|
||||||
return ziel;
|
return ziel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZiel(String ziel) {
|
|
||||||
this.ziel = ziel;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,6 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
|
|
||||||
class EinheitenAdderTest {
|
class EinheitenAdderTest {
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void setUp() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void addMeter() {
|
void addMeter() {
|
||||||
assertEquals(EinheitenAdder.addMeter("1"), "1"+ " " + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "einheiten", "meter"));
|
assertEquals(EinheitenAdder.addMeter("1"), "1"+ " " + ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "einheiten", "meter"));
|
||||||
|
@ -19,9 +19,9 @@ class TourTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
this.tour = new Tour("String name", "String dauer", "String mapJson", 2, "String start", "String ziel");
|
this.tour = new Tour("String name", "String dauer", "String mapJson", 2, "String start", "String ziel");
|
||||||
this.log1 = new Log("1", 2, this.date, 3, "4", 5, 6, "7");;
|
this.log1 = new Log("1", 2, this.date, 3, "4", 5, 6, "7");
|
||||||
this.log2 = new Log("2", 2, this.date, 3, "4", 5, 6, "7");;
|
this.log2 = new Log("2", 2, this.date, 3, "4", 5, 6, "7");
|
||||||
this.log3 = new Log("3", 2, this.date, 3, "4", 5, 6, "7");;
|
this.log3 = new Log("3", 2, this.date, 3, "4", 5, 6, "7");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -40,191 +40,173 @@
|
|||||||
<?import javafx.scene.text.*?>
|
<?import javafx.scene.text.*?>
|
||||||
|
|
||||||
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tourplaner.ui.TourplanerController">
|
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tourplaner.ui.TourplanerController">
|
||||||
<children>
|
|
||||||
<MenuBar VBox.vgrow="NEVER">
|
<MenuBar VBox.vgrow="NEVER">
|
||||||
<menus>
|
|
||||||
<Menu fx:id="menueFile" mnemonicParsing="false" text="Datei">
|
<Menu fx:id="menueFile" mnemonicParsing="false" text="Datei">
|
||||||
<items>
|
<MenuItem fx:id="reportsummary" mnemonicParsing="false" onAction="#reportSum" text="Report Summary" />
|
||||||
<MenuItem fx:id="reportsummary" mnemonicParsing="false" onAction="#reportSum" text="Report Summary" />
|
<MenuItem fx:id="tourreport" mnemonicParsing="false" onAction="#tourReport" text="Tour Report" />
|
||||||
<MenuItem fx:id="tourreport" mnemonicParsing="false" onAction="#tourReport" text="Tour Report" />
|
|
||||||
<MenuItem fx:id="beendenButton" mnemonicParsing="false" onAction="#quitApp" text="Beenden" />
|
<MenuItem fx:id="beendenButton" mnemonicParsing="false" onAction="#quitApp" text="Beenden" />
|
||||||
</items>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu fx:id="menuebearbeiten" mnemonicParsing="false" text="Bearbeiten">
|
<Menu fx:id="menuebearbeiten" mnemonicParsing="false" text="Bearbeiten">
|
||||||
<items>
|
<MenuItem fx:id="menueimport" mnemonicParsing="false" onAction="#importBtn" text="Import" />
|
||||||
<MenuItem fx:id="menueimport" mnemonicParsing="false" onAction="#importBtn" text="Import" />
|
<MenuItem fx:id="menueexport" mnemonicParsing="false" onAction="#exportBtn" text="Export" />
|
||||||
<MenuItem fx:id="menueexport" mnemonicParsing="false" onAction="#exportBtn" text="Export" />
|
|
||||||
</items>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu fx:id="menueoptionen" mnemonicParsing="false" text="Optionen">
|
<Menu fx:id="menueoptionen" mnemonicParsing="false" text="Optionen">
|
||||||
<items>
|
<CheckMenuItem fx:id="openmap" mnemonicParsing="false" onAction="#openmapaction" text="Map automatisch öffnen" />
|
||||||
<CheckMenuItem fx:id="openmap" mnemonicParsing="false" onAction="#openmapaction" text="Map automatisch öffnen" />
|
<CheckMenuItem fx:id="openpdf" mnemonicParsing="false" onAction="#openpdfaction" text="Report automatisch öffnen" />
|
||||||
<CheckMenuItem fx:id="openpdf" mnemonicParsing="false" onAction="#openpdfaction" text="Report automatisch öffnen" />
|
<Menu fx:id="menuesprachen" mnemonicParsing="false" text="Sprache">
|
||||||
<Menu fx:id="menuesprachen" mnemonicParsing="false" text="Sprache">
|
<RadioMenuItem fx:id="langdeutsch" mnemonicParsing="false" onAction="#onlangdeutsch" text="Deutsch" />
|
||||||
<items>
|
<RadioMenuItem fx:id="langenglisch" mnemonicParsing="false" onAction="#onlangenglisch" text="Englisch" />
|
||||||
<RadioMenuItem fx:id="langdeutsch" mnemonicParsing="false" onAction="#onlangdeutsch" text="Deutsch" />
|
|
||||||
<RadioMenuItem fx:id="langenglisch" mnemonicParsing="false" onAction="#onlangenglisch" text="Englisch" />
|
|
||||||
</items>
|
|
||||||
</Menu>
|
|
||||||
</items>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu fx:id="menuehilfe" mnemonicParsing="false" text="Hilfe">
|
|
||||||
<items>
|
|
||||||
<MenuItem mnemonicParsing="false" onAction="#gitWebBrowser" text="Git Repo" />
|
|
||||||
<MenuItem mnemonicParsing="false" onAction="#javaDocBrowser" text="JavaDoc" />
|
|
||||||
<MenuItem mnemonicParsing="false" onAction="#doxygenDocBrowser" text="Doxygen Doc" />
|
|
||||||
</items>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</menus>
|
<Menu fx:id="menuehilfe" mnemonicParsing="false" text="Hilfe">
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#gitWebBrowser" text="Git Repo" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#javaDocBrowser" text="JavaDoc" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#doxygenDocBrowser" text="Doxygen Doc" />
|
||||||
|
</Menu>
|
||||||
</MenuBar>
|
</MenuBar>
|
||||||
<HBox id="HBox" alignment="CENTER_LEFT" layoutX="10.0" layoutY="588.0" spacing="5.0">
|
<HBox id="HBox" alignment="CENTER_LEFT" layoutX="10.0" layoutY="588.0" spacing="5.0">
|
||||||
<children>
|
<padding>
|
||||||
<AnchorPane prefWidth="-1.0" HBox.hgrow="ALWAYS">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="tourAdd" layoutX="58.0" mnemonicParsing="false" onAction="#addTour" text="+" />
|
|
||||||
<Label layoutX="14.0" layoutY="4.0" text="Tours" />
|
|
||||||
<Button fx:id="tourDel" layoutX="89.0" mnemonicParsing="false" onAction="#delTour" text="-" />
|
|
||||||
<Button fx:id="editTourBtn" layoutX="117.0" mnemonicParsing="false" onAction="#editTourBtn" text="Edit" />
|
|
||||||
</children></AnchorPane>
|
|
||||||
<TextField fx:id="sucheInput" promptText="Suche..." />
|
|
||||||
<Button fx:id="sucheButton" mnemonicParsing="false" onAction="#suche" text="Suchen" />
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||||
</padding>
|
</padding>
|
||||||
|
<HBox>
|
||||||
|
<children>
|
||||||
|
<Label text="Tours:">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="6.0" top="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Label>
|
||||||
|
<Button fx:id="tourAdd" mnemonicParsing="false" onAction="#addTour" text="+">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button fx:id="tourDel" mnemonicParsing="false" onAction="#delTour" text="-">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button fx:id="editTourBtn" mnemonicParsing="false" onAction="#editTourBtn" text="Edit">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button fx:id="copyTourBtn" mnemonicParsing="false" onAction="#copyTour" text="Copy">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
<AnchorPane HBox.hgrow="ALWAYS" />
|
||||||
|
<TextField fx:id="sucheInput" onKeyPressed="#sucheEnter" promptText="Suche..." />
|
||||||
|
<Button fx:id="sucheButton" mnemonicParsing="false" onAction="#suche" text="Suchen" />
|
||||||
|
</HBox>
|
||||||
<SplitPane dividerPositions="0.060133630289532294" focusTraversable="true" prefHeight="522.0" prefWidth="300.0" VBox.vgrow="ALWAYS">
|
<SplitPane dividerPositions="0.060133630289532294" focusTraversable="true" prefHeight="522.0" prefWidth="300.0" VBox.vgrow="ALWAYS">
|
||||||
<items>
|
<AnchorPane prefWidth="239.0">
|
||||||
<AnchorPane prefWidth="239.0">
|
<ListView fx:id="TourListView" layoutX="-1.0" onMouseClicked="#tourListSelectedItem" prefHeight="520.0" prefWidth="190.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
<children>
|
</AnchorPane>
|
||||||
<ListView fx:id="TourListView" layoutX="-1.0" onMouseClicked="#tourListSelectedItem" prefHeight="520.0" prefWidth="190.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="496.0" prefWidth="620.0">
|
||||||
</children>
|
<VBox prefWidth="100.0">
|
||||||
|
<AnchorPane prefWidth="676.0">
|
||||||
|
<HBox id="HBox" alignment="CENTER_LEFT" prefHeight="7.0" prefWidth="44.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<Label text="Title:">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets left="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Label>
|
||||||
|
<TextField fx:id="titleTextView" editable="false" />
|
||||||
|
</HBox>
|
||||||
|
</AnchorPane>
|
||||||
|
<AnchorPane prefWidth="200.0">
|
||||||
|
<TabPane fx:id="viewTabPane" layoutX="1.0" layoutY="69.0" prefWidth="702.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="-67.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<Tab fx:id="kartenTab" text="Karte">
|
||||||
|
<AnchorPane>
|
||||||
|
<ImageView fx:id="mapImageView" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
|
</AnchorPane>
|
||||||
|
</Tab>
|
||||||
|
<Tab fx:id="beschreibungTab" text="Beschreibung">
|
||||||
|
<AnchorPane>
|
||||||
|
<TableView fx:id="beschreibungTableView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columns>
|
||||||
|
<TableColumn fx:id="nameCol" minWidth="100.0" prefWidth="-1.0" text="Tourname" />
|
||||||
|
<TableColumn fx:id="dauerCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Dauer" />
|
||||||
|
<TableColumn fx:id="streckeCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Strecke" />
|
||||||
|
<TableColumn fx:id="startCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Startpunk" />
|
||||||
|
<TableColumn fx:id="zielCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Zielpunkt" />
|
||||||
|
</columns>
|
||||||
|
</TableView>
|
||||||
|
</AnchorPane>
|
||||||
|
</Tab>
|
||||||
|
</TabPane>
|
||||||
|
</AnchorPane>
|
||||||
|
</VBox>
|
||||||
|
<AnchorPane prefWidth="200.0">
|
||||||
|
<VBox prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<AnchorPane>
|
||||||
|
<HBox id="HBox" alignment="CENTER_LEFT" layoutY="2.0" prefWidth="702.0" spacing="5.0" AnchorPane.bottomAnchor="-2.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="2.0">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||||
|
</padding>
|
||||||
|
<Label text="Logs:">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="6.0" top="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Label>
|
||||||
|
<Button mnemonicParsing="false" onAction="#addLog" text="+" textAlignment="CENTER">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button fx:id="logDel" mnemonicParsing="false" onAction="#delLog" text="-" textAlignment="CENTER">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button fx:id="editBtn" mnemonicParsing="false" onAction="#editLogBtn" text="Edit">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin></Button>
|
||||||
|
<Button fx:id="copyBtn" layoutX="112.0" layoutY="13.0" mnemonicParsing="false" onAction="#copyLogBtn" text="Copy">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="6.0" right="6.0" top="6.0" />
|
||||||
|
</HBox.margin></Button>
|
||||||
|
</HBox>
|
||||||
|
</AnchorPane>
|
||||||
|
<AnchorPane>
|
||||||
|
<TableView fx:id="logTableView" onMouseClicked="#logItemSelected" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columns>
|
||||||
|
<TableColumn fx:id="logDatumCol" minWidth="-1.0" prefWidth="-1.0" text="Datum" />
|
||||||
|
<TableColumn fx:id="logDauerCol" minWidth="-1.0" prefWidth="-1.0" text="Dauer" />
|
||||||
|
<TableColumn fx:id="logStreckeCol" minWidth="-1.0" prefWidth="-1.0" text="Entfernung" />
|
||||||
|
<TableColumn fx:id="logAvgCol" minWidth="-1.0" prefWidth="-1.0" text="AVG Geschwindigkeit" />
|
||||||
|
<TableColumn fx:id="logHightCol" minWidth="-1.0" prefWidth="75.0" text="Höhenmeter" />
|
||||||
|
<TableColumn fx:id="logPauseCol" minWidth="-1.0" prefWidth="-1.0" text="Davon Pause" />
|
||||||
|
<TableColumn fx:id="logGegangenCol" minWidth="-1.0" prefWidth="-1.0" text="Davon Unterwegs" />
|
||||||
|
<TableColumn fx:id="logBemerkungCol" minWidth="-1.0" prefWidth="-1.0" text="Bemerkung" />
|
||||||
|
<TableColumn fx:id="logRatingCol1" minWidth="-1.0" prefWidth="-1.0" text="Rating" />
|
||||||
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||||
|
</columnResizePolicy>
|
||||||
|
</TableView>
|
||||||
|
</AnchorPane>
|
||||||
|
</VBox>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="496.0" prefWidth="620.0">
|
</SplitPane>
|
||||||
<items>
|
|
||||||
<VBox prefWidth="100.0">
|
|
||||||
<children>
|
|
||||||
<AnchorPane prefWidth="676.0">
|
|
||||||
<children>
|
|
||||||
<HBox id="HBox" alignment="CENTER_LEFT" prefHeight="7.0" prefWidth="44.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<children>
|
|
||||||
<Label text="Title:">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Label>
|
|
||||||
<TextField fx:id="titleTextView" editable="false" />
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
<AnchorPane prefWidth="200.0">
|
|
||||||
<children>
|
|
||||||
<TabPane fx:id="viewTabPane" layoutX="1.0" layoutY="69.0" prefWidth="702.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="-67.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<tabs>
|
|
||||||
<Tab fx:id="kartenTab" text="Karte">
|
|
||||||
<AnchorPane>
|
|
||||||
<ImageView fx:id="mapImageView" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
|
||||||
</AnchorPane>
|
|
||||||
</Tab>
|
|
||||||
<Tab fx:id="beschreibungTab" text="Beschreibung">
|
|
||||||
<content>
|
|
||||||
<AnchorPane>
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="beschreibungTableView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="nameCol" minWidth="100.0" prefWidth="-1.0" text="Tourname" />
|
|
||||||
<TableColumn fx:id="dauerCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Dauer" />
|
|
||||||
<TableColumn fx:id="streckeCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Strecke" />
|
|
||||||
<TableColumn fx:id="startCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Startpunk" />
|
|
||||||
<TableColumn fx:id="zielCol" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="-1.0" text="Zielpunkt" />
|
|
||||||
</columns>
|
|
||||||
</TableView>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</content>
|
|
||||||
</Tab>
|
|
||||||
</tabs>
|
|
||||||
</TabPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
<AnchorPane prefWidth="200.0">
|
|
||||||
<children>
|
|
||||||
<VBox prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<children>
|
|
||||||
<AnchorPane>
|
|
||||||
<children>
|
|
||||||
<HBox id="HBox" alignment="CENTER_LEFT" layoutY="2.0" prefWidth="702.0" spacing="5.0" AnchorPane.bottomAnchor="-2.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="2.0">
|
|
||||||
<children>
|
|
||||||
<Label text="Logs:">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets left="10.0" />
|
|
||||||
</HBox.margin>
|
|
||||||
</Label>
|
|
||||||
<Button mnemonicParsing="false" onAction="#addLog" text="+" textAlignment="CENTER">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
<Button fx:id="logDel" mnemonicParsing="false" onAction="#delLog" prefWidth="21.0" text="-" textAlignment="CENTER">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</HBox.margin>
|
|
||||||
</Button>
|
|
||||||
<Button fx:id="editBtn" mnemonicParsing="false" onAction="#editLogBtn" text="Edit" />
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
|
||||||
</padding>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
<AnchorPane>
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="logTableView" onMouseClicked="#logItemSelected" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="logDatumCol" minWidth="-1.0" prefWidth="-1.0" text="Datum" />
|
|
||||||
<TableColumn fx:id="logDauerCol" minWidth="-1.0" prefWidth="-1.0" text="Dauer" />
|
|
||||||
<TableColumn fx:id="logStreckeCol" minWidth="-1.0" prefWidth="-1.0" text="Entfernung" />
|
|
||||||
<TableColumn fx:id="logAvgCol" minWidth="-1.0" prefWidth="-1.0" text="AVG Geschwindigkeit" />
|
|
||||||
<TableColumn fx:id="logHightCol" minWidth="-1.0" prefWidth="75.0" text="Höhenmeter" />
|
|
||||||
<TableColumn fx:id="logPauseCol" minWidth="-1.0" prefWidth="-1.0" text="Davon Pause" />
|
|
||||||
<TableColumn fx:id="logGegangenCol" minWidth="-1.0" prefWidth="-1.0" text="Davon Unterwegs" />
|
|
||||||
<TableColumn fx:id="logBemerkungCol" minWidth="-1.0" prefWidth="-1.0" text="Bemerkung" />
|
|
||||||
<TableColumn fx:id="logRatingCol1" minWidth="-1.0" prefWidth="-1.0" text="Rating" />
|
|
||||||
</columns>
|
|
||||||
<columnResizePolicy>
|
|
||||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
|
||||||
</columnResizePolicy>
|
|
||||||
</TableView>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
</items>
|
|
||||||
</SplitPane>
|
|
||||||
</items>
|
|
||||||
</SplitPane>
|
</SplitPane>
|
||||||
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
|
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
|
||||||
<children>
|
<padding>
|
||||||
<Label maxHeight="1.7976931348623157E308" maxWidth="-1.0" text="Tourplaner" HBox.hgrow="ALWAYS">
|
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||||
<font>
|
</padding>
|
||||||
<Font size="11.0" fx:id="x3" />
|
<Label maxHeight="1.7976931348623157E308" text="Tourplaner" HBox.hgrow="ALWAYS">
|
||||||
</font>
|
<font>
|
||||||
<textFill>
|
<Font size="11.0" fx:id="x3" />
|
||||||
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4" />
|
</font>
|
||||||
</textFill>
|
<textFill>
|
||||||
|
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4" />
|
||||||
|
</textFill>
|
||||||
</Label>
|
</Label>
|
||||||
<AnchorPane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS" />
|
<AnchorPane HBox.hgrow="ALWAYS" />
|
||||||
<Label font="$x3" maxWidth="-1.0" text="Georg Reisinger" textFill="$x4" HBox.hgrow="NEVER" />
|
<Label font="$x3" text="Georg Reisinger" textFill="$x4" HBox.hgrow="NEVER" />
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
|
||||||
</padding>
|
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package tourplaner.ui;
|
package tourplaner.ui;
|
||||||
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@ -8,15 +7,9 @@ import javafx.scene.control.TextArea;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
import tourplaner.business.EinheitenAdder;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.TitledBorder;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@ -45,15 +38,6 @@ public class AlertHelper {
|
|||||||
alertType(Alert.AlertType.INFORMATION, title, header, msg);
|
alertType(Alert.AlertType.INFORMATION, title, header, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Info Dialog ohne Header
|
|
||||||
* @param title Title des Dialogs
|
|
||||||
* @param msg Nachricht des Dialogs
|
|
||||||
*/
|
|
||||||
public static void informNoHeader(String title, String msg){
|
|
||||||
inform(title, null, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error Dialog
|
* Error Dialog
|
||||||
* @param title Title des Dialogs
|
* @param title Title des Dialogs
|
||||||
@ -190,7 +174,7 @@ public class AlertHelper {
|
|||||||
double returnDouble = -2.0;
|
double returnDouble = -2.0;
|
||||||
while (returnDouble < -1.0) {
|
while (returnDouble < -1.0) {
|
||||||
Optional<String> result = inputHelper(title, header, msg, content);
|
Optional<String> result = inputHelper(title, header, msg, content);
|
||||||
AtomicReference<Double> returnText = new AtomicReference<Double>(-1.0);
|
AtomicReference<Double> returnText = new AtomicReference<>(-1.0);
|
||||||
result.ifPresent(s -> {
|
result.ifPresent(s -> {
|
||||||
try {
|
try {
|
||||||
double resultDouble = Double.parseDouble(result.get());
|
double resultDouble = Double.parseDouble(result.get());
|
||||||
@ -221,13 +205,10 @@ public class AlertHelper {
|
|||||||
stage.getIcons().add(
|
stage.getIcons().add(
|
||||||
new Image("file:"+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "start", "logo")));
|
new Image("file:"+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "start", "logo")));
|
||||||
AtomicReference<LocalDate> selectedDate = new AtomicReference<>();
|
AtomicReference<LocalDate> selectedDate = new AtomicReference<>();
|
||||||
stage.setOnCloseRequest(ev -> {
|
stage.setOnCloseRequest(ev -> stage.close());
|
||||||
stage.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
datePicker.setOnAction(event -> {
|
datePicker.setOnAction(event -> {
|
||||||
LocalDate date = datePicker.getValue();
|
LocalDate date = datePicker.getValue();
|
||||||
System.out.println("Selected date: " + date);
|
|
||||||
selectedDate.set(date);
|
selectedDate.set(date);
|
||||||
stage.close();
|
stage.close();
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package tourplaner.ui;
|
package tourplaner.ui;
|
||||||
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@ -29,6 +28,7 @@ public class ProgressBar {
|
|||||||
Container content = this.frame.getContentPane();
|
Container content = this.frame.getContentPane();
|
||||||
this.progressBar = new JProgressBar();
|
this.progressBar = new JProgressBar();
|
||||||
this.progressBar.setValue(0);
|
this.progressBar.setValue(0);
|
||||||
|
this.progressBar.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
this.progressBar.setStringPainted(true);
|
this.progressBar.setStringPainted(true);
|
||||||
TitledBorder border = BorderFactory.createTitledBorder("Laden....");
|
TitledBorder border = BorderFactory.createTitledBorder("Laden....");
|
||||||
this.progressBar.setBorder(border);
|
this.progressBar.setBorder(border);
|
||||||
|
@ -4,11 +4,10 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.geometry.Orientation;
|
import javafx.geometry.Orientation;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.input.KeyCode;
|
||||||
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import tourplaner.business.ConfigHelper;
|
import tourplaner.business.ConfigHelper;
|
||||||
import tourplaner.business.LogHelper;
|
import tourplaner.business.LogHelper;
|
||||||
@ -19,6 +18,7 @@ import tourplaner.viewmodels.ViewModel;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class TourplanerController implements Initializable {
|
public class TourplanerController implements Initializable {
|
||||||
//VM
|
//VM
|
||||||
@ -38,11 +38,24 @@ public class TourplanerController implements Initializable {
|
|||||||
//Menue
|
//Menue
|
||||||
public CheckMenuItem openmap, openpdf;
|
public CheckMenuItem openmap, openpdf;
|
||||||
public RadioMenuItem langenglisch, langdeutsch;
|
public RadioMenuItem langenglisch, langdeutsch;
|
||||||
private ToggleGroup langgroup;
|
|
||||||
public Menu menueFile, menuebearbeiten, menueoptionen, menuesprachen, menuehilfe;
|
public Menu menueFile, menuebearbeiten, menueoptionen, menuesprachen, menuehilfe;
|
||||||
public MenuItem reportsummary, tourreport, beendenButton;
|
public MenuItem reportsummary, tourreport, beendenButton;
|
||||||
//Elemente
|
//Elemente
|
||||||
public Button sucheButton, editBtn, editTourBtn;
|
public Button sucheButton, editBtn, editTourBtn, copyTourBtn, copyBtn;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void copyTour(){
|
||||||
|
ProgressBar progressBar = new ProgressBar("Copy");
|
||||||
|
this.viewModel.copyTour(progressBar, 80);
|
||||||
|
syncTourNamen(progressBar, 90);
|
||||||
|
tourFocusOnSelected(progressBar, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void copyLogBtn(){
|
||||||
|
this.viewModel.copyLog();
|
||||||
|
syncLogs();
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onlangenglisch(){
|
private void onlangenglisch(){
|
||||||
@ -110,9 +123,9 @@ public class TourplanerController implements Initializable {
|
|||||||
mapImageView.setImage(this.viewModel.getImage(selectedItem));
|
mapImageView.setImage(this.viewModel.getImage(selectedItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncTourNamen(){
|
private void syncTourNamen(ProgressBar progressBar, int maxLevel){
|
||||||
TourListView.getItems().clear();
|
TourListView.getItems().clear();
|
||||||
TourListView.setItems(this.viewModel.getTourNamen());
|
TourListView.setItems(this.viewModel.getTourNamen(progressBar, maxLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncLogs(){
|
private void syncLogs(){
|
||||||
@ -127,46 +140,63 @@ public class TourplanerController implements Initializable {
|
|||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void tourListSelectedItem(MouseEvent mouseEvent){
|
private void tourListSelectedItem(MouseEvent mouseEvent){
|
||||||
|
//Beschreibung
|
||||||
ProgressBar progressBar = new ProgressBar("Tour auswählen...");
|
ProgressBar progressBar = new ProgressBar("Tour auswählen...");
|
||||||
|
int steps = progressBar.getProgressSize(7, 100);
|
||||||
String selectedItem = TourListView.getSelectionModel().getSelectedItem();
|
String selectedItem = TourListView.getSelectionModel().getSelectedItem();
|
||||||
this.viewModel.selectTour(selectedItem);
|
this.viewModel.selectTour(selectedItem);
|
||||||
titleTextView.setText(selectedItem);
|
titleTextView.setText(selectedItem);
|
||||||
progressBar.addProgress(10);
|
progressBar.addProgress(steps);
|
||||||
syncTour(selectedItem);
|
syncTour(selectedItem);
|
||||||
progressBar.addProgress(10);
|
progressBar.addProgress(steps);
|
||||||
startCol.setCellValueFactory(new PropertyValueFactory<Tour, String>("start"));
|
startCol.setCellValueFactory(new PropertyValueFactory<>("start"));
|
||||||
zielCol.setCellValueFactory(new PropertyValueFactory<Tour, String>("ziel"));
|
zielCol.setCellValueFactory(new PropertyValueFactory<>("ziel"));
|
||||||
dauerCol.setCellValueFactory(new PropertyValueFactory<Tour, String>("dauer"));
|
dauerCol.setCellValueFactory(new PropertyValueFactory<>("dauer"));
|
||||||
streckeCol.setCellValueFactory(new PropertyValueFactory<Tour, String>("strecke"));
|
streckeCol.setCellValueFactory(new PropertyValueFactory<>("strecke"));
|
||||||
nameCol.setCellValueFactory(new PropertyValueFactory<Tour, String>("name"));
|
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
|
||||||
|
|
||||||
//Log anzeigen
|
//Log anzeigen
|
||||||
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinelogsvorhanden")));
|
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinelogsvorhanden")));
|
||||||
logTableView.getItems().clear();
|
logTableView.getItems().clear();
|
||||||
progressBar.addProgress(10);
|
progressBar.addProgress(steps);
|
||||||
logTableView.setItems(this.viewModel.getLogData());
|
logTableView.setItems(this.viewModel.getLogData());
|
||||||
progressBar.addProgress(10);
|
progressBar.addProgress(steps);
|
||||||
logDauerCol.setCellValueFactory(new PropertyValueFactory<Log, String>("dauer"));
|
logDauerCol.setCellValueFactory(new PropertyValueFactory<>("dauer"));
|
||||||
logStreckeCol.setCellValueFactory(new PropertyValueFactory<Log, String>("strecke"));
|
logStreckeCol.setCellValueFactory(new PropertyValueFactory<>("strecke"));
|
||||||
logDatumCol.setCellValueFactory(new PropertyValueFactory<Log, String>("datum"));
|
logDatumCol.setCellValueFactory(new PropertyValueFactory<>("datum"));
|
||||||
logAvgCol.setCellValueFactory(new PropertyValueFactory<Log, String>("avgspeed"));
|
logAvgCol.setCellValueFactory(new PropertyValueFactory<>("avgspeed"));
|
||||||
logHightCol.setCellValueFactory(new PropertyValueFactory<Log, String>("hightmeter"));
|
logHightCol.setCellValueFactory(new PropertyValueFactory<>("hightmeter"));
|
||||||
logPauseCol.setCellValueFactory(new PropertyValueFactory<Log, String>("pause"));
|
logPauseCol.setCellValueFactory(new PropertyValueFactory<>("pause"));
|
||||||
logGegangenCol.setCellValueFactory(new PropertyValueFactory<Log, String>("gegangen"));
|
logGegangenCol.setCellValueFactory(new PropertyValueFactory<>("gegangen"));
|
||||||
logBemerkungCol.setCellValueFactory(new PropertyValueFactory<Log, String>("bemerkung"));
|
logBemerkungCol.setCellValueFactory(new PropertyValueFactory<>("bemerkung"));
|
||||||
logRatingCol1.setCellValueFactory(new PropertyValueFactory<Log, String>("rating"));
|
logRatingCol1.setCellValueFactory(new PropertyValueFactory<>("rating"));
|
||||||
progressBar.addProgress(10);
|
progressBar.addProgress(steps);
|
||||||
mapImageView.setImage(this.viewModel.getImage(this.viewModel.getSelectedTour().getName()));
|
mapImageView.setImage(this.viewModel.getImage(this.viewModel.getSelectedTour().getName()));
|
||||||
if(this.viewModel.isSucheAktiv()){
|
if(this.viewModel.isSucheAktiv()){
|
||||||
this.viewModel.setSucheAktiv(false);
|
this.viewModel.setSucheAktiv(false);
|
||||||
progressBar.addProgress(10);
|
syncTourNamen(progressBar, 100 - steps);
|
||||||
syncTourNamen();
|
|
||||||
progressBar.setProgress(100);
|
|
||||||
this.sucheInput.setText("");
|
this.sucheInput.setText("");
|
||||||
|
tourFocusOnSelected(progressBar, 100);
|
||||||
}
|
}
|
||||||
progressBar.setProgress(100);
|
progressBar.setProgress(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Focus auf die ausgewählte Tour
|
||||||
|
*/
|
||||||
|
private void tourFocusOnSelected(ProgressBar progressBar, int maxLevel){
|
||||||
|
//Tour namen select focus
|
||||||
|
AtomicInteger index = new AtomicInteger();
|
||||||
|
AtomicInteger indexF = new AtomicInteger();
|
||||||
|
this.viewModel.getTourNamen(progressBar, maxLevel).forEach(tn -> {
|
||||||
|
index.getAndIncrement();
|
||||||
|
if(tn.equals(this.viewModel.getSelectedTour().getName())){
|
||||||
|
indexF.set(index.get());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TourListView.getFocusModel().focus(indexF.intValue() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beendet die App
|
* Beendet die App
|
||||||
* Verbunden mit dem Menu -> Datei -> Beenden
|
* Verbunden mit dem Menu -> Datei -> Beenden
|
||||||
@ -205,11 +235,17 @@ public class TourplanerController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private void suche(){
|
private void suche(){
|
||||||
ProgressBar progressBar = new ProgressBar("Suche");
|
ProgressBar progressBar = new ProgressBar("Suche");
|
||||||
this.viewModel.suche(this.sucheInput.getText());
|
this.viewModel.suche(this.sucheInput.getText(), progressBar, 100);
|
||||||
progressBar.addProgress(100);
|
|
||||||
progressBar.closeProgress();
|
progressBar.closeProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void sucheEnter(KeyEvent event){
|
||||||
|
if(event.getCode().equals(KeyCode.ENTER)) {
|
||||||
|
suche();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fügt einen Log eintrag zu einer Tour hinzu.
|
* Fügt einen Log eintrag zu einer Tour hinzu.
|
||||||
* Ist keine Tour ausgewählt, dann kommt eine Warnung an den User!
|
* Ist keine Tour ausgewählt, dann kommt eine Warnung an den User!
|
||||||
@ -245,7 +281,7 @@ public class TourplanerController implements Initializable {
|
|||||||
//Tour list -> links
|
//Tour list -> links
|
||||||
TourListView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
TourListView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
||||||
TourListView.setOrientation(Orientation.VERTICAL);
|
TourListView.setOrientation(Orientation.VERTICAL);
|
||||||
syncTourNamen();
|
syncTourNamen(new ProgressBar("Start"), 100);
|
||||||
deselectAll();
|
deselectAll();
|
||||||
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1){
|
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1){
|
||||||
this.openpdf.setSelected(true);
|
this.openpdf.setSelected(true);
|
||||||
@ -257,9 +293,9 @@ public class TourplanerController implements Initializable {
|
|||||||
}else {
|
}else {
|
||||||
this.openmap.setSelected(false);
|
this.openmap.setSelected(false);
|
||||||
}
|
}
|
||||||
this.langgroup = new ToggleGroup();
|
ToggleGroup langgroup = new ToggleGroup();
|
||||||
this.langdeutsch.setToggleGroup(this.langgroup);
|
this.langdeutsch.setToggleGroup(langgroup);
|
||||||
this.langenglisch.setToggleGroup(this.langgroup);
|
this.langenglisch.setToggleGroup(langgroup);
|
||||||
if(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "lang", "lang").equals("langde")){
|
if(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "lang", "lang").equals("langde")){
|
||||||
this.langdeutsch.setSelected(true);
|
this.langdeutsch.setSelected(true);
|
||||||
this.langenglisch.setSelected(false);
|
this.langenglisch.setSelected(false);
|
||||||
@ -271,6 +307,9 @@ public class TourplanerController implements Initializable {
|
|||||||
langToFxml();
|
langToFxml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt jedem Element den Text der gewählten Sprache
|
||||||
|
*/
|
||||||
private void langToFxml(){
|
private void langToFxml(){
|
||||||
this.kartenTab.setText(ConfigHelper.getLangIniString("fkarte"));
|
this.kartenTab.setText(ConfigHelper.getLangIniString("fkarte"));
|
||||||
this.beschreibungTab.setText(ConfigHelper.getLangIniString("fbeschreibung"));
|
this.beschreibungTab.setText(ConfigHelper.getLangIniString("fbeschreibung"));
|
||||||
@ -289,7 +328,6 @@ public class TourplanerController implements Initializable {
|
|||||||
this.logHightCol.setText(ConfigHelper.getLangIniString("fhight"));
|
this.logHightCol.setText(ConfigHelper.getLangIniString("fhight"));
|
||||||
this.logPauseCol.setText(ConfigHelper.getLangIniString("fpause"));
|
this.logPauseCol.setText(ConfigHelper.getLangIniString("fpause"));
|
||||||
this.logStreckeCol.setText(ConfigHelper.getLangIniString("fstrecke"));
|
this.logStreckeCol.setText(ConfigHelper.getLangIniString("fstrecke"));
|
||||||
|
|
||||||
this.sucheButton.setText(ConfigHelper.getLangIniString("fsuche"));
|
this.sucheButton.setText(ConfigHelper.getLangIniString("fsuche"));
|
||||||
this.openmap.setText(ConfigHelper.getLangIniString("fopenmapsetting"));
|
this.openmap.setText(ConfigHelper.getLangIniString("fopenmapsetting"));
|
||||||
this.openpdf.setText(ConfigHelper.getLangIniString("fopenpdfsetting"));
|
this.openpdf.setText(ConfigHelper.getLangIniString("fopenpdfsetting"));
|
||||||
@ -303,9 +341,11 @@ public class TourplanerController implements Initializable {
|
|||||||
this.reportsummary.setText(ConfigHelper.getLangIniString("freposum"));
|
this.reportsummary.setText(ConfigHelper.getLangIniString("freposum"));
|
||||||
this.tourreport.setText(ConfigHelper.getLangIniString("frepotour"));
|
this.tourreport.setText(ConfigHelper.getLangIniString("frepotour"));
|
||||||
this.beendenButton.setText(ConfigHelper.getLangIniString("fbeenden"));
|
this.beendenButton.setText(ConfigHelper.getLangIniString("fbeenden"));
|
||||||
this.sucheInput.setPromptText(ConfigHelper.getLangIniString("fsuche")+ConfigHelper.getLangIniString("fpunkte"));
|
this.sucheInput.setPromptText(ConfigHelper.getLangIniString("fsuche") + ConfigHelper.getLangIniString("fpunkte"));
|
||||||
|
this.logRatingCol1.setText(ConfigHelper.getLangIniString("rating"));
|
||||||
|
|
||||||
this.logRatingCol1.setText("Rating");
|
this.copyBtn.setText(ConfigHelper.getLangIniString("copybtn"));
|
||||||
|
this.copyTourBtn.setText(ConfigHelper.getLangIniString("copybtn"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -337,9 +377,10 @@ public class TourplanerController implements Initializable {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void importBtn(){
|
private void importBtn(){
|
||||||
|
ProgressBar progressBar = new ProgressBar("Import");
|
||||||
deselectAll();
|
deselectAll();
|
||||||
this.viewModel.importData();
|
this.viewModel.importData(progressBar, 90);
|
||||||
syncTourNamen();
|
syncTourNamen(progressBar, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -347,12 +388,4 @@ public class TourplanerController implements Initializable {
|
|||||||
this.viewModel.sumReport();
|
this.viewModel.sumReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Funktion für noch nicht implementierte sachen wie im Menu der 'Bearbeiten' und 'Optionen' Knopf
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
private void nimpButton(){
|
|
||||||
this.viewModel.nimpButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ public class ViewModel {
|
|||||||
this.neueTourName = AlertHelper.inputText(ConfigHelper.getLangIniString("tournametitle"),
|
this.neueTourName = AlertHelper.inputText(ConfigHelper.getLangIniString("tournametitle"),
|
||||||
ConfigHelper.getLangIniString("tournameheader"),
|
ConfigHelper.getLangIniString("tournameheader"),
|
||||||
ConfigHelper.getLangIniString("tournamemsg"), content);
|
ConfigHelper.getLangIniString("tournamemsg"), content);
|
||||||
System.out.println(this.neueTourName);
|
|
||||||
if(this.neueTourName.isEmpty()){
|
if(this.neueTourName.isEmpty()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -197,7 +196,6 @@ public class ViewModel {
|
|||||||
* Bearbeitet einen gewählten Log eintrag
|
* Bearbeitet einen gewählten Log eintrag
|
||||||
*/
|
*/
|
||||||
public void editLog(){
|
public void editLog(){
|
||||||
System.out.println(this.selectedLog);
|
|
||||||
if(this.selectedTour != null) {
|
if(this.selectedTour != null) {
|
||||||
if(this.selectedLog != null) {
|
if(this.selectedLog != null) {
|
||||||
AtomicReference<Tour> tourAkt = new AtomicReference<>();
|
AtomicReference<Tour> tourAkt = new AtomicReference<>();
|
||||||
@ -235,8 +233,6 @@ public class ViewModel {
|
|||||||
Log newLog = new Log(this.selectedLog.getId(), dauer, datum, strecke, this.neueBemerkung, hightmeter, pause, rating + "");
|
Log newLog = new Log(this.selectedLog.getId(), dauer, datum, strecke, this.neueBemerkung, hightmeter, pause, rating + "");
|
||||||
this.logData.removeIf(ld -> ld.getId().equals(this.selectedLog.getId()));
|
this.logData.removeIf(ld -> ld.getId().equals(this.selectedLog.getId()));
|
||||||
this.logData.add(newLog);
|
this.logData.add(newLog);
|
||||||
// tourAkt.get().delLog(this.selectedLog.getId());
|
|
||||||
// tourAkt.get().addLog(newLog);
|
|
||||||
this.tourData.removeIf(td -> td.getName().equals(this.selectedTour.getName()));
|
this.tourData.removeIf(td -> td.getName().equals(this.selectedTour.getName()));
|
||||||
this.tourData.add(tourAkt.get());
|
this.tourData.add(tourAkt.get());
|
||||||
TourPlaner.editLog(this.selectedTour.getName(), newLog);
|
TourPlaner.editLog(this.selectedTour.getName(), newLog);
|
||||||
@ -301,7 +297,7 @@ public class ViewModel {
|
|||||||
ConfigHelper.getLangIniString("bewertungmsg"),
|
ConfigHelper.getLangIniString("bewertungmsg"),
|
||||||
ConfigHelper.getLangIniString("bewertung") +
|
ConfigHelper.getLangIniString("bewertung") +
|
||||||
ConfigHelper.getLangIniString("doppelpunkt"), realcontent);
|
ConfigHelper.getLangIniString("doppelpunkt"), realcontent);
|
||||||
if(input < 0 && input > 5){
|
if(input < 0 || input > 5){
|
||||||
input = -1;
|
input = -1;
|
||||||
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), ConfigHelper.getLangIniString("bewertungeror"), ConfigHelper.getLangIniString("bewertungeror2"));
|
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"), ConfigHelper.getLangIniString("bewertungeror"), ConfigHelper.getLangIniString("bewertungeror2"));
|
||||||
}
|
}
|
||||||
@ -316,7 +312,6 @@ public class ViewModel {
|
|||||||
private LocalDate dateInput(LocalDate date){
|
private LocalDate dateInput(LocalDate date){
|
||||||
LocalDate neuesDatum = null;
|
LocalDate neuesDatum = null;
|
||||||
neuesDatum = AlertHelper.datePicker(date);
|
neuesDatum = AlertHelper.datePicker(date);
|
||||||
System.out.println(neuesDatum);
|
|
||||||
return neuesDatum;
|
return neuesDatum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,12 +356,7 @@ public class ViewModel {
|
|||||||
this.tourData.forEach(s -> {
|
this.tourData.forEach(s -> {
|
||||||
if (s.getName().equals(this.selectedTour.getName())) {
|
if (s.getName().equals(this.selectedTour.getName())) {
|
||||||
AtomicReference<String> newId = new AtomicReference<>();
|
AtomicReference<String> newId = new AtomicReference<>();
|
||||||
newId.set(UUID.randomUUID().toString());
|
newId.set(TourPlaner.newLogId(this.logData));
|
||||||
this.logData.forEach(ss -> {
|
|
||||||
if (ss.getId().equals(newId.get())) {
|
|
||||||
newId.set(UUID.randomUUID().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
double dauer = dauerInput(-1.0);
|
double dauer = dauerInput(-1.0);
|
||||||
double strecke, pause, hightmeter;
|
double strecke, pause, hightmeter;
|
||||||
boolean bemerkung = false;
|
boolean bemerkung = false;
|
||||||
@ -427,14 +417,6 @@ public class ViewModel {
|
|||||||
this.selectedLog = getLog(id);
|
this.selectedLog = getLog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holt das selectierte Log als Log Objekt
|
|
||||||
* @return Das selectierte Log Objekt
|
|
||||||
*/
|
|
||||||
public Log getSelectedLog(){
|
|
||||||
return this.selectedLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt ein Log anhand seiner ID
|
* Holt ein Log anhand seiner ID
|
||||||
* @param id Id des Log Eintrags
|
* @param id Id des Log Eintrags
|
||||||
@ -485,56 +467,21 @@ public class ViewModel {
|
|||||||
this.logData.addAll(this.selectedTour.getLogs());
|
this.logData.addAll(this.selectedTour.getLogs());
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Selectiert eine Tour anhand des Tour Objects.
|
|
||||||
// * Kann z.b. verwerndet werden um das selectierte Tour Object zu bearbeiten
|
|
||||||
// * @param selected
|
|
||||||
// */
|
|
||||||
// public void setSelectedTour(Tour selected){
|
|
||||||
// this.selectedTour = selected;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public Tour getSelectedTour() {
|
public Tour getSelectedTour() {
|
||||||
return selectedTour;
|
return selectedTour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNeueTourZiel() {
|
public ObservableList<String> getTourNamen(ProgressBar progressBar, int maxLevel) {
|
||||||
return neueTourZiel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeueTourZiel(String neueTourZiel) {
|
|
||||||
this.neueTourZiel = neueTourZiel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableList<String> getTourNamen() {
|
|
||||||
ArrayList<String> namen = new ArrayList<>();
|
ArrayList<String> namen = new ArrayList<>();
|
||||||
getTourData().forEach(s -> {
|
getTourData(progressBar, maxLevel).forEach(s -> namen.add(s.getName()));
|
||||||
namen.add(s.getName());
|
|
||||||
});
|
|
||||||
tourNamen.clear();
|
tourNamen.clear();
|
||||||
tourNamen.addAll(namen);
|
tourNamen.addAll(namen);
|
||||||
return tourNamen;
|
return tourNamen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNeueTourName() {
|
public ObservableList<Tour> getTourData(ProgressBar progressBar, int maxLevel) {
|
||||||
return neueTourName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeueTourName(String neueTourName) {
|
|
||||||
this.neueTourName = neueTourName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNeueTourStart() {
|
|
||||||
return neueTourStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeueTourStart(String neueTourStart) {
|
|
||||||
this.neueTourStart = neueTourStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableList<Tour> getTourData() {
|
|
||||||
tourData.clear();
|
tourData.clear();
|
||||||
ArrayList<Tour> touren = TourPlaner.getAllTours();
|
ArrayList<Tour> touren = TourPlaner.getAllTours(progressBar, maxLevel);
|
||||||
if(touren != null) {
|
if(touren != null) {
|
||||||
tourData.addAll(touren);
|
tourData.addAll(touren);
|
||||||
}
|
}
|
||||||
@ -551,8 +498,10 @@ public class ViewModel {
|
|||||||
tourData.removeIf(s -> s.getName().equals(tourname));
|
tourData.removeIf(s -> s.getName().equals(tourname));
|
||||||
tourNamen.removeIf(s -> s.equals(tourname));
|
tourNamen.removeIf(s -> s.equals(tourname));
|
||||||
logData.removeIf(s -> true);
|
logData.removeIf(s -> true);
|
||||||
|
ProgressBar progressBar = new ProgressBar("");
|
||||||
TourPlaner.delTour(tourname);
|
TourPlaner.delTour(tourname);
|
||||||
setSelectedTour(null);
|
setSelectedTour(null);
|
||||||
|
progressBar.setProgress(100);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
@ -567,18 +516,21 @@ public class ViewModel {
|
|||||||
* Sucht eine Tour
|
* Sucht eine Tour
|
||||||
* @param sucheInput Text nach dem gesucht werden soll
|
* @param sucheInput Text nach dem gesucht werden soll
|
||||||
*/
|
*/
|
||||||
public void suche(String sucheInput){
|
public void suche(String sucheInput, ProgressBar progressBar, int maxProgress){
|
||||||
if(sucheInput.isEmpty()){
|
if(sucheInput.isEmpty()){
|
||||||
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"),
|
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"),
|
||||||
ConfigHelper.getLangIniString("suchfeldleer"),
|
ConfigHelper.getLangIniString("suchfeldleer"),
|
||||||
ConfigHelper.getLangIniString("suchtextzuerst"));
|
ConfigHelper.getLangIniString("suchtextzuerst"));
|
||||||
}
|
}
|
||||||
ArrayList<Tour> result = TourPlaner.sucheTour(sucheInput);
|
ArrayList<Tour> result = TourPlaner.sucheTour(sucheInput, progressBar, maxProgress/2);
|
||||||
|
int steps = progressBar.getProgressSize(result.size(), maxProgress);
|
||||||
tourNamen.clear();
|
tourNamen.clear();
|
||||||
for (Tour tour:result) {
|
for (Tour tour:result) {
|
||||||
tourNamen.add(tour.getName());
|
tourNamen.add(tour.getName());
|
||||||
|
progressBar.addProgress(steps);
|
||||||
}
|
}
|
||||||
this.sucheAktiv = true;
|
this.sucheAktiv = true;
|
||||||
|
progressBar.setProgress(maxProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSucheAktiv() {
|
public boolean isSucheAktiv() {
|
||||||
@ -672,11 +624,11 @@ public class ViewModel {
|
|||||||
/**
|
/**
|
||||||
* Importiert alle daten von einem File das hier gewählt wird
|
* Importiert alle daten von einem File das hier gewählt wird
|
||||||
*/
|
*/
|
||||||
public void importData() {
|
public void importData(ProgressBar progressBar, int maxProgress) {
|
||||||
String file = AlertHelper.fileChooser("Importiere");
|
String file = AlertHelper.fileChooser("Importiere");
|
||||||
if (file != null){
|
if (file != null){
|
||||||
this.tourNamen = FXCollections.observableArrayList();
|
this.tourNamen = FXCollections.observableArrayList();
|
||||||
new Exporter(file).doImport();
|
new Exporter(file).doImport(progressBar, maxProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,6 +636,64 @@ public class ViewModel {
|
|||||||
* Erstellt einen Summary Report
|
* Erstellt einen Summary Report
|
||||||
*/
|
*/
|
||||||
public void sumReport(){
|
public void sumReport(){
|
||||||
Reporter.sumReport();
|
Reporter.sumReport(new ProgressBar("Report"), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt das Selected Log zurück
|
||||||
|
* @return Null wenn nichts selected ist
|
||||||
|
*/
|
||||||
|
public Log getSelectedLog() {
|
||||||
|
return selectedLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kopiert einen Log eintrag und erstellt dafür eine neue Id für das kopierte log
|
||||||
|
*/
|
||||||
|
public void copyLog() {
|
||||||
|
Log selectedLog = getSelectedLog();
|
||||||
|
Tour selectedTour = getSelectedTour();
|
||||||
|
if(selectedLog == null && selectedTour == null){
|
||||||
|
//TODO kein log & keine tour selected error alert
|
||||||
|
}else {
|
||||||
|
selectedLog.setId(TourPlaner.newLogId(this.logData));
|
||||||
|
TourPlaner.addLog(selectedTour.getName(), selectedLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kopiert eie Tour und hängt dafür am ende des namens ein _copy an
|
||||||
|
* @return Der neue Tour name, bei error ""
|
||||||
|
*/
|
||||||
|
public String copyTour(ProgressBar progressBar, int maxLevel) {
|
||||||
|
Tour selectedTour = getSelectedTour();
|
||||||
|
String newName = "";
|
||||||
|
if (selectedTour == null){
|
||||||
|
//TODO keine tour selected
|
||||||
|
return "";
|
||||||
|
}else {
|
||||||
|
newName = selectedTour.getName() + "_copy";
|
||||||
|
try {
|
||||||
|
ArrayList<Log> logs = TourPlaner.getLogs(selectedTour.getName());
|
||||||
|
|
||||||
|
progressBar.addProgress(10);
|
||||||
|
TourPlaner.addTourMax(new Tour(newName, selectedTour.getDauer(), selectedTour.getMapJson(), selectedTour.getStrecke(), selectedTour.getStart(), selectedTour.getZiel(), logs), progressBar, 70);
|
||||||
|
String finalNewName = newName;
|
||||||
|
int steps = progressBar.getProgressSize(logs.size(), maxLevel-10);
|
||||||
|
logs.forEach(l -> {
|
||||||
|
TourPlaner.addLog(finalNewName, l);
|
||||||
|
progressBar.addProgress(steps);
|
||||||
|
});
|
||||||
|
getTourData(progressBar, maxLevel);
|
||||||
|
// getLogData();
|
||||||
|
selectTour(newName);
|
||||||
|
progressBar.setProgress(maxLevel);
|
||||||
|
return newName;
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogHelper.error(e);
|
||||||
|
progressBar.setProgress(maxLevel);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user