Log -> + Avg, höhenmeter, pause, unterwegs, bemerkung
This commit is contained in:
parent
2265014db3
commit
0e43c28c67
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
out/
|
||||
conf.ini
|
||||
log/log4j/log.out/
|
||||
reports/
|
||||
|
13
.idea/libraries/org_apache_pdfbox_pdfbox_1_8_9.xml
generated
Normal file
13
.idea/libraries/org_apache_pdfbox_pdfbox_1_8_9.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="org.apache.pdfbox:pdfbox:1.8.9" type="repository">
|
||||
<properties maven-id="org.apache.pdfbox:pdfbox:1.8.9" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/pdfbox/pdfbox/1.8.9/pdfbox-1.8.9.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/pdfbox/fontbox/1.8.9/fontbox-1.8.9.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/pdfbox/jempbox/1.8.9/jempbox-1.8.9.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -10,5 +10,6 @@
|
||||
<orderEntry type="library" name="lib" level="project" />
|
||||
<orderEntry type="library" name="org.ini4j:ini4j:0.5.4" level="project" />
|
||||
<orderEntry type="library" name="log4j:log4j:1.2.17" level="project" />
|
||||
<orderEntry type="library" name="org.apache.pdfbox:pdfbox:1.8.9" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -13,6 +13,9 @@ port = 5432
|
||||
user =
|
||||
pw =
|
||||
|
||||
[report]
|
||||
path = ./reports/
|
||||
|
||||
[hilfe]
|
||||
gitrepo = https://git.dergeorg.at/dergeorg/tourplaner
|
||||
doxygendoc = https://git.dergeorg.at/dergeorg/tourplaner
|
||||
|
@ -34,3 +34,9 @@ logtournotselectedmsg = Bitte wählen Sie zuerst eine Tour aus, bevor sie einen
|
||||
keintextimfeld = Bitte tragen Sie einen Text in das Feld ein!
|
||||
nurzahlen = Bitte geben Sie nur Zahlen an!
|
||||
nurpositivezahlen = Bitte geben Sie nur positive Zahlen an!
|
||||
pause = Pause
|
||||
pausemsg = Dauer der Pause
|
||||
hightmeter = Höhenmeter
|
||||
hightmetermsg = Höhenmeter des Abschnitts
|
||||
bemerkung = Bemerkung
|
||||
bemerkungheader = Bitte geben Sie die Bemerkungen zu diesem Log eintrag ein, kann auch leer bleiben.
|
@ -11,3 +11,5 @@
|
||||
2021-03-19 11:56:22 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt!
|
||||
2021-03-19 22:35:19 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt!
|
||||
2021-03-19 23:23:36 ERROR ViewModel -> DelTour:33 - Keine Tour ausgewählt!
|
||||
2021-04-13 18:30:39 ERROR FileNotFoundException:33 - \report\test.pdf (Das System kann den angegebenen Pfad nicht finden)
|
||||
2021-04-13 18:31:11 ERROR FileNotFoundException:33 - \reports\test.pdf (Das System kann den angegebenen Pfad nicht finden)
|
||||
|
@ -23,7 +23,7 @@ public class Main extends Application {
|
||||
Parent root = FXMLLoader.load(Main.class.getResource("tourplaner.fxml"));
|
||||
primaryStage.setTitle(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "start", "apptitle"));
|
||||
primaryStage.getIcons().add(new Image("file:"+ ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "start", "logo")));
|
||||
primaryStage.setScene(new Scene(root, 600, 600));
|
||||
primaryStage.setScene(new Scene(root, 1500, 1000));
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
|
2
src/tourplaner/business/Reporter.java
Normal file
2
src/tourplaner/business/Reporter.java
Normal file
@ -0,0 +1,2 @@
|
||||
package tourplaner.business;public class Reporter {
|
||||
}
|
@ -6,15 +6,60 @@ import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
public class Log {
|
||||
private String id, dauer;
|
||||
private String id, bemerkung;
|
||||
private LocalDate datum;
|
||||
private double strecke;
|
||||
private double strecke, avgspeed, hightmeter, pause, dauer, gegangen;
|
||||
|
||||
public Log(String id, String dauer, LocalDate datum, double strecke) {
|
||||
public Log(String id, double dauer, LocalDate datum, double strecke, String bemerkung, double hightmeter, double pause) {
|
||||
this.id = id;
|
||||
this.dauer = dauer;
|
||||
this.datum = datum;
|
||||
this.strecke = strecke;
|
||||
this.bemerkung = bemerkung;
|
||||
this.hightmeter = hightmeter;
|
||||
this.pause = pause;
|
||||
this.gegangen = this.dauer - this.pause;
|
||||
this.avgspeed = this.strecke / (this.gegangen);
|
||||
}
|
||||
|
||||
public String getBemerkung() {
|
||||
return bemerkung;
|
||||
}
|
||||
|
||||
public void setBemerkung(String bemerkung) {
|
||||
this.bemerkung = bemerkung;
|
||||
}
|
||||
|
||||
public double getAvgspeed() {
|
||||
return avgspeed;
|
||||
}
|
||||
|
||||
public void setAvgspeed(double avgspeed) {
|
||||
this.avgspeed = avgspeed;
|
||||
}
|
||||
|
||||
public double getHightmeter() {
|
||||
return hightmeter;
|
||||
}
|
||||
|
||||
public void setHightmeter(double hightmeter) {
|
||||
this.hightmeter = hightmeter;
|
||||
}
|
||||
|
||||
public double getPause() {
|
||||
return pause;
|
||||
}
|
||||
|
||||
public void setPause(double pause) {
|
||||
this.pause = pause;
|
||||
}
|
||||
|
||||
public double getGegangen() {
|
||||
return gegangen;
|
||||
}
|
||||
|
||||
public void setGegangen(double gegangen) {
|
||||
this.gegangen = gegangen;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
@ -25,11 +70,11 @@ public class Log {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDauer() {
|
||||
public double getDauer() {
|
||||
return dauer;
|
||||
}
|
||||
|
||||
public void setDauer(String dauer) {
|
||||
public void setDauer(double dauer) {
|
||||
this.dauer = dauer;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Optionen">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#tourReport" text="Tour Report erstellen" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#nimpButton" text="Keine Funktion" />
|
||||
</items>
|
||||
</Menu>
|
||||
@ -82,7 +83,7 @@
|
||||
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<SplitPane dividerPositions="0.21492204899777284" focusTraversable="true" prefHeight="522.0" prefWidth="900.0" VBox.vgrow="ALWAYS">
|
||||
<SplitPane dividerPositions="0.060133630289532294" focusTraversable="true" prefHeight="522.0" prefWidth="300.0" VBox.vgrow="ALWAYS">
|
||||
<items>
|
||||
<AnchorPane prefWidth="239.0">
|
||||
<children>
|
||||
@ -119,7 +120,7 @@
|
||||
<content>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<TableView fx:id="beschreibungTableView" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<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" maxWidth="1.7976931348623157E308" minWidth="70.0" prefWidth="-1.0" text="Tourname" />
|
||||
<TableColumn fx:id="dauerCol" maxWidth="1.7976931348623157E308" minWidth="40.0" prefWidth="-1.0" text="Dauer" />
|
||||
@ -142,7 +143,7 @@
|
||||
<children>
|
||||
<VBox prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<AnchorPane prefWidth="676.0">
|
||||
<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>
|
||||
@ -169,13 +170,18 @@
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefWidth="200.0">
|
||||
<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" prefWidth="238.0" text="Datum" />
|
||||
<TableColumn fx:id="logDauerCol" prefWidth="223.0" text="Dauer" />
|
||||
<TableColumn fx:id="logDatumCol" prefWidth="49.0" text="Datum" />
|
||||
<TableColumn fx:id="logDauerCol" prefWidth="126.0" text="Dauer" />
|
||||
<TableColumn fx:id="logStreckeCol" prefWidth="240.0" text="Entfernung" />
|
||||
<TableColumn fx:id="logAvgCol" prefWidth="75.0" text="AVG Geschwindigkeit" />
|
||||
<TableColumn fx:id="logHightCol" prefWidth="75.0" text="Höhenmeter" />
|
||||
<TableColumn fx:id="logPauseCol" prefWidth="75.0" text="Davon Pause" />
|
||||
<TableColumn fx:id="logGegangenCol" prefWidth="75.0" text="Davon Unterwegs" />
|
||||
<TableColumn fx:id="logBemerkungCol" prefWidth="75.0" text="Bemerkung" />
|
||||
</columns>
|
||||
<columnResizePolicy>
|
||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||
|
@ -109,13 +109,25 @@ public class AlertHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Texteingabe
|
||||
* Texteingabe die nicht leer sein darf
|
||||
* @param title Title des Dialogs
|
||||
* @param header Header des Dialogs
|
||||
* @param msg Nachricht des Dialogs
|
||||
* @return Null bei keiner eingabe
|
||||
*/
|
||||
public static String inputText(String title, String header, String msg, String content) {
|
||||
public static String inputText(String title, String header, String msg, String content){
|
||||
return inputTextNotNull(title, header, msg, content, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Texteingabe
|
||||
* @param title Title des Dialogs
|
||||
* @param header Header des Dialogs
|
||||
* @param msg Nachricht des Dialogs
|
||||
* @param notNull true wenn der input nicht leer sein darf
|
||||
* @return Null bei keiner eingabe
|
||||
*/
|
||||
public static String inputTextNotNull(String title, String header, String msg, String content, boolean notNull) {
|
||||
String returnStr = null;
|
||||
while (returnStr == null) {
|
||||
Optional<String> result = inputHelper(title, header, msg, content);
|
||||
@ -124,7 +136,7 @@ public class AlertHelper {
|
||||
if(result.isPresent()) {
|
||||
result.ifPresent(returnText::set);
|
||||
returnStr = returnText.get();
|
||||
if (returnStr.isEmpty()) {
|
||||
if (returnStr.isEmpty() && notNull) {
|
||||
AlertHelper.warn(ConfigHelper.getLangIniString("tournametitle"),
|
||||
ConfigHelper.getLangIniString("achtung"),
|
||||
ConfigHelper.getLangIniString("keintextimfeld"));
|
||||
|
@ -38,7 +38,12 @@ public class TourplanerController implements Initializable {
|
||||
public TextField titleTextView, sucheInput;
|
||||
//Log -> rechts unten
|
||||
public TableView<Log> logTableView;
|
||||
public TableColumn<Log, String> logDauerCol, logStreckeCol, logDatumCol;
|
||||
public TableColumn<Log, String> logDauerCol, logStreckeCol, logDatumCol, logAvgCol, logHightCol, logPauseCol, logGegangenCol, logBemerkungCol;
|
||||
|
||||
@FXML
|
||||
private void tourReport(){
|
||||
this.viewModel.tourReport();
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
@ -102,6 +107,12 @@ public class TourplanerController implements Initializable {
|
||||
logDauerCol.setCellValueFactory(new PropertyValueFactory<Log, String>("dauer"));
|
||||
logStreckeCol.setCellValueFactory(new PropertyValueFactory<Log, String>("strecke"));
|
||||
logDatumCol.setCellValueFactory(new PropertyValueFactory<Log, String>("datum"));
|
||||
logAvgCol.setCellValueFactory(new PropertyValueFactory<Log, String>("avgspeed"));
|
||||
logHightCol.setCellValueFactory(new PropertyValueFactory<Log, String>("hightmeter"));
|
||||
logPauseCol.setCellValueFactory(new PropertyValueFactory<Log, String>("pause"));
|
||||
logGegangenCol.setCellValueFactory(new PropertyValueFactory<Log, String>("gegangen"));
|
||||
logBemerkungCol.setCellValueFactory(new PropertyValueFactory<Log, String>("bemerkung"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,8 @@ package tourplaner.viewmodels;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import org.apache.pdfbox.exceptions.COSVisitorException;
|
||||
import tourplaner.business.Reporter;
|
||||
import tourplaner.ui.AlertHelper;
|
||||
import tourplaner.business.ConfigHelper;
|
||||
import tourplaner.business.LogHelper;
|
||||
@ -22,7 +24,7 @@ public class ViewModel {
|
||||
private final ObservableList<Tour> tourData = FXCollections.observableArrayList(new Tour("Test 1", "120", "json dings", 22.3, "Wien", "Graz"),new Tour("Test 2", "210", "json dings", 42.3, "Da", "Dort"));
|
||||
private final ObservableList<String> tourNamen = FXCollections.observableArrayList("Test 1", "Test 2");
|
||||
private Tour selectedTour;
|
||||
private String neueTourName, neueTourStart, neueTourZiel;
|
||||
private String neueTourName, neueTourStart, neueTourZiel, neueBemerkung;
|
||||
//Log
|
||||
private final ObservableList<Log> logData = FXCollections.observableArrayList();
|
||||
private Log selectedLog;
|
||||
@ -184,22 +186,35 @@ public class ViewModel {
|
||||
});
|
||||
double dauer = dauerInput(this.selectedLog.getDauer());
|
||||
double strecke = -1;
|
||||
double pause = -1.0;
|
||||
double hightmeter = -1.0;
|
||||
boolean bemerkung = false;
|
||||
LocalDate datum = null;
|
||||
if (dauer >= 0) {
|
||||
strecke = streckeInput(this.selectedLog.getStrecke() + "");
|
||||
if (strecke >= 0) {
|
||||
datum = dateInput(this.selectedLog.getDatum());
|
||||
if(datum != null){
|
||||
Log newLog = new Log(this.selectedLog.getId(), dauer + "", datum,strecke);
|
||||
this.logData.removeIf(ld -> ld.getId().equals(this.selectedLog.getId()));
|
||||
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.add(tourAkt.get());
|
||||
pause = pauseInput("");
|
||||
if(pause >= 0.0) {
|
||||
hightmeter = hightmeterInput("");
|
||||
if (hightmeter >= 0.0) {
|
||||
bemerkung = bemerkungInput("");
|
||||
if (bemerkung) {
|
||||
datum = dateInput(this.selectedLog.getDatum());
|
||||
if (datum != null) {
|
||||
Log newLog = new Log(this.selectedLog.getId(), dauer, datum, strecke, this.neueBemerkung, hightmeter, pause);
|
||||
this.logData.removeIf(ld -> ld.getId().equals(this.selectedLog.getId()));
|
||||
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.add(tourAkt.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.neueBemerkung = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -215,13 +230,18 @@ public class ViewModel {
|
||||
|
||||
/**
|
||||
* Eingabe der Dauer bis sie korrekt ist
|
||||
* @param content Wenn der Content -1.0 ist, wird er nicht in das input feld eingeschleust, sonst schon
|
||||
* @return Die eingegebene Dauer
|
||||
*/
|
||||
private double dauerInput(String content){
|
||||
private double dauerInput(double content){
|
||||
String realcontent = "";
|
||||
if (content != -1){
|
||||
realcontent = content + "";
|
||||
}
|
||||
return AlertHelper.inputNumber(ConfigHelper.getLangIniString("dauer"),
|
||||
ConfigHelper.getLangIniString("dauermsg"),
|
||||
ConfigHelper.getLangIniString("dauer") +
|
||||
ConfigHelper.getLangIniString("doppelpunkt"), content);
|
||||
ConfigHelper.getLangIniString("doppelpunkt"), realcontent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,6 +255,38 @@ public class ViewModel {
|
||||
return neuesDatum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bemerkung input, darf auch leer bleiben
|
||||
* @param content Startwert im Input feld
|
||||
* @return True bei erfolg, wenn es abgebrochen wird ist es false
|
||||
*/
|
||||
private boolean bemerkungInput(String content){
|
||||
this.neueBemerkung = AlertHelper.inputTextNotNull(ConfigHelper.getLangIniString("bemerkung"),
|
||||
ConfigHelper.getLangIniString("bemerkungheader"),
|
||||
ConfigHelper.getLangIniString("bemerkung")+
|
||||
ConfigHelper.getLangIniString("doppelpunkt"), content, false);
|
||||
return !(this.neueBemerkung == null);
|
||||
}
|
||||
|
||||
private double hightmeterInput(String content) {
|
||||
return AlertHelper.inputNumber(ConfigHelper.getLangIniString("hightmeter"),
|
||||
ConfigHelper.getLangIniString("hightmetermsg"),
|
||||
ConfigHelper.getLangIniString("hightmeter") +
|
||||
ConfigHelper.getLangIniString("doppelpunkt"), content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause eingabe bis diese Korrekt ist
|
||||
* @param content Default value für das Input Feld
|
||||
* @return -1 bei error
|
||||
*/
|
||||
private double pauseInput(String content){
|
||||
return AlertHelper.inputNumber(ConfigHelper.getLangIniString("pause"),
|
||||
ConfigHelper.getLangIniString("pausemsg"),
|
||||
ConfigHelper.getLangIniString("pause") +
|
||||
ConfigHelper.getLangIniString("doppelpunkt"), content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt einen Log eintrag zu einer Tour hinzu.
|
||||
* Ist keine Tour ausgewählt, dann kommt eine Warnung an den User!
|
||||
@ -250,22 +302,33 @@ public class ViewModel {
|
||||
newId.set(UUID.randomUUID().toString());
|
||||
}
|
||||
});
|
||||
double dauer = dauerInput("");
|
||||
double strecke;
|
||||
double dauer = dauerInput(-1.0);
|
||||
double strecke, pause, hightmeter;
|
||||
boolean bemerkung = false;
|
||||
LocalDate date = null;
|
||||
if(dauer >= 0) {
|
||||
strecke = streckeInput("");
|
||||
if (strecke >= 0.0) {
|
||||
date = dateInput(LocalDate.now());
|
||||
if (date != null){
|
||||
Log newLog = new Log(newId.get(), dauer + "", date, strecke);
|
||||
this.logData.add(newLog);
|
||||
s.addLog(newLog);
|
||||
pause = pauseInput("");
|
||||
if(pause >= 0.0) {
|
||||
hightmeter = hightmeterInput("");
|
||||
if (hightmeter >= 0.0) {
|
||||
bemerkung = bemerkungInput("");
|
||||
if (bemerkung){
|
||||
date = dateInput(LocalDate.now());
|
||||
if (date != null) {
|
||||
Log newLog = new Log(newId.get(), dauer, date, strecke, this.neueBemerkung, hightmeter, pause);
|
||||
this.logData.add(newLog);
|
||||
s.addLog(newLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.neueBemerkung = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,4 +558,24 @@ public class ViewModel {
|
||||
ConfigHelper.getLangIniString("fktnichtimplementiert"),
|
||||
ConfigHelper.getLangIniString("vergessenodernochnichtsoweit"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Startet den Tour Report
|
||||
*/
|
||||
public void tourReport() {
|
||||
if (this.selectedTour == null){
|
||||
AlertHelper.warn(ConfigHelper.getLangIniString("achtung"),
|
||||
ConfigHelper.getLangIniString("keinetourselected"),
|
||||
ConfigHelper.getLangIniString("logtournotselectedmsg"));
|
||||
}else {
|
||||
try {
|
||||
Reporter.createTourReport(this.selectedTour.getName());
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
||||
} catch (COSVisitorException e) {
|
||||
LogHelper.error(e.getMessage(), e.getClass().getName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user