code cleanup and ui fixes

This commit is contained in:
Hendrik Schutter 2018-12-06 23:59:01 +01:00
parent 88b39820ca
commit 96d5968fef
13 changed files with 86 additions and 90 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>jFxKasse</artifactId>
<version>0.2.0</version>
<version>0.3.0</version>
<name>jFxKasse</name>
<dependencies>

View File

@ -54,11 +54,13 @@ public class PrintJob
} else {
// printer selected
pc.selectPrinter(xmlc.getPrintername());
/* Single bill or splitted */
if (xmlc.getCategorySplitted()) {
// split the bills
PrintDataSplitted pdsplitted = new PrintDataSplitted(xmlc.getLinebreak(),
xmlc.getOffsetHeader(), xmlc.getOffsetFooter(),
PrintDataSplitted pdsplitted = new PrintDataSplitted(
xmlc.getLinebreak(), xmlc.getOffsetHeader(),
xmlc.getOffsetFooter(),
timedate.getSystemTime() + " " + timedate.getSystemDate(),
xmlc.getHeader(), xmlc.getFooter());
@ -67,7 +69,6 @@ public class PrintJob
dbc.getValue_Job(jobID), dbc.getCategory_Job(jobID),
dbc.getJobValue_Job(jobID));
System.out.println("Printing job ...");
ArrayList<String> printString = pdsplitted.getPrintStrings();

View File

@ -6,7 +6,6 @@ import java.util.Date;
public class TimeDate
{
public String getSystemTime()
{
DateFormat dateFormat = new SimpleDateFormat("HH:mm");
@ -22,5 +21,4 @@ public class TimeDate
String dateStr = dateFormat.format(date);
return dateStr;
}
}

View File

@ -378,7 +378,7 @@ public class MainWindowController
// creates a dialog
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("Über jFxKasse");
dialog.setHeaderText("Informationen und Lizenzen - Version 0.2");
dialog.setHeaderText("Informationen und Lizenzen - Version 0.3.0");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);

View File

@ -89,7 +89,6 @@ public class PrinterController implements Printable
*/
public void printString(String text)
{
PrintService service = selectedPrinter;
DocPrintJob job = service.createPrintJob();

View File

@ -9,7 +9,6 @@ import java.util.Properties;
public class XMLController
{
private String databaseName = null;
private String printername = null;

View File

@ -2,7 +2,6 @@ package com.jFxKasse.datatypes;
public class Category
{
private String categoryName;
private String positionsString = "\n";
@ -12,27 +11,22 @@ public class Category
this.categoryName = categoryName;
}
// public void setCategoryName(String categoryName) {
// this.categoryName = categoryName;
// }
public String getCategoryName()
{
return categoryName;
}
public void addPosition(int quantity, String name, String value, PrintData pd)
public void addPosition(int quantity, String name, String value,
PrintData pd)
{
//positionenString = pd.setRight(pd.breakLines(name), value + "") + "\n";
for (int i = 0; i < quantity; i++) {
positionsString = positionsString
+ pd.setRight(pd.breakLines(name), value + "") + "\n";
}
}
public String getPositionsString() {
public String getPositionsString()
{
return positionsString;
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
public class Job
{
private int jobnumber;
private float jobvalue;
@ -55,13 +54,10 @@ public class Job
public void addPosition(String pPositionenName, float pPositionenValue,
String pPositionenCat)
{
// System.out.println("addName");
for (int i = 0; i < positionenName.size(); i++) {
if (positionenName.get(i).equals(pPositionenName)) {
// Item is already in list, increase quantity
positionenQuantity.set(i, positionenQuantity.get(i) + 1);
// System.out.println("Item exists, increasing quantity");
return;
}
}
@ -76,24 +72,15 @@ public class Job
public void printJobOnConsole()
{
System.out.println("---------------------------------------------");
System.out.println("JobNummer: " + jobnumber);
System.out.println("---------------------------------------------");
// System.out.println("Größe: " + positionenName.size());
for (int i = 0; i < positionenName.size(); i++) {
System.out.println(
positionenQuantity.get(i) + " " + positionenName.get(i) + " "
+ positionenValue.get(i) + " " + positionenCat.get(i));
/*
* System.out.println("i is: " + i);
* System.out.println(positionenName.get(i));
* System.out.println(positionenQuantity.get(i));
*/
}
System.out.println("---------------------------------------------");
@ -102,7 +89,6 @@ public class Job
public ArrayList<tableDataCurrentOrder> getCurrentJobPositionen()
{
ArrayList<tableDataCurrentOrder> jobitems = new ArrayList<tableDataCurrentOrder>();
for (int i = 0; i < positionenName.size(); i++) {
@ -111,24 +97,18 @@ public class Job
positionenName.get(i), positionenQuantity.get(i));
jobitems.add(tmp);
}
return jobitems;
}
private void calcJobValue()
{
jobvalue = 0;
for (int i = 0; i < positionenValue.size(); i++) {
jobvalue = jobvalue
+ (positionenQuantity.get(i) * positionenValue.get(i));
}
}
public String createPosQuantityDBString()

View File

@ -103,7 +103,6 @@ public abstract class PrintData
// data string not long enough
next = false;
}
}
// add the last part
return tmp + "\n" + data.substring(count);

View File

@ -127,9 +127,9 @@ public class PrintDataSplitted extends PrintData
/* Footer */
footer = setCenter(this.footer);
footer = "\n";
for (int o = 1; o < footerSpace; o++) {
for (int o = 2; o < footerSpace; o++) {
footer = footer + "\n";
}
footer = footer + "_";
@ -137,8 +137,8 @@ public class PrintDataSplitted extends PrintData
thisBill = header + "\n" + getSeparator() + "\n" + info + "\n"
+ getSeparator() + "\n"
+ setCenter(categories.get(i).getCategoryName()) + "\n"
+ getSeparator() +
positions + "\n" + getSeparator();
+ getSeparator() + positions + "\n" + getSeparator() + "\n"
+ footer;
printString.add(thisBill);

View File

@ -16,7 +16,6 @@ public class tableDataCurrentOrder
{
this.position.set(pPosition);
this.quantity.set(pQuantity);
}
public StringProperty positionProperty()

View File

@ -27,7 +27,10 @@
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<Button fx:id="ueberbtn" layoutX="84.0" layoutY="79.0" mnemonicParsing="false" onAction="#ueberbtnAction" prefHeight="0.0" prefWidth="46.0" text="Über" />
<Button fx:id="ueberbtn" layoutX="273.0" layoutY="448.0" mnemonicParsing="false" onAction="#ueberbtnAction" prefHeight="35.0" prefWidth="324.0" text="Informationen über jFxKasse">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></Button>
<TitledPane alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="790.0" layoutY="10.0" prefHeight="270.0" prefWidth="566.0" text="Datenbank Einstellungen">
<content>
<AnchorPane fx:id="paneDB" minHeight="0.0" minWidth="0.0" prefHeight="238.0" prefWidth="564.0">
@ -37,7 +40,10 @@
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewDBName" alignment="CENTER" layoutX="25.0" layoutY="10.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftNewDBName" alignment="CENTER" layoutX="25.0" layoutY="10.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<Label fx:id="labelDBStatus" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="1.0" layoutY="75.0" prefHeight="34.0" prefWidth="551.0" text="Keine Datenbank gefunden!">
<font>
<Font name="Cantarell Regular" size="18.0" />
@ -89,11 +95,26 @@
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftKat01" alignment="CENTER" layoutX="50.0" layoutY="5.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftKat02" alignment="CENTER" layoutX="50.0" layoutY="45.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftKat03" alignment="CENTER" layoutX="50.0" layoutY="85.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftKat04" alignment="CENTER" layoutX="50.0" layoutY="125.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftKat05" alignment="CENTER" layoutX="50.0" layoutY="165.0" prefHeight="25.0" prefWidth="376.0" />
<JFXTextField fx:id="tftKat01" alignment="CENTER" layoutX="50.0" layoutY="5.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<JFXTextField fx:id="tftKat02" alignment="CENTER" layoutX="50.0" layoutY="45.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<JFXTextField fx:id="tftKat03" alignment="CENTER" layoutX="50.0" layoutY="85.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<JFXTextField fx:id="tftKat04" alignment="CENTER" layoutX="50.0" layoutY="125.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<JFXTextField fx:id="tftKat05" alignment="CENTER" layoutX="50.0" layoutY="165.0" prefHeight="25.0" prefWidth="376.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<Button fx:id="btnSaveCat" layoutX="200.0" layoutY="204.0" mnemonicParsing="false" onAction="#btnSaveCatAction" text="Kategorien speichern">
<font>
<Font name="Cantarell Regular" size="13.0" />
@ -110,9 +131,12 @@
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="327.0" prefWidth="564.0">
<children>
<ChoiceBox fx:id="printerChoise" layoutX="298.0" layoutY="10.0" prefWidth="150.0" />
<ChoiceBox fx:id="printerChoise" layoutX="270.0" layoutY="10.0" prefHeight="25.0" prefWidth="178.0" />
<Spinner fx:id="linesSpinner" layoutX="35.0" layoutY="10.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="92.0" />
<JFXTextField fx:id="tftheader" alignment="CENTER" layoutX="65.0" layoutY="90.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="377.0" />
<JFXTextField fx:id="tftheader" alignment="CENTER" layoutX="65.0" layoutY="90.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="377.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
<JFXToggleButton fx:id="switchSeparate" layoutX="270.0" layoutY="170.0" text="Kategorien separat drucken">
<font>
<Font name="Cantarell Regular" size="18.0" />
@ -155,7 +179,10 @@
</Button>
<Spinner fx:id="offsetHeaderSpinner" layoutX="324.0" layoutY="48.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="92.0" />
<Spinner fx:id="offsetFooterSpinner" layoutX="35.0" layoutY="48.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="92.0" />
<JFXTextField fx:id="tftfooter" alignment="CENTER" layoutX="65.0" layoutY="130.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="377.0" />
<JFXTextField fx:id="tftfooter" alignment="CENTER" layoutX="65.0" layoutY="130.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="377.0">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font></JFXTextField>
</children>
</AnchorPane>
</content>
@ -186,52 +213,52 @@
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TreeTableView>
<Button fx:id="btnSaveEntry" layoutX="494.0" layoutY="631.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
<Button fx:id="btnClearEntry" layoutX="232.0" layoutY="590.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<Button fx:id="btnClearEntry" layoutX="462.0" layoutY="525.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<TitledPane fx:id="titledPaneEntry" alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="792.0" layoutY="525.0" prefHeight="163.0" prefWidth="565.0" text="Eintrag editieren">
<TitledPane fx:id="titledPaneEntry" alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="724.0" layoutY="525.0" prefHeight="163.0" prefWidth="633.0" text="Eintrag editieren">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="135.0" prefWidth="640.0">
<children>
<Label fx:id="labelNewPosition" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Position:">
<Label fx:id="labelNewPosition" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="516.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Position:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.0">
<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="307.0" layoutY="8.0" prefHeight="27.0" prefWidth="203.0">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
</JFXTextField>
<Label fx:id="labelNewValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="442.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:">
<Label fx:id="labelNewValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="504.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewValue" alignment="CENTER" labelFloat="true" layoutX="380.0" layoutY="50.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="58.0">
<JFXTextField fx:id="tftNewValue" alignment="CENTER" labelFloat="true" layoutX="442.0" layoutY="42.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="27.0" prefWidth="66.0">
<font>
<Font name="Cantarell Regular" size="13.0" />
<Font name="Cantarell Regular" size="18.0" />
</font>
</JFXTextField>
<Label fx:id="labelNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
<Label fx:id="labelNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="517.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<ChoiceBox fx:id="colorChoise" layoutX="346.0" layoutY="90.0" prefHeight="25.0" prefWidth="96.0" />
<Label fx:id="labelSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="204.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:">
<ChoiceBox fx:id="colorChoise" layoutX="340.0" layoutY="90.0" prefHeight="25.0" prefWidth="169.0" />
<Label fx:id="labelSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="185.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<ChoiceBox fx:id="catChoise" layoutX="25.0" layoutY="90.0" prefHeight="25.0" prefWidth="180.0" />
<ChoiceBox fx:id="catChoise" layoutX="16.0" layoutY="10.0" prefHeight="25.0" prefWidth="180.0" />
<Button fx:id="btnSaveEntry" layoutX="23.0" layoutY="86.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
</children>
</AnchorPane>
</content>
@ -305,7 +332,7 @@
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0">
<children>
<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="379.0" prefWidth="382.0">
<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="358.0" prefWidth="382.0">
<placeholder>
<Label text="" />
</placeholder>
@ -460,17 +487,17 @@
</JFXButton>
</children>
</GridPane>
<Button fx:id="btnPrintBill" contentDisplay="CENTER" defaultButton="true" graphicTextGap="1.0" layoutX="75.0" layoutY="599.0" maxHeight="88.0" minHeight="75.0" mnemonicParsing="false" onAction="#btnPrintBillAction" prefHeight="88.0" prefWidth="258.0" text="Drucken" textAlignment="CENTER" wrapText="true">
<Button fx:id="btnPrintBill" contentDisplay="CENTER" defaultButton="true" graphicTextGap="1.0" layoutX="75.0" layoutY="588.0" maxHeight="88.0" minHeight="75.0" mnemonicParsing="false" onAction="#btnPrintBillAction" prefHeight="88.0" prefWidth="258.0" text="Drucken" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Cantarell Bold" size="48.0" />
</font>
</Button>
<Button fx:id="btnDeleteSelectedPosition" layoutX="43.0" layoutY="475.0" mnemonicParsing="false" onAction="#btnDeleteSelectedPositionAction" prefHeight="17.0" prefWidth="332.0" text="Ausgewählte Position löschen" textAlignment="CENTER">
<Button fx:id="btnDeleteSelectedPosition" layoutX="43.0" layoutY="458.0" mnemonicParsing="false" onAction="#btnDeleteSelectedPositionAction" prefHeight="17.0" prefWidth="332.0" text="Ausgewählte Position löschen" textAlignment="CENTER">
<font>
<Font name="Cantarell Regular" size="20.0" />
</font>
</Button>
<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="511.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER">
<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="496.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER">
<font>
<Font name="Cantarell Regular" size="70.0" />
</font>