Wiederverwendbare FXML -> TourDetails wurde hinzugefügt
This commit is contained in:
parent
792aea12c4
commit
61babfcc53
13
.idea/libraries/org_apache_pdfbox_pdfbox_1_8_9.xml
generated
13
.idea/libraries/org_apache_pdfbox_pdfbox_1_8_9.xml
generated
@ -1,13 +0,0 @@
|
||||
<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>
|
@ -23,6 +23,7 @@ public class LogHelper{
|
||||
public static void error(String msg, String name){
|
||||
getLog(name).error(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log info in file und Console
|
||||
|
@ -23,6 +23,8 @@ import java.util.Date;
|
||||
*
|
||||
* iText 4 ist gratis verfügbar, siehe:
|
||||
* https://github.com/ymasory/iText-4.2.0
|
||||
*
|
||||
* https://www.vogella.com/tutorials/JavaPDF/article.html
|
||||
*/
|
||||
public class Reporter {
|
||||
|
||||
|
19
src/tourplaner/tourDetails.fxml
Normal file
19
src/tourplaner/tourDetails.fxml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tourplaner.ui.TourDetailsTabController">
|
||||
<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" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<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>
|
@ -126,15 +126,7 @@
|
||||
</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>
|
||||
|
73
src/tourplaner/ui/TourDetailsTabController.java
Normal file
73
src/tourplaner/ui/TourDetailsTabController.java
Normal file
@ -0,0 +1,73 @@
|
||||
package tourplaner.ui;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import tourplaner.business.ConfigHelper;
|
||||
import tourplaner.object.Tour;
|
||||
import tourplaner.viewmodels.ViewModel;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class TourDetailsTabController implements Initializable {
|
||||
public TableView<Tour> beschreibungTableView;
|
||||
public TableColumn<Tour, String> startCol, zielCol, dauerCol, streckeCol, nameCol;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ladet die daten der ausgewählten tour
|
||||
* @param viewModel Das aktuelle view Model
|
||||
* @param selectedItem Das selected tour item
|
||||
*/
|
||||
public void syncTour(ViewModel viewModel, String selectedItem){
|
||||
langToFxml();
|
||||
try {
|
||||
beschreibungTableView.getItems().clear(); //Leert die Table View komplett
|
||||
}catch (NullPointerException e){
|
||||
beschreibungTableView.setItems(viewModel.getTourData(new ProgressBar("Load"), 100));
|
||||
}
|
||||
beschreibungTableView.getItems().add(viewModel.getTour(selectedItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht die Tour daten
|
||||
*/
|
||||
public void delTour(){
|
||||
this.beschreibungTableView.getItems().clear(); //löscht alles aus der tabelle
|
||||
}
|
||||
|
||||
/**
|
||||
* Schreibt das keine Tour selected ist
|
||||
*/
|
||||
public void keineSelected(){
|
||||
beschreibungTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die Table view Cell Value Factory
|
||||
*/
|
||||
public void tourListSelectItem(){
|
||||
this.startCol.setCellValueFactory(new PropertyValueFactory<>("start"));
|
||||
zielCol.setCellValueFactory(new PropertyValueFactory<>("ziel"));
|
||||
dauerCol.setCellValueFactory(new PropertyValueFactory<>("dauer"));
|
||||
streckeCol.setCellValueFactory(new PropertyValueFactory<>("strecke"));
|
||||
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die aktuell gewählte sprache auf die Table view
|
||||
*/
|
||||
public void langToFxml(){
|
||||
this.nameCol.setText(ConfigHelper.getLangIniString("fname"));
|
||||
this.streckeCol.setText(ConfigHelper.getLangIniString("fstrecke"));
|
||||
this.dauerCol.setText(ConfigHelper.getLangIniString("fdauer"));
|
||||
this.zielCol.setText(ConfigHelper.getLangIniString("fziel"));
|
||||
this.startCol .setText(ConfigHelper.getLangIniString("fstart"));
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package tourplaner.ui;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.control.*;
|
||||
@ -9,10 +10,10 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import tourplaner.Main;
|
||||
import tourplaner.business.ConfigHelper;
|
||||
import tourplaner.business.LogHelper;
|
||||
import tourplaner.object.Log;
|
||||
import tourplaner.object.Tour;
|
||||
import tourplaner.viewmodels.ViewModel;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -28,8 +29,7 @@ public class TourplanerController implements Initializable {
|
||||
//Tabs zu Tour -> rechts oben
|
||||
public TabPane viewTabPane;
|
||||
public Tab kartenTab, beschreibungTab;
|
||||
public TableView<Tour> beschreibungTableView;
|
||||
public TableColumn<Tour, String> startCol, zielCol, dauerCol, streckeCol, nameCol;
|
||||
private TourDetailsTabController tourDetailsTabController;
|
||||
public TextField titleTextView, sucheInput;
|
||||
public ImageView mapImageView;
|
||||
//Log -> rechts unten
|
||||
@ -60,13 +60,21 @@ public class TourplanerController implements Initializable {
|
||||
@FXML
|
||||
private void onlangenglisch(){
|
||||
ConfigHelper.setIniString(ConfigHelper.getStandartConfig(), "lang", "lang", "langen");
|
||||
langToFxml();
|
||||
try {
|
||||
langToFxml();
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onlangdeutsch(){
|
||||
ConfigHelper.setIniString(ConfigHelper.getStandartConfig(), "lang", "lang", "langde");
|
||||
langToFxml();
|
||||
try {
|
||||
langToFxml();
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -118,8 +126,7 @@ public class TourplanerController implements Initializable {
|
||||
}
|
||||
|
||||
private void syncTour(String selectedItem){
|
||||
beschreibungTableView.getItems().clear(); //Leert die Table View komplett
|
||||
beschreibungTableView.getItems().add(this.viewModel.getTour(selectedItem));
|
||||
tourDetailsTabController.syncTour(this.viewModel, selectedItem);
|
||||
mapImageView.setImage(this.viewModel.getImage(selectedItem));
|
||||
}
|
||||
|
||||
@ -149,11 +156,7 @@ public class TourplanerController implements Initializable {
|
||||
progressBar.addProgress(steps);
|
||||
syncTour(selectedItem);
|
||||
progressBar.addProgress(steps);
|
||||
startCol.setCellValueFactory(new PropertyValueFactory<>("start"));
|
||||
zielCol.setCellValueFactory(new PropertyValueFactory<>("ziel"));
|
||||
dauerCol.setCellValueFactory(new PropertyValueFactory<>("dauer"));
|
||||
streckeCol.setCellValueFactory(new PropertyValueFactory<>("strecke"));
|
||||
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
|
||||
this.tourDetailsTabController.tourListSelectItem();
|
||||
|
||||
//Log anzeigen
|
||||
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinelogsvorhanden")));
|
||||
@ -221,7 +224,7 @@ public class TourplanerController implements Initializable {
|
||||
*/
|
||||
@FXML
|
||||
private void delTour(){
|
||||
this.beschreibungTableView.getItems().clear(); //löscht alles aus der tabelle
|
||||
this.tourDetailsTabController.delTour();
|
||||
this.titleTextView.setText(ConfigHelper.getLangIniString("keinetourselected"));
|
||||
this.viewModel.delTour();
|
||||
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
||||
@ -282,7 +285,6 @@ public class TourplanerController implements Initializable {
|
||||
TourListView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
||||
TourListView.setOrientation(Orientation.VERTICAL);
|
||||
syncTourNamen(new ProgressBar("Start"), 100);
|
||||
deselectAll();
|
||||
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1){
|
||||
this.openpdf.setSelected(true);
|
||||
}else {
|
||||
@ -304,22 +306,29 @@ public class TourplanerController implements Initializable {
|
||||
this.langenglisch.setSelected(true);
|
||||
}
|
||||
|
||||
langToFxml();
|
||||
try {
|
||||
// Child fxml load
|
||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("tourDetails.fxml"));
|
||||
this.beschreibungTab.setContent(loader.load());
|
||||
this.tourDetailsTabController = loader.getController();
|
||||
|
||||
|
||||
langToFxml();
|
||||
deselectAll();
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt jedem Element den Text der gewählten Sprache
|
||||
*/
|
||||
private void langToFxml(){
|
||||
private void langToFxml() throws IOException {
|
||||
this.kartenTab.setText(ConfigHelper.getLangIniString("fkarte"));
|
||||
this.beschreibungTab.setText(ConfigHelper.getLangIniString("fbeschreibung"));
|
||||
this.editBtn.setText(ConfigHelper.getLangIniString("fedit"));
|
||||
this.editTourBtn.setText(ConfigHelper.getLangIniString("fedit"));
|
||||
this.nameCol.setText(ConfigHelper.getLangIniString("fname"));
|
||||
this.streckeCol.setText(ConfigHelper.getLangIniString("fstrecke"));
|
||||
this.dauerCol.setText(ConfigHelper.getLangIniString("fdauer"));
|
||||
this.zielCol.setText(ConfigHelper.getLangIniString("fziel"));
|
||||
this.startCol .setText(ConfigHelper.getLangIniString("fstart"));
|
||||
this.tourDetailsTabController.langToFxml();
|
||||
this.logAvgCol.setText(ConfigHelper.getLangIniString("favg"));
|
||||
this.logBemerkungCol.setText(ConfigHelper.getLangIniString("fbemerkung"));
|
||||
this.logDatumCol.setText(ConfigHelper.getLangIniString("fdatum"));
|
||||
@ -364,7 +373,8 @@ public class TourplanerController implements Initializable {
|
||||
|
||||
private void deselectAll(){
|
||||
//Tabs zu Tour -> rechts oben
|
||||
beschreibungTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
||||
this.tourDetailsTabController.keineSelected();
|
||||
this.beschreibungTab.setText(ConfigHelper.getLangIniString("fbeschreibung"));
|
||||
titleTextView.setText( ConfigHelper.getLangIniString("keinetourselected"));
|
||||
//Log -> rechts unten
|
||||
logTableView.setPlaceholder(new Label( ConfigHelper.getLangIniString("keinetourselected")));
|
||||
|
Loading…
x
Reference in New Issue
Block a user