Import Bugfix + Report add rating + readme + edit tour bugfix + add wait cursor
This commit is contained in:
parent
f2aa9576ba
commit
d92f538129
@ -1,4 +1,6 @@
|
|||||||
# 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
|
||||||
|
@ -50,19 +50,25 @@ public class Exporter {
|
|||||||
try {
|
try {
|
||||||
ArrayList<Tour> 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.addProgress(5);
|
progressBar.addProgress(2);
|
||||||
int size = progressBar.getProgressSize(touren.size() * 3, 100);
|
int size = progressBar.getProgressSize(allTours.size(), 25);
|
||||||
|
allTours.forEach(t -> {
|
||||||
|
TourPlaner.delTour(t.getName());
|
||||||
|
progressBar.addProgress(size);
|
||||||
|
});
|
||||||
|
|
||||||
|
int finalSize = progressBar.getProgressSize(touren.size() * 3, 100);
|
||||||
for (Tour tour: touren) {
|
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);
|
||||||
|
@ -40,6 +40,7 @@ public class Reporter {
|
|||||||
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();
|
||||||
@ -173,6 +174,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);
|
||||||
|
@ -59,14 +59,9 @@ 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;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -147,7 +147,7 @@ public class DbConnect {
|
|||||||
|
|
||||||
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){
|
||||||
|
@ -28,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);
|
||||||
|
@ -506,8 +506,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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user