Suche onEnter + Focus auf selected Tour nach Suche + entferne sout´s + entferne unnötige Log einträge

This commit is contained in:
Georg Reisinger 2021-04-27 16:22:13 +02:00
parent f45e890fdd
commit 0402252029
8 changed files with 115 additions and 127 deletions

View File

@ -56,7 +56,6 @@ public class DirectionMap {
* @throws IOException Fehler beim Get der Map
*/
private Image getMap(String size) throws IOException {
System.out.println("URL: " + "https://www.mapquestapi.com/staticmap/v5/map?session="+this.sessionId+"&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"));
}

View File

@ -178,7 +178,6 @@ public class TourPlaner{
touren.add(t);
}
});
System.out.println(""+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(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);

View File

@ -27,15 +27,12 @@ public class DbConnect {
/**
* Erstellt alle Tabellen die für den Betrieb der Software bennötigt werden
* @return True bei erfolg, sonst error
*/
public boolean init() {
ArrayList<Boolean> errors = new ArrayList<>();
errors.add(PostgresHelper.executeUpdateMessage("create table tour ( tourname varchar not null, dauer decimal, mapjson varchar, start varchar, ziel varchar, strecke decimal);", "Tour Table created"));
errors.add(PostgresHelper.executeUpdateMessage("create unique index tour_tourname_uindex on tour (tourname);", "Tour Table unique created"));
errors.add(PostgresHelper.executeUpdateMessage("alter table tour add constraint tour_pk primary key (tourname);", "Tour Table primary created"));
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);
public void init() {
PostgresHelper.executeUpdateNoLog("create table tour ( tourname varchar not null, dauer decimal, mapjson varchar, start varchar, ziel varchar, strecke decimal);");
PostgresHelper.executeUpdateNoLog("create unique index tour_tourname_uindex on tour (tourname);");
PostgresHelper.executeUpdateNoLog("alter table tour add constraint tour_pk primary key (tourname);");
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);");
}
@ -125,7 +122,7 @@ public class DbConnect {
this.c.close();
return logs;
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
LogHelper.error(e);
return null;
}
}
@ -139,8 +136,6 @@ public class DbConnect {
*/
public boolean addLog(String tourname, Log log){
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()+"', "
+log.getStrecke()+", "+log.getAvgspeed()+", "+log.getHightmeter()+", "+log.getPause()+", "+log.getGegangen()+", "+log.getDauer()+",'"+log.getRating()+"')");
}
@ -244,7 +239,7 @@ public class DbConnect {
this.c.close();
return touren;
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
LogHelper.error(e);
return null;
}
}

View File

@ -6,6 +6,7 @@ import tourplaner.business.LogHelper;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
/**
@ -20,8 +21,6 @@ public class PostgresHelper {
Connection c = null;
try {
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
.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"));
@ -48,17 +47,38 @@ public class PostgresHelper {
* @return True bei erfolg, sonst false
*/
public static boolean executeUpdate(String sql){
Connection c = con();
Statement stmt;
try {
stmt = c.createStatement();
stmt.executeUpdate(sql);
stmt.close();
c.close();
} catch (Exception e) {
exUpdate(sql);
} catch (SQLException e) {
LogHelper.error(e.getMessage(), e.getClass().getName());
return false;
}
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;
}
}
}

View File

@ -39,101 +39,76 @@
<?import javafx.scene.paint.*?>
<?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">
<MenuBar VBox.vgrow="NEVER">
<Menu fx:id="menueFile" mnemonicParsing="false" text="Datei">
<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="beendenButton" mnemonicParsing="false" onAction="#quitApp" text="Beenden"/>
<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="beendenButton" mnemonicParsing="false" onAction="#quitApp" text="Beenden" />
</Menu>
<Menu fx:id="menuebearbeiten" mnemonicParsing="false" text="Bearbeiten">
<MenuItem fx:id="menueimport" mnemonicParsing="false" onAction="#importBtn" text="Import"/>
<MenuItem fx:id="menueexport" mnemonicParsing="false" onAction="#exportBtn" text="Export"/>
<MenuItem fx:id="menueimport" mnemonicParsing="false" onAction="#importBtn" text="Import" />
<MenuItem fx:id="menueexport" mnemonicParsing="false" onAction="#exportBtn" text="Export" />
</Menu>
<Menu fx:id="menueoptionen" mnemonicParsing="false" text="Optionen">
<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="openmap" mnemonicParsing="false" onAction="#openmapaction" text="Map automatisch öffnen" />
<CheckMenuItem fx:id="openpdf" mnemonicParsing="false" onAction="#openpdfaction" text="Report automatisch öffnen" />
<Menu fx:id="menuesprachen" mnemonicParsing="false" text="Sprache">
<RadioMenuItem fx:id="langdeutsch" mnemonicParsing="false" onAction="#onlangdeutsch"
text="Deutsch"/>
<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" />
</Menu>
</Menu>
<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"/>
<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>
<HBox id="HBox" alignment="CENTER_LEFT" layoutX="10.0" layoutY="588.0" spacing="5.0">
<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>
<AnchorPane HBox.hgrow="ALWAYS">
<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"/>
<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" />
</AnchorPane>
<TextField fx:id="sucheInput" promptText="Suche..."/>
<Button fx:id="sucheButton" mnemonicParsing="false" onAction="#suche" text="Suchen"/>
<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">
<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"/>
<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" />
</AnchorPane>
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="496.0" prefWidth="620.0">
<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">
<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"/>
<Insets left="10.0" />
</HBox.margin>
</Label>
<TextField fx:id="titleTextView" editable="false"/>
<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">
<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"/>
<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">
<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"/>
<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>
@ -142,62 +117,45 @@
</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">
<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">
<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"/>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<Label text="Logs:">
<HBox.margin>
<Insets left="10.0"/>
<Insets left="10.0" />
</HBox.margin>
</Label>
<Button mnemonicParsing="false" onAction="#addLog" text="+"
textAlignment="CENTER">
<Button mnemonicParsing="false" onAction="#addLog" text="+" textAlignment="CENTER">
<HBox.margin>
<Insets/>
<Insets />
</HBox.margin>
</Button>
<Button fx:id="logDel" mnemonicParsing="false" onAction="#delLog"
prefWidth="21.0" text="-" textAlignment="CENTER">
<Button fx:id="logDel" mnemonicParsing="false" onAction="#delLog" prefWidth="21.0" text="-" textAlignment="CENTER">
<HBox.margin>
<Insets/>
<Insets />
</HBox.margin>
</Button>
<Button fx:id="editBtn" mnemonicParsing="false" onAction="#editLogBtn"
text="Edit"/>
<Button fx:id="editBtn" mnemonicParsing="false" onAction="#editLogBtn" text="Edit" />
</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">
<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"/>
<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"/>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
</AnchorPane>
@ -207,17 +165,17 @@
</SplitPane>
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
<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>
<Label maxHeight="1.7976931348623157E308" text="Tourplaner" HBox.hgrow="ALWAYS">
<font>
<Font size="11.0" fx:id="x3"/>
<Font size="11.0" fx:id="x3" />
</font>
<textFill>
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4"/>
<Color red="0.625" green="0.625" blue="0.625" fx:id="x4" />
</textFill>
</Label>
<AnchorPane HBox.hgrow="ALWAYS"/>
<Label font="$x3" text="Georg Reisinger" textFill="$x4" HBox.hgrow="NEVER"/>
<AnchorPane HBox.hgrow="ALWAYS" />
<Label font="$x3" text="Georg Reisinger" textFill="$x4" HBox.hgrow="NEVER" />
</HBox>
</VBox>

View File

@ -209,7 +209,6 @@ public class AlertHelper {
datePicker.setOnAction(event -> {
LocalDate date = datePicker.getValue();
System.out.println("Selected date: " + date);
selectedDate.set(date);
stage.close();
});

View File

@ -6,6 +6,8 @@ import javafx.geometry.Orientation;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import tourplaner.business.ConfigHelper;
import tourplaner.business.LogHelper;
@ -16,6 +18,7 @@ import tourplaner.viewmodels.ViewModel;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicInteger;
public class TourplanerController implements Initializable {
//VM
@ -123,6 +126,7 @@ public class TourplanerController implements Initializable {
*/
@FXML
private void tourListSelectedItem(MouseEvent mouseEvent){
//Beschreibung
ProgressBar progressBar = new ProgressBar("Tour auswählen...");
String selectedItem = TourListView.getSelectionModel().getSelectedItem();
this.viewModel.selectTour(selectedItem);
@ -159,6 +163,16 @@ public class TourplanerController implements Initializable {
syncTourNamen();
progressBar.setProgress(100);
this.sucheInput.setText("");
//Tour namen select focus
AtomicInteger index = new AtomicInteger();
AtomicInteger indexF = new AtomicInteger();
this.viewModel.getTourNamen().forEach(tn -> {
index.getAndIncrement();
if(tn.equals(this.viewModel.getSelectedTour().getName())){
indexF.set(index.get());
}
});
TourListView.getFocusModel().focus(indexF.intValue() - 1);
}
progressBar.setProgress(100);
}
@ -206,6 +220,13 @@ public class TourplanerController implements Initializable {
progressBar.closeProgress();
}
@FXML
private void sucheEnter(KeyEvent event){
if(event.getCode().equals(KeyCode.ENTER)) {
suche();
}
}
/**
* Fügt einen Log eintrag zu einer Tour hinzu.
* Ist keine Tour ausgewählt, dann kommt eine Warnung an den User!

View File

@ -98,7 +98,6 @@ public class ViewModel {
this.neueTourName = AlertHelper.inputText(ConfigHelper.getLangIniString("tournametitle"),
ConfigHelper.getLangIniString("tournameheader"),
ConfigHelper.getLangIniString("tournamemsg"), content);
System.out.println(this.neueTourName);
if(this.neueTourName.isEmpty()){
return false;
}
@ -197,7 +196,6 @@ public class ViewModel {
* Bearbeitet einen gewählten Log eintrag
*/
public void editLog(){
System.out.println(this.selectedLog);
if(this.selectedTour != null) {
if(this.selectedLog != null) {
AtomicReference<Tour> tourAkt = new AtomicReference<>();
@ -314,7 +312,6 @@ public class ViewModel {
private LocalDate dateInput(LocalDate date){
LocalDate neuesDatum = null;
neuesDatum = AlertHelper.datePicker(date);
System.out.println(neuesDatum);
return neuesDatum;
}