From 25bedae87318e59615ce8c12179aee120a5e56e2 Mon Sep 17 00:00:00 2001 From: localhorst Date: Thu, 6 Dec 2018 20:44:54 +0100 Subject: [PATCH] scroll bar is now on right side --- .../jFxKasse/datatypes/PrintDataSplitted.java | 93 +++++++++++++++++++ src/main/resources/fxml/MainWindow.fxml | 22 ++--- 2 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/jFxKasse/datatypes/PrintDataSplitted.java diff --git a/src/main/java/com/jFxKasse/datatypes/PrintDataSplitted.java b/src/main/java/com/jFxKasse/datatypes/PrintDataSplitted.java new file mode 100644 index 0000000..aec4e04 --- /dev/null +++ b/src/main/java/com/jFxKasse/datatypes/PrintDataSplitted.java @@ -0,0 +1,93 @@ +package com.jFxKasse.datatypes; + +public class PrintDataSplitted extends PrintData +{ + + private String printString; + + /** + * Constructor with all data that is not in the DB + * @param lineBreak + * @param headerSpace + * @param footerSpace + * @param timeAndDatePrint + * @param header + * @param footer + */ + public PrintDataSplitted(int lineBreak, int headerSpace, int footerSpace, + String timeAndDatePrint, String header, String footer) + { + super(lineBreak, headerSpace, footerSpace, timeAndDatePrint, header, + footer); + } + + /** + * Generates the String + * @return the final Print String + */ + public String getPrintString() + { + generatePrintString(); + return this.printString; + } + + @Override + protected void generatePrintString() + { + /* Header */ + String header = "\n"; + for (int i = 1; i < headerSpace; i++) { + header = header + "\n"; + } + + // This is the final header + header = header + setCenter(this.header); + + /* Info */ + + String info = setRight("Bestellung: ", timeAndDateOrder) + "\n" + + setRight("Druck: ", timeAndDatePrint) + "\n" + + setRight("Bestellnummer: ", jobID); + + /* Positionen */ + + String positionen = "\n"; + + int posCount = positionenQuantity.length() + - positionenQuantity.replace(";", "").length() + 1; + + String[] positionQuantity = positionenQuantity.split(";"); + + String[] positionName = positionenName.split(";"); + + String[] positionValue = positionenValue.split(";"); + + for (int i = 0; i < posCount; i++) { //All different posNames + int quantity = Integer.parseInt(positionQuantity[i]); + for (int j = 0; j < quantity; j++) { //quantities + positionen = positionen + setRight(breakLines(positionName[i]), + positionValue[i] + " €") + "\n"; + } + } + + /* Price */ + + String price = setRight("Gesamt: ", (jobValue + " €")); + + /* Footer */ + + String footer = setCenter(this.footer); + + for (int i = 1; i < footerSpace; i++) { + footer = footer + "\n"; + } + footer = footer + "_"; + + /* Build final Print String */ + + printString = header + "\n" + getSeparator() + "\n" + info + "\n" + + getSeparator() + "\n" + positionen + "\n" + getSeparator() + "\n" + + price + "\n" + getSeparator() + "\n" + footer; + } + +} diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index c9a883d..8e324bb 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -171,16 +171,16 @@ - + - - - - + + + + @@ -247,16 +247,16 @@ - + - - - - - + + + + +