Sprachfile erweitert + Exporter begonnen
This commit is contained in:
		
							
								
								
									
										20
									
								
								langde.ini
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								langde.ini
									
									
									
									
									
								
							@@ -40,3 +40,23 @@ hightmeter = Höhenmeter
 | 
				
			|||||||
hightmetermsg = Höhenmeter des Abschnitts
 | 
					hightmetermsg = Höhenmeter des Abschnitts
 | 
				
			||||||
bemerkung = Bemerkung
 | 
					bemerkung = Bemerkung
 | 
				
			||||||
bemerkungheader = Bitte geben Sie die Bemerkungen zu diesem Log eintrag ein, kann auch leer bleiben.
 | 
					bemerkungheader = Bitte geben Sie die Bemerkungen zu diesem Log eintrag ein, kann auch leer bleiben.
 | 
				
			||||||
 | 
					tourreportvon = Tour Report von ->
 | 
				
			||||||
 | 
					tourplanervon = Tourplaner by DerGeorg
 | 
				
			||||||
 | 
					reportkeywords = Tourplaner, Tour, Report
 | 
				
			||||||
 | 
					tourplaner = Tourplaner"
 | 
				
			||||||
 | 
					tour = Tour
 | 
				
			||||||
 | 
					reportvon = Report erstellt von:
 | 
				
			||||||
 | 
					reportstart = Startpunkt der Tour:
 | 
				
			||||||
 | 
					reportziel = Zielpunkt der Tour:
 | 
				
			||||||
 | 
					reportdauercal = Berechnete Dauer der Tour:
 | 
				
			||||||
 | 
					reportstreckecal = Berechnete Strecke der Tour:
 | 
				
			||||||
 | 
					logs = Logs
 | 
				
			||||||
 | 
					countlog = Anzahl der Logeinträge:
 | 
				
			||||||
 | 
					logvom = Log vom:
 | 
				
			||||||
 | 
					logdauer = Dauer:
 | 
				
			||||||
 | 
					logpause = Davon Pause:
 | 
				
			||||||
 | 
					loggegangen = Davon gegangen:
 | 
				
			||||||
 | 
					logavg = Berechnete Durchschnittliche Geschwindigkeit:
 | 
				
			||||||
 | 
					logstrecke = Entfernung:
 | 
				
			||||||
 | 
					loghight = Höhenmeter:
 | 
				
			||||||
 | 
					logbemerkung = Bemerkung:
 | 
				
			||||||
@@ -1,14 +1,13 @@
 | 
				
			|||||||
package tourplaner.business;
 | 
					package tourplaner.business;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.imageio.ImageIO;
 | 
					 | 
				
			||||||
import java.awt.*;
 | 
					import java.awt.*;
 | 
				
			||||||
import java.awt.image.BufferedImage;
 | 
					 | 
				
			||||||
import java.awt.image.RenderedImage;
 | 
					 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Zuständig für das besorgen der Map für die UI und PDF-Reports und für die Berechneten infos der Tour (Dauer, Strecke)
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class DirectionMap {
 | 
					public class DirectionMap {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private double dauer, strecke;
 | 
					    private double dauer, strecke;
 | 
				
			||||||
    private String start, end, tourname, file, filepdf;
 | 
					    private String start, end, tourname, file, filepdf;
 | 
				
			||||||
    private Image map, mappdf;
 | 
					    private Image map, mappdf;
 | 
				
			||||||
@@ -35,10 +34,18 @@ public class DirectionMap {
 | 
				
			|||||||
        FileHelper.openDefault(file);
 | 
					        FileHelper.openDefault(file);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Get berechnete Dauer in Minuten
 | 
				
			||||||
 | 
					     * @return Berechnete Dauer der Tour
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public double getDauer() {
 | 
					    public double getDauer() {
 | 
				
			||||||
        return dauer;
 | 
					        return dauer;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Get berechnete Strecke
 | 
				
			||||||
 | 
					     * @return Berechnete Strecke der Tour
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public double getStrecke() {
 | 
					    public double getStrecke() {
 | 
				
			||||||
        return strecke;
 | 
					        return strecke;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -54,12 +61,23 @@ public class DirectionMap {
 | 
				
			|||||||
        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?start="+start+"&end="+ende+"&size="+size+"&key="+ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "map", "key"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Besorgt die Infos der Tour von Mapquest Directions
 | 
				
			||||||
 | 
					     * @param start Start der Tour
 | 
				
			||||||
 | 
					     * @param ende Ende der 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 {
 | 
				
			||||||
        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");
 | 
				
			||||||
        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"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Formatet time HH:MM:SS in Minuten umwandeln
 | 
				
			||||||
 | 
					     * @param formatetTime Formatet time HH:MM:SS
 | 
				
			||||||
 | 
					     * @return Zeit in Minuten
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private double formatetTimeToMinutes(String formatetTime){
 | 
					    private double formatetTimeToMinutes(String formatetTime){
 | 
				
			||||||
        double minutes = 0;
 | 
					        double minutes = 0;
 | 
				
			||||||
        String[] result = formatetTime.split(":");
 | 
					        String[] result = formatetTime.split(":");
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								src/tourplaner/business/Exporter.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/tourplaner/business/Exporter.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					package tourplaner.business;public class Exporter {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,5 @@
 | 
				
			|||||||
package tourplaner.business;
 | 
					package tourplaner.business;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.imageio.ImageIO;
 | 
					import javax.imageio.ImageIO;
 | 
				
			||||||
import java.awt.*;
 | 
					import java.awt.*;
 | 
				
			||||||
import java.io.*;
 | 
					import java.io.*;
 | 
				
			||||||
@@ -24,37 +22,32 @@ public class HttpHelper {
 | 
				
			|||||||
        return ImageIO.read(urls);
 | 
					        return ImageIO.read(urls);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Http GET Json string vom Url string
 | 
				
			||||||
 | 
					     * @param url Url als String
 | 
				
			||||||
 | 
					     * @return Json als String
 | 
				
			||||||
 | 
					     * @throws IOException Fehler beim Json holen
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public static String httpGetJsonString(String url) throws IOException {
 | 
					    public static String httpGetJsonString(String url) throws IOException {
 | 
				
			||||||
        HttpURLConnection con = null;
 | 
					        HttpURLConnection con = null;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            var myurl = new URL(url);
 | 
					            var myurl = new URL(url);
 | 
				
			||||||
            con = (HttpURLConnection) myurl.openConnection();
 | 
					            con = (HttpURLConnection) myurl.openConnection();
 | 
				
			||||||
 | 
					 | 
				
			||||||
            con.setRequestMethod("GET");
 | 
					            con.setRequestMethod("GET");
 | 
				
			||||||
 | 
					 | 
				
			||||||
            StringBuilder content;
 | 
					            StringBuilder content;
 | 
				
			||||||
 | 
					 | 
				
			||||||
            try (BufferedReader in = new BufferedReader(
 | 
					            try (BufferedReader in = new BufferedReader(
 | 
				
			||||||
                    new InputStreamReader(con.getInputStream()))) {
 | 
					                    new InputStreamReader(con.getInputStream()))) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                String line;
 | 
					                String line;
 | 
				
			||||||
                content = new StringBuilder();
 | 
					                content = new StringBuilder();
 | 
				
			||||||
 | 
					 | 
				
			||||||
                while ((line = in.readLine()) != null) {
 | 
					                while ((line = in.readLine()) != null) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    content.append(line);
 | 
					                    content.append(line);
 | 
				
			||||||
                    content.append(System.lineSeparator());
 | 
					                    content.append(System.lineSeparator());
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
            return content.toString();
 | 
					            return content.toString();
 | 
				
			||||||
        } finally {
 | 
					        } finally {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            assert con != null;
 | 
					            assert con != null;
 | 
				
			||||||
            con.disconnect();
 | 
					            con.disconnect();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,19 +1,38 @@
 | 
				
			|||||||
package tourplaner.business;
 | 
					package tourplaner.business;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gson.Gson;
 | 
					import com.google.gson.Gson;
 | 
				
			||||||
import com.google.gson.JsonElement;
 | 
					 | 
				
			||||||
import com.google.gson.JsonObject;
 | 
					import com.google.gson.JsonObject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Hilfsklasse für Json (Gson)
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class JsonHelper {
 | 
					public class JsonHelper {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * String aus json extrahieren
 | 
				
			||||||
 | 
					     * @param json Json als String
 | 
				
			||||||
 | 
					     * @param gets Eintrag im Json unter "route"
 | 
				
			||||||
 | 
					     * @return Gesammelter String
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public static String getStingFromJson(String json, String gets){
 | 
					    public static String getStingFromJson(String json, String gets){
 | 
				
			||||||
        return getJObj(json).get("route").getAsJsonObject().get(gets).getAsString();
 | 
					        return getJObj(json).get("route").getAsJsonObject().get(gets).getAsString();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Double aus json extrahieren
 | 
				
			||||||
 | 
					     * @param json Json als String
 | 
				
			||||||
 | 
					     * @param gets Eintrag im Json unter "route"
 | 
				
			||||||
 | 
					     * @return Gesammelter Double Wert
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public static double getDoubleFromJson(String json, String gets){
 | 
					    public static double getDoubleFromJson(String json, String gets){
 | 
				
			||||||
        return getJObj(json).get("route").getAsJsonObject().get(gets).getAsDouble();
 | 
					        return getJObj(json).get("route").getAsJsonObject().get(gets).getAsDouble();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Json String to JsonObject
 | 
				
			||||||
 | 
					     * @param json Json string
 | 
				
			||||||
 | 
					     * @return Neues JsonObject aus String
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private static JsonObject getJObj(String json){
 | 
					    private static JsonObject getJObj(String json){
 | 
				
			||||||
       return new Gson().fromJson(json, JsonObject.class);
 | 
					       return new Gson().fromJson(json, JsonObject.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,17 +3,14 @@ package tourplaner.business;
 | 
				
			|||||||
import com.itextpdf.text.*;
 | 
					import com.itextpdf.text.*;
 | 
				
			||||||
import com.itextpdf.text.Font;
 | 
					import com.itextpdf.text.Font;
 | 
				
			||||||
import com.itextpdf.text.Image;
 | 
					import com.itextpdf.text.Image;
 | 
				
			||||||
import com.sun.scenario.effect.ImageData;
 | 
					 | 
				
			||||||
import tourplaner.object.Log;
 | 
					import tourplaner.object.Log;
 | 
				
			||||||
import tourplaner.object.Tour;
 | 
					import tourplaner.object.Tour;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.itextpdf.text.pdf.PdfPCell;
 | 
					import com.itextpdf.text.pdf.PdfPCell;
 | 
				
			||||||
import com.itextpdf.text.pdf.PdfPTable;
 | 
					import com.itextpdf.text.pdf.PdfPTable;
 | 
				
			||||||
import com.itextpdf.text.pdf.PdfWriter;
 | 
					import com.itextpdf.text.pdf.PdfWriter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.awt.*;
 | 
					import java.awt.*;
 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.io.FileNotFoundException;
 | 
					import java.io.FileNotFoundException;
 | 
				
			||||||
import java.io.FileOutputStream;
 | 
					import java.io.FileOutputStream;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
@@ -21,6 +18,11 @@ import java.util.ArrayList;
 | 
				
			|||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
					 * PDF Report generierung mit iText
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Erstellt Reports über einzelne Touren und fasst alle Touren zusammen
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * iText 4 ist gratis verfügbar, siehe:
 | 
				
			||||||
 * https://github.com/ymasory/iText-4.2.0
 | 
					 * https://github.com/ymasory/iText-4.2.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class Reporter {
 | 
					public class Reporter {
 | 
				
			||||||
@@ -34,6 +36,10 @@ public class Reporter {
 | 
				
			|||||||
    private static Font smallBold = new Font(Font.TIMES_ROMAN, 12,
 | 
					    private static Font smallBold = new Font(Font.TIMES_ROMAN, 12,
 | 
				
			||||||
            Font.BOLD);
 | 
					            Font.BOLD);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt einen Tour Report
 | 
				
			||||||
 | 
					     * @param tourname Name der Tour die Gereportet werden soll
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public static void createTourReport(String tourname)   {
 | 
					    public static void createTourReport(String tourname)   {
 | 
				
			||||||
        Tour tour = TourPlaner.getTour(tourname);
 | 
					        Tour tour = TourPlaner.getTour(tourname);
 | 
				
			||||||
        tour.setLog(TourPlaner.getLogs(tourname));
 | 
					        tour.setLog(TourPlaner.getLogs(tourname));
 | 
				
			||||||
@@ -56,32 +62,36 @@ public class Reporter {
 | 
				
			|||||||
    // Reader
 | 
					    // Reader
 | 
				
			||||||
    // under File -> Properties
 | 
					    // under File -> Properties
 | 
				
			||||||
    private static void addMetaData(Document document, Tour tour) {
 | 
					    private static void addMetaData(Document document, Tour tour) {
 | 
				
			||||||
        document.addTitle("Tour Report -> " + tour.getName());
 | 
					        document.addTitle(ConfigHelper.getLangIniString("tourreportvon") + tour.getName());
 | 
				
			||||||
        document.addSubject("Tourplaner by DerGeorg");
 | 
					        document.addSubject(ConfigHelper.getLangIniString("tourplanervon"));
 | 
				
			||||||
        document.addKeywords("Tourplaner, Tour, Report");
 | 
					        document.addKeywords(ConfigHelper.getLangIniString("reportkeywords"));
 | 
				
			||||||
        document.addAuthor("Tourplaner");
 | 
					        document.addAuthor(ConfigHelper.getLangIniString("tourplaner"));
 | 
				
			||||||
        document.addCreator("Tourplaner");
 | 
					        document.addCreator(ConfigHelper.getLangIniString("tourplaner"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt den inhalt des Reports
 | 
				
			||||||
 | 
					     * @param document Aktuelles Dokument
 | 
				
			||||||
 | 
					     * @param tour Aktuelle Tour
 | 
				
			||||||
 | 
					     * @throws DocumentException Fehler beim hinzufügen des Inhaltes
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private static void addContent(Document document, Tour tour) throws DocumentException {
 | 
					    private static void addContent(Document document, Tour tour) throws DocumentException {
 | 
				
			||||||
        Anchor anchor = new Anchor("Tour Report von -> " + tour.getName(), catFont);
 | 
					        Anchor anchor = new Anchor(ConfigHelper.getLangIniString("tourreportvon") + tour.getName(), catFont);
 | 
				
			||||||
        anchor.setName("Tour Report von -> " + tour.getName());
 | 
					        anchor.setName(ConfigHelper.getLangIniString("tourreportvon") + tour.getName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Second parameter is the number of the chapter
 | 
					        // Second parameter is the number of the chapter
 | 
				
			||||||
        Chapter catPart = new Chapter(new Paragraph(anchor), 1);
 | 
					        Chapter catPart = new Chapter(new Paragraph(anchor), 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Paragraph subPara = new Paragraph("Tour", subFont);
 | 
					        Paragraph subPara = new Paragraph(ConfigHelper.getLangIniString("tour"), subFont);
 | 
				
			||||||
        Section subCatPart = catPart.addSection(subPara);
 | 
					        Section subCatPart = catPart.addSection(subPara);
 | 
				
			||||||
        subCatPart.add(new Paragraph("Report erstellt von: " + System.getProperty("user.name") + ", " + new Date()));
 | 
					        subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("reportvon") + System.getProperty("user.name") + ", " + new Date()));
 | 
				
			||||||
        subCatPart.add(new Paragraph("Startpunkt der Tour: " + tour.getStart()));
 | 
					        subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("reportstart") + tour.getStart()));
 | 
				
			||||||
        subCatPart.add(new Paragraph("Zielpunkt der Tour: " + tour.getZiel()));
 | 
					        subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("reportziel") + tour.getZiel()));
 | 
				
			||||||
        subCatPart.add(new Paragraph("Berechnete Dauer der Tour: " + tour.getDauer()));
 | 
					        subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("reportdauercal") + tour.getDauer()));
 | 
				
			||||||
        subCatPart.add(new Paragraph("Berechnete Strecke der Tour: " + tour.getStrecke()));
 | 
					        subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("reportstreckecal") + tour.getStrecke()));
 | 
				
			||||||
        Paragraph emptyLine = new Paragraph();
 | 
					        Paragraph emptyLine = new Paragraph();
 | 
				
			||||||
        addEmptyLine(emptyLine, 5);
 | 
					        addEmptyLine(emptyLine, 5);
 | 
				
			||||||
        subCatPart.add(emptyLine);
 | 
					        subCatPart.add(emptyLine);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // now add all this to the document
 | 
					        // now add all this to the document
 | 
				
			||||||
        document.add(catPart);
 | 
					        document.add(catPart);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,127 +107,83 @@ public class Reporter {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        ArrayList<Log> logs = tour.getLogs();
 | 
					        ArrayList<Log> logs = tour.getLogs();
 | 
				
			||||||
        // Second parameter is the number of the chapter
 | 
					        // Second parameter is the number of the chapter
 | 
				
			||||||
        anchor = new Anchor("Logs", catFont);
 | 
					        anchor = new Anchor(ConfigHelper.getLangIniString("logs"), catFont);
 | 
				
			||||||
        anchor.setName("Logs");
 | 
					        anchor.setName(ConfigHelper.getLangIniString("logs"));
 | 
				
			||||||
        catPart = new Chapter(new Paragraph(anchor), 2);
 | 
					        catPart = new Chapter(new Paragraph(anchor), 2);
 | 
				
			||||||
        catPart.add(new Paragraph("Anzahl der Logeinträge: " + logs.size()));
 | 
					        catPart.add(new Paragraph(ConfigHelper.getLangIniString("countlog") + logs.size()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (Log log: logs) {
 | 
					        for (Log log: logs) {
 | 
				
			||||||
            subPara = new Paragraph("Log vom: " + log.getDatum() , subFont);
 | 
					            subPara = new Paragraph(ConfigHelper.getLangIniString("logvom") + log.getDatum() , subFont);
 | 
				
			||||||
            subCatPart = catPart.addSection(subPara);
 | 
					            subCatPart = catPart.addSection(subPara);
 | 
				
			||||||
            subCatPart.add(new Paragraph("Dauer: " + log.getDauer()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logdauer") + log.getDauer()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Davon Pause: " + log.getPause()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logpause") + log.getPause()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Davon gegangen: " + log.getGegangen()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("loggegangen") + log.getGegangen()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Berechnete Durchschnittliche Geschwindigkeit: " + log.getAvgspeed()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logavg")+ log.getAvgspeed()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Entfernung: " + log.getStrecke()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logstrecke") + log.getStrecke()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Höhenmeter: " + log.getHightmeter()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("loghight") + log.getHightmeter()));
 | 
				
			||||||
            subCatPart.add(new Paragraph("Bemerkung: " + log.getBemerkung()));
 | 
					            subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + log.getBemerkung()));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // now add all this to the document
 | 
					        // now add all this to the document
 | 
				
			||||||
        document.add(catPart);
 | 
					        document.add(catPart);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static void createTable(Section subCatPart)
 | 
					    /**
 | 
				
			||||||
            throws BadElementException {
 | 
					     * Fügt eine leere zeile an den Paragraph an
 | 
				
			||||||
        PdfPTable table = new PdfPTable(5);
 | 
					     * @param paragraph Hier wird hinzugefügt
 | 
				
			||||||
 | 
					     * @param number Um wie viele Leere Zeilen hinzugefügt werden soll
 | 
				
			||||||
        // 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);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private static void createTable2(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("Dauer"));
 | 
					 | 
				
			||||||
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
 | 
					 | 
				
			||||||
        table.addCell(c1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        c1 = new PdfPCell(new Phrase("Davon Gegangen"));
 | 
					 | 
				
			||||||
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
 | 
					 | 
				
			||||||
        table.addCell(c1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        c1 = new PdfPCell(new Phrase("Davon Pause"));
 | 
					 | 
				
			||||||
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
 | 
					 | 
				
			||||||
        table.addCell(c1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        c1 = new PdfPCell(new Phrase("Bemerkung"));
 | 
					 | 
				
			||||||
        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);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static void addEmptyLine(Paragraph paragraph, int number) {
 | 
					    private static void addEmptyLine(Paragraph paragraph, int number) {
 | 
				
			||||||
        for (int i = 0; i < number; i++) {
 | 
					        for (int i = 0; i < number; i++) {
 | 
				
			||||||
            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);
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								src/tourplaner/object/Data.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/tourplaner/object/Data.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					package tourplaner.object;public class Data {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -481,7 +481,6 @@ public class ViewModel {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public ObservableList<Tour> getTourData() {
 | 
					    public ObservableList<Tour> getTourData() {
 | 
				
			||||||
        tourData.removeAll();
 | 
					        tourData.removeAll();
 | 
				
			||||||
//        ObservableList<Tour> data = ;
 | 
					 | 
				
			||||||
        tourData.addAll(TourPlaner.getAllTours());
 | 
					        tourData.addAll(TourPlaner.getAllTours());
 | 
				
			||||||
        return tourData;
 | 
					        return tourData;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user