code cleanup and cross platform
This commit is contained in:
parent
dd9ff0d410
commit
a7b2753aa3
|
@ -1,12 +1,10 @@
|
||||||
package com.jFxKasse.application;
|
package com.jFxKasse.application;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import javafx.animation.Animation;
|
import javafx.animation.Animation;
|
||||||
import javafx.animation.KeyFrame;
|
import javafx.animation.KeyFrame;
|
||||||
import javafx.animation.Timeline;
|
import javafx.animation.Timeline;
|
||||||
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
@ -19,16 +17,19 @@ import javafx.scene.layout.AnchorPane;
|
||||||
|
|
||||||
public class Main extends Application
|
public class Main extends Application
|
||||||
{
|
{
|
||||||
|
// path to config.xml and the database
|
||||||
|
public static String filepath;
|
||||||
|
|
||||||
private String filepathXMLLinux = System.getProperty("user.home")
|
private static String osName = System.getProperty("os.name");
|
||||||
+ "/bin/jFxKasse/config.xml"; // Pfad wo die XML liegt
|
|
||||||
|
private static String userHome = System.getProperty("user.home");
|
||||||
|
|
||||||
private MainWindowController mwc;
|
private MainWindowController mwc;
|
||||||
|
|
||||||
private XMLController xmlc = new XMLController(filepathXMLLinux);
|
private XMLController xmlc = new XMLController(filepath);
|
||||||
|
|
||||||
|
private DBController dbc = new DBController(filepath);
|
||||||
|
|
||||||
private DBController dbc = new DBController(this);
|
|
||||||
|
|
||||||
private PrinterController pc = new PrinterController();
|
private PrinterController pc = new PrinterController();
|
||||||
|
|
||||||
private Stage primaryStage;
|
private Stage primaryStage;
|
||||||
|
@ -37,26 +38,26 @@ public class Main extends Application
|
||||||
public void start(Stage primaryStage)
|
public void start(Stage primaryStage)
|
||||||
{
|
{
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
|
System.out.println("\nstarting jFxKasse\n");
|
||||||
System.out.println("Hallo Welt");
|
|
||||||
mainWindow();
|
mainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mainWindow()
|
private void mainWindow()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
FXMLLoader loader = new FXMLLoader(
|
FXMLLoader loader = new FXMLLoader(
|
||||||
getClass().getResource("/fxml/MainWindow.fxml"));
|
getClass().getResource("/fxml/MainWindow.fxml"));
|
||||||
|
|
||||||
AnchorPane pane = loader.load();
|
AnchorPane pane = loader.load();
|
||||||
primaryStage.setTitle("jFxKasse"); // Title of window
|
primaryStage.setTitle("jFxKasse"); // Title of window
|
||||||
|
|
||||||
mwc = loader.getController();
|
mwc = loader.getController(); // set the mwc as the JavaFx
|
||||||
pc.searchPrinters();
|
// MainWindowController
|
||||||
mwc.setMain(this, dbc, xmlc, pc);
|
pc.searchPrinters(); // search for available printers
|
||||||
|
mwc.setMain(this, dbc, xmlc, pc); // set the created instances to the
|
||||||
|
// mwc
|
||||||
|
|
||||||
firstStart();
|
firstStart(); // test if this is the first run
|
||||||
|
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
scene.getStylesheets().add(
|
scene.getStylesheets().add(
|
||||||
|
@ -66,7 +67,7 @@ public class Main extends Application
|
||||||
|
|
||||||
Timeline timeline = new Timeline(
|
Timeline timeline = new Timeline(
|
||||||
new KeyFrame(Duration.seconds(1), ev -> {
|
new KeyFrame(Duration.seconds(1), ev -> {
|
||||||
mwc.updateTimeLabel(); // update time
|
mwc.updateTimeLabel(); // update time label on UI
|
||||||
}));
|
}));
|
||||||
timeline.setCycleCount(Animation.INDEFINITE);
|
timeline.setCycleCount(Animation.INDEFINITE);
|
||||||
timeline.play();
|
timeline.play();
|
||||||
|
@ -77,18 +78,23 @@ public class Main extends Application
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
if (osName.contains("Windows")) {
|
||||||
|
System.out.println("FCK Windows");
|
||||||
|
filepath = userHome + "/Documents/jFxKasse/";
|
||||||
|
} else {
|
||||||
|
filepath = userHome + "/jFxKasse/";
|
||||||
|
}
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the config.xml is preset.
|
* Checks if the config.xml is preset.
|
||||||
* @author hendrik
|
|
||||||
*/
|
*/
|
||||||
private void firstStart() throws Exception
|
private void firstStart() throws Exception
|
||||||
{
|
{
|
||||||
if (xmlc.loadSettings()) {
|
if (xmlc.loadSettings()) {
|
||||||
// config.xml found, app starting normal
|
// config.xml found, app starting normal
|
||||||
System.out.println("XML gefunden!");
|
System.out.println("XML found!");
|
||||||
mwc.initUI(); // Starting the UI elements
|
mwc.initUI(); // Starting the UI elements
|
||||||
mwc.setDBLabel(); // Set databese labels
|
mwc.setDBLabel(); // Set databese labels
|
||||||
dbc.setDbname(xmlc.getDatabaseName()); // handover database name
|
dbc.setDbname(xmlc.getDatabaseName()); // handover database name
|
||||||
|
@ -102,13 +108,12 @@ public class Main extends Application
|
||||||
mwc.createNewJob();
|
mwc.createNewJob();
|
||||||
} else {
|
} else {
|
||||||
// config.xml NOT found, first start of app
|
// config.xml NOT found, first start of app
|
||||||
System.out.println("keine XML gefunden!");
|
System.out.println("no XML found!");
|
||||||
xmlc.initXML(); // set default values
|
xmlc.initXML(); // set default values
|
||||||
mwc.blockUI(true); // disable UI elements that need DB
|
mwc.blockUI(true); // disable UI elements that need DB
|
||||||
mwc.blockUnlock();
|
mwc.blockUnlock();
|
||||||
File dir = new File(System.getProperty("user.home") + "/bin/jFxKasse");
|
File dir = new File(filepath);
|
||||||
dir.mkdir(); // Create new Subfolder
|
dir.mkdir(); // Create new Subfolder
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,43 +7,34 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.jFxKasse.application.Main;
|
|
||||||
import com.jFxKasse.datatypes.tableDataJob;
|
import com.jFxKasse.datatypes.tableDataJob;
|
||||||
import com.jFxKasse.datatypes.tableDataPositionen;
|
import com.jFxKasse.datatypes.tableDataPositionen;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class DBController
|
public class DBController
|
||||||
{
|
{
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
private String DB_PATH_Linux = System.getProperty("user.home")
|
private String DB_PATH;
|
||||||
+ "/bin/jFxKasse/";
|
|
||||||
|
|
||||||
private String dbname;
|
private String dbname;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private Main main;
|
|
||||||
|
|
||||||
public void main()
|
public void main()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
connection = DriverManager
|
connection = DriverManager
|
||||||
.getConnection("jdbc:sqlite:" + DB_PATH_Linux + dbname + ".db");
|
.getConnection("jdbc:sqlite:" + DB_PATH + dbname + ".db");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBController(Main main)
|
public DBController(String path)
|
||||||
{
|
{
|
||||||
this.main = main;
|
this.DB_PATH = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDbname(String dbname)
|
public void setDbname(String dbname)
|
||||||
{
|
{
|
||||||
this.dbname = dbname;
|
this.dbname = dbname;
|
||||||
|
@ -51,14 +42,14 @@ public class DBController
|
||||||
|
|
||||||
public void connectDatabase()
|
public void connectDatabase()
|
||||||
{ // connect to database
|
{ // connect to database
|
||||||
System.out.println("Verbinde ... DB name: " + dbname);
|
System.out.println("Connecting... DB name: " + dbname);
|
||||||
try {
|
try {
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
return;
|
return;
|
||||||
connection = DriverManager
|
connection = DriverManager
|
||||||
.getConnection("jdbc:sqlite:" + DB_PATH_Linux + dbname + ".db");
|
.getConnection("jdbc:sqlite:" + DB_PATH + dbname + ".db");
|
||||||
if (!connection.isClosed())
|
if (!connection.isClosed())
|
||||||
System.out.println("DB Datei-Verbindung erstellt");
|
System.out.println("DB connection established");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -78,8 +69,8 @@ public class DBController
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean existiertDatenbank(String pPfad)
|
public boolean existDB(String pPfad)
|
||||||
{ // Prüft ob die Datenbank existiert
|
{ // does the DB exists?
|
||||||
File varTmpDir = new File(pPfad);
|
File varTmpDir = new File(pPfad);
|
||||||
if (!varTmpDir.exists()) {
|
if (!varTmpDir.exists()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -90,10 +81,7 @@ public class DBController
|
||||||
|
|
||||||
public String getCategoryNameFromPositionen(int pID)
|
public String getCategoryNameFromPositionen(int pID)
|
||||||
{
|
{
|
||||||
// System.out.println("getCategoryName: " + pID);
|
|
||||||
|
|
||||||
int catInPos = 0;
|
int catInPos = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT posid, cat FROM positionen "
|
ResultSet rs = stmt.executeQuery("SELECT posid, cat FROM positionen "
|
||||||
|
@ -104,11 +92,9 @@ public class DBController
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (catInPos == 6) {
|
if (catInPos == 6) {
|
||||||
return "Standard";
|
return "Standard";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT catid, catname FROM category "
|
ResultSet rs = stmt.executeQuery("SELECT catid, catname FROM category "
|
||||||
|
@ -125,7 +111,7 @@ public class DBController
|
||||||
// table Position section //
|
// table Position section //
|
||||||
public void createTablePositionen()
|
public void createTablePositionen()
|
||||||
{ // create table position
|
{ // create table position
|
||||||
System.out.println("Erstelle Tabelle Positionen");
|
System.out.println("Creating table Positionen");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("DROP TABLE IF EXISTS positionen;");
|
stmt.executeUpdate("DROP TABLE IF EXISTS positionen;");
|
||||||
|
@ -146,7 +132,7 @@ public class DBController
|
||||||
public void fillPositionen_Positionen(int pID, String pName, float pValue,
|
public void fillPositionen_Positionen(int pID, String pName, float pValue,
|
||||||
int pCat, String pColor)
|
int pCat, String pColor)
|
||||||
{ // create new data in table
|
{ // create new data in table
|
||||||
System.out.println("Erstelle neuen positionen eintrag");
|
System.out.println("Creating new positionen entry");
|
||||||
try {
|
try {
|
||||||
PreparedStatement ps = connection.prepareStatement(
|
PreparedStatement ps = connection.prepareStatement(
|
||||||
"INSERT INTO positionen VALUES (?, ?, ?, ?, ?);");
|
"INSERT INTO positionen VALUES (?, ?, ?, ?, ?);");
|
||||||
|
@ -167,7 +153,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName_Positionen(int pID)
|
public String getName_Positionen(int pID)
|
||||||
{ // Gibt das Datum zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -181,7 +167,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue_Positionen(int pID)
|
public String getValue_Positionen(int pID)
|
||||||
{ // Gibt das Konto zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -196,7 +182,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCat_Positionen(int pID)
|
public int getCat_Positionen(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -211,7 +197,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColor_Positionen(int pID)
|
public String getColor_Positionen(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -226,7 +212,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName_Positionen(int pID, String pName)
|
public void setName_Positionen(int pID, String pName)
|
||||||
{ // Setzt das Datum
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE positionen SET name = '" + pName
|
stmt.executeUpdate("UPDATE positionen SET name = '" + pName
|
||||||
|
@ -238,7 +224,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue_Positionen(int pID, String pValue)
|
public void setValue_Positionen(int pID, String pValue)
|
||||||
{ // Setzt das Konto
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE positionen SET value = '" + pValue
|
stmt.executeUpdate("UPDATE positionen SET value = '" + pValue
|
||||||
|
@ -250,7 +236,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCat_Positionen(int pID, int pCat)
|
public void setCat_Positionen(int pID, int pCat)
|
||||||
{ // Setzt den Nutzername
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE positionen SET cat = '" + pCat
|
stmt.executeUpdate("UPDATE positionen SET cat = '" + pCat
|
||||||
|
@ -262,7 +248,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor_Positionen(int pID, String pColor)
|
public void setColor_Positionen(int pID, String pColor)
|
||||||
{ // Setzt den Nutzername
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE positionen SET color = '" + pColor
|
stmt.executeUpdate("UPDATE positionen SET color = '" + pColor
|
||||||
|
@ -274,14 +260,13 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<tableDataPositionen> ladeTabellePositionen()
|
public ArrayList<tableDataPositionen> ladeTabellePositionen()
|
||||||
{ // Gibt ein Objekt daten mit allen Einträgen der DB zurück
|
{
|
||||||
ArrayList<tableDataPositionen> daten = new ArrayList<>();
|
ArrayList<tableDataPositionen> daten = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM positionen;");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM positionen;");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
try {
|
try {
|
||||||
// Entschlüsselte Daten werden als Datenobjekt gespeichert
|
|
||||||
daten.add(new tableDataPositionen(rs.getInt("posid"),
|
daten.add(new tableDataPositionen(rs.getInt("posid"),
|
||||||
rs.getString("name"), rs.getString("value"),
|
rs.getString("name"), rs.getString("value"),
|
||||||
rs.getString("cat"), rs.getString("color")));
|
rs.getString("cat"), rs.getString("color")));
|
||||||
|
@ -298,7 +283,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ausgebenSysoPositionen()
|
public void ausgebenSysoPositionen()
|
||||||
{ // Debugging Ausgabe der kompletten Tabelle
|
{
|
||||||
System.out.println("Print positionen");
|
System.out.println("Print positionen");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
|
@ -339,7 +324,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName_Category(int pID, String pName)
|
public void setName_Category(int pID, String pName)
|
||||||
{ // Setzte den Namen
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE category SET catname = '" + pName
|
stmt.executeUpdate("UPDATE category SET catname = '" + pName
|
||||||
|
@ -371,7 +356,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName_Category(int pID)
|
public String getName_Category(int pID)
|
||||||
{ // Gibt das Datum zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -387,8 +372,8 @@ public class DBController
|
||||||
|
|
||||||
// table Jobs section //
|
// table Jobs section //
|
||||||
public void erstelleTabelleJobs()
|
public void erstelleTabelleJobs()
|
||||||
{ // Erstelle Tabelle mit Reihen
|
{ // create table jobs
|
||||||
System.out.println("Erstelle Tabelle Jobs");
|
System.out.println("Creating table Jobs");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("DROP TABLE IF EXISTS jobs;");
|
stmt.executeUpdate("DROP TABLE IF EXISTS jobs;");
|
||||||
|
@ -402,7 +387,6 @@ public class DBController
|
||||||
|
|
||||||
public int getLatestJobNumber_Job()
|
public int getLatestJobNumber_Job()
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -414,11 +398,10 @@ public class DBController
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime_Job(int pID)
|
public String getTime_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -432,7 +415,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuantity_Job(int pID)
|
public String getQuantity_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -447,7 +430,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName_Job(int pID)
|
public String getName_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -462,7 +445,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue_Job(int pID)
|
public String getValue_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -477,7 +460,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategory_Job(int pID)
|
public String getCategory_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -492,7 +475,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getState_Job(int pID)
|
public String getState_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -506,7 +489,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJobValue_Job(int pID)
|
public String getJobValue_Job(int pID)
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -520,7 +503,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAllJobValue_Job()
|
public String getAllJobValue_Job()
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
|
@ -533,14 +516,14 @@ public class DBController
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJobCount()
|
public String getJobCount()
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(
|
ResultSet rs = stmt.executeQuery(
|
||||||
"SELECT count(*) AS JOBCOUNT FROM jobs WHERE state = "
|
"SELECT count(*) AS JOBCOUNT FROM jobs WHERE state = " + '"'
|
||||||
+ '"' + "verbucht" + '"' + ";");
|
+ "verbucht" + '"' + ";");
|
||||||
return rs.getString("JOBCOUNT");
|
return rs.getString("JOBCOUNT");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.err.println("Couldn't handle DB-Query");
|
System.err.println("Couldn't handle DB-Query");
|
||||||
|
@ -548,12 +531,9 @@ public class DBController
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setStatus_Jobs(int pID, String pStatus)
|
public void setStatus_Jobs(int pID, String pStatus)
|
||||||
{ // Setzt das Konto
|
{
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE jobs SET state = '" + pStatus
|
stmt.executeUpdate("UPDATE jobs SET state = '" + pStatus
|
||||||
|
@ -565,7 +545,7 @@ public class DBController
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<tableDataJob> loadTableJobs_Job()
|
public ArrayList<tableDataJob> loadTableJobs_Job()
|
||||||
{ // Gibt den Nutzernamen zurück
|
{
|
||||||
|
|
||||||
ArrayList<tableDataJob> tmp = new ArrayList<tableDataJob>();
|
ArrayList<tableDataJob> tmp = new ArrayList<tableDataJob>();
|
||||||
try {
|
try {
|
||||||
|
@ -575,8 +555,6 @@ public class DBController
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// return rs.getString("jobvalue");
|
|
||||||
|
|
||||||
String tablePosition = rs.getString("positionen_name");
|
String tablePosition = rs.getString("positionen_name");
|
||||||
|
|
||||||
tableDataJob data = new tableDataJob(rs.getInt("jobid"),
|
tableDataJob data = new tableDataJob(rs.getInt("jobid"),
|
||||||
|
@ -600,7 +578,6 @@ public class DBController
|
||||||
String pPositionen_name, String pPositionen_value,
|
String pPositionen_name, String pPositionen_value,
|
||||||
String pPositionen_cat, String pState, String pJobvalue)
|
String pPositionen_cat, String pState, String pJobvalue)
|
||||||
{
|
{
|
||||||
|
|
||||||
System.out.println("Create new Job Entry");
|
System.out.println("Create new Job Entry");
|
||||||
try {
|
try {
|
||||||
PreparedStatement ps = connection.prepareStatement(
|
PreparedStatement ps = connection.prepareStatement(
|
||||||
|
@ -621,7 +598,5 @@ public class DBController
|
||||||
System.err.println("Couldn't handle DB-Query");
|
System.err.println("Couldn't handle DB-Query");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.jFxKasse.controller;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.control.Dialog;
|
import javafx.scene.control.Dialog;
|
||||||
|
@ -14,22 +12,12 @@ import javafx.scene.control.TreeItem;
|
||||||
import javafx.scene.control.TitledPane;
|
import javafx.scene.control.TitledPane;
|
||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
import javafx.scene.control.ChoiceBox;
|
import javafx.scene.control.ChoiceBox;
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.Desktop;
|
||||||
import java.io.FileInputStream;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.swing.plaf.synth.SynthSpinnerUI;
|
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
import com.jfoenix.controls.JFXToggleButton;
|
import com.jfoenix.controls.JFXToggleButton;
|
||||||
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
@ -38,7 +26,6 @@ import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.Spinner;
|
import javafx.scene.control.Spinner;
|
||||||
import javafx.scene.control.SpinnerValueFactory;
|
import javafx.scene.control.SpinnerValueFactory;
|
||||||
import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory;
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
|
@ -50,15 +37,9 @@ import com.jFxKasse.datatypes.Job;
|
||||||
import com.jFxKasse.datatypes.tableDataCurrentOrder;
|
import com.jFxKasse.datatypes.tableDataCurrentOrder;
|
||||||
import com.jFxKasse.datatypes.tableDataJob;
|
import com.jFxKasse.datatypes.tableDataJob;
|
||||||
import com.jFxKasse.datatypes.tableDataPositionen;
|
import com.jFxKasse.datatypes.tableDataPositionen;
|
||||||
import com.jFxKasse.datatypes.PrintDataSimple;
|
|
||||||
|
|
||||||
public class MainWindowController
|
public class MainWindowController
|
||||||
{
|
{
|
||||||
|
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
||||||
|
|
||||||
Clipboard clipboard = toolkit.getSystemClipboard();
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane mainAnchorpane;
|
private AnchorPane mainAnchorpane;
|
||||||
|
|
||||||
|
@ -425,9 +406,15 @@ public class MainWindowController
|
||||||
@FXML
|
@FXML
|
||||||
public void btnOpenFolderAction(ActionEvent event) throws IOException
|
public void btnOpenFolderAction(ActionEvent event) throws IOException
|
||||||
{
|
{
|
||||||
Runtime.getRuntime().exec(
|
|
||||||
"xdg-open " + System.getProperty("user.home") + "/bin/jFxKasse");
|
|
||||||
|
|
||||||
|
if (System.getProperty("os.name").contains("Windows")) {
|
||||||
|
System.out.println("FCK Windows");
|
||||||
|
File file = new File(Main.filepath);
|
||||||
|
Desktop desktop = Desktop.getDesktop();
|
||||||
|
desktop.open(file);
|
||||||
|
} else {
|
||||||
|
Runtime.getRuntime().exec("xdg-open " + Main.filepath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -492,8 +479,6 @@ public class MainWindowController
|
||||||
@FXML
|
@FXML
|
||||||
public void btnCalcStatsAction(ActionEvent event)
|
public void btnCalcStatsAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
// System.out.println(dbc.getAllJobValue_Job());
|
|
||||||
|
|
||||||
int allActiveJobs = Integer.valueOf(dbc.getJobCount());
|
int allActiveJobs = Integer.valueOf(dbc.getJobCount());
|
||||||
|
|
||||||
if (dbc.getAllJobValue_Job() != null) {
|
if (dbc.getAllJobValue_Job() != null) {
|
||||||
|
@ -532,9 +517,7 @@ public class MainWindowController
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
fillPrinterSettings();
|
fillPrinterSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -548,7 +531,6 @@ public class MainWindowController
|
||||||
public void btnLockAction(ActionEvent event)
|
public void btnLockAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
lockState = !lockState;
|
lockState = !lockState;
|
||||||
|
|
||||||
blockUI(lockState);
|
blockUI(lockState);
|
||||||
|
|
||||||
if (lockState) {
|
if (lockState) {
|
||||||
|
@ -556,7 +538,6 @@ public class MainWindowController
|
||||||
} else {
|
} else {
|
||||||
btnLock.setText("Kasse sperren");
|
btnLock.setText("Kasse sperren");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -571,7 +552,6 @@ public class MainWindowController
|
||||||
fillCategory();
|
fillCategory();
|
||||||
fillTablePositionen();
|
fillTablePositionen();
|
||||||
getSelectedCat();
|
getSelectedCat();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -587,7 +567,6 @@ public class MainWindowController
|
||||||
|
|
||||||
}
|
}
|
||||||
setJobPrizeLabel(currentJob.getJobValue());
|
setJobPrizeLabel(currentJob.getJobValue());
|
||||||
// currentJob.printJobOnConsole();
|
|
||||||
|
|
||||||
if (rootCurrentJob.getChildren().size() == 0) {
|
if (rootCurrentJob.getChildren().size() == 0) {
|
||||||
btnPrintBill.setDisable(true);
|
btnPrintBill.setDisable(true);
|
||||||
|
@ -599,13 +578,11 @@ public class MainWindowController
|
||||||
if (!currentJob.existsPosName(currentOrderPosName)) {
|
if (!currentJob.existsPosName(currentOrderPosName)) {
|
||||||
btnDeleteSelectedPosition.setDisable(true);
|
btnDeleteSelectedPosition.setDisable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void btnPrintBillAction(ActionEvent event)
|
public void btnPrintBillAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
// currentJob.printJobOnConsole();
|
|
||||||
|
|
||||||
btnPrintBill.setDisable(true);
|
btnPrintBill.setDisable(true);
|
||||||
tapPosEdit.setDisable(false);
|
tapPosEdit.setDisable(false);
|
||||||
|
@ -624,8 +601,6 @@ public class MainWindowController
|
||||||
currentJob.createPosCatDBString(), "verbucht",
|
currentJob.createPosCatDBString(), "verbucht",
|
||||||
String.valueOf(currentJob.getJobValue()));
|
String.valueOf(currentJob.getJobValue()));
|
||||||
|
|
||||||
System.out.println(currentJob.getJobnumber());
|
|
||||||
|
|
||||||
pj.printJob(currentJob.getJobnumber(), xmlc, dbc, pc);
|
pj.printJob(currentJob.getJobnumber(), xmlc, dbc, pc);
|
||||||
|
|
||||||
fillTableJobs();
|
fillTableJobs();
|
||||||
|
@ -640,9 +615,8 @@ public class MainWindowController
|
||||||
public void btnReprintJobAction(ActionEvent event)
|
public void btnReprintJobAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
System.out.println("reprint job");
|
System.out.println("reprint job");
|
||||||
pj.printJob((selectedJobId + 1), xmlc, dbc, pc);
|
pj.printJob((selectedJobId + 1), xmlc, dbc, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void gridButton01Action(ActionEvent event)
|
public void gridButton01Action(ActionEvent event)
|
||||||
|
@ -812,12 +786,7 @@ public class MainWindowController
|
||||||
|
|
||||||
tableDataPositionen helpTableData = new tableDataPositionen(
|
tableDataPositionen helpTableData = new tableDataPositionen(
|
||||||
dbc.ladeTabellePositionen().get(i).getID(),
|
dbc.ladeTabellePositionen().get(i).getID(),
|
||||||
dbc.ladeTabellePositionen().get(i).getName(),
|
dbc.ladeTabellePositionen().get(i).getName(), (strValue + "€"),
|
||||||
|
|
||||||
(strValue + "€")
|
|
||||||
|
|
||||||
,
|
|
||||||
|
|
||||||
dbc.getCategoryNameFromPositionen(i + 1),
|
dbc.getCategoryNameFromPositionen(i + 1),
|
||||||
getColorNames(dbc.ladeTabellePositionen().get(i).getColor()));
|
getColorNames(dbc.ladeTabellePositionen().get(i).getColor()));
|
||||||
rootPositionen.getChildren()
|
rootPositionen.getChildren()
|
||||||
|
@ -840,22 +809,17 @@ public class MainWindowController
|
||||||
initPositionen();
|
initPositionen();
|
||||||
initCurrentOrderTreeTableView();
|
initCurrentOrderTreeTableView();
|
||||||
initJobTreeTableView();
|
initJobTreeTableView();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectedCat()
|
public int getSelectedCat()
|
||||||
{
|
{
|
||||||
|
|
||||||
ObservableList<String> cats = FXCollections.observableArrayList();
|
ObservableList<String> cats = FXCollections.observableArrayList();
|
||||||
|
|
||||||
for (int i = 1; i < 5; i++) {
|
for (int i = 1; i < 5; i++) {
|
||||||
|
|
||||||
if (dbc.getName_Category(i).equals("Standard")) {
|
if (dbc.getName_Category(i).equals("Standard")) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cats.add(dbc.getName_Category(i));
|
cats.add(dbc.getName_Category(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cats.add(dbc.getName_Category(5));
|
cats.add(dbc.getName_Category(5));
|
||||||
|
@ -869,17 +833,14 @@ public class MainWindowController
|
||||||
{
|
{
|
||||||
selectedCatName = catChoise.getItems().get((int) new_value)
|
selectedCatName = catChoise.getItems().get((int) new_value)
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 1; i < 6; i++) {
|
for (int i = 1; i < 6; i++) {
|
||||||
|
|
||||||
if (dbc.getName_Category(i).equals(selectedCatName)) {
|
if (dbc.getName_Category(i).equals(selectedCatName)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,8 +848,6 @@ public class MainWindowController
|
||||||
{
|
{
|
||||||
System.out.println("Fill printer Settings");
|
System.out.println("Fill printer Settings");
|
||||||
|
|
||||||
// System.out.println(pc.getAvailablePrinters()[0]);
|
|
||||||
|
|
||||||
ObservableList<String> printers = FXCollections
|
ObservableList<String> printers = FXCollections
|
||||||
.observableArrayList(pc.getAvailablePrinters());
|
.observableArrayList(pc.getAvailablePrinters());
|
||||||
printers.add("Drucker auswählen");
|
printers.add("Drucker auswählen");
|
||||||
|
@ -909,7 +868,7 @@ public class MainWindowController
|
||||||
if (!printerFound) {
|
if (!printerFound) {
|
||||||
// saved printer is not available
|
// saved printer is not available
|
||||||
printerChoise.getSelectionModel().select(printers.size() - 1);
|
printerChoise.getSelectionModel().select(printers.size() - 1);
|
||||||
System.out.println("kein drucker");
|
System.out.println("no printer found");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinnerValueFactory<Integer> valueFactoryLines = //
|
SpinnerValueFactory<Integer> valueFactoryLines = //
|
||||||
|
@ -996,7 +955,6 @@ public class MainWindowController
|
||||||
public void changed(ObservableValue<?> observable, Object oldVal,
|
public void changed(ObservableValue<?> observable, Object oldVal,
|
||||||
Object newVal)
|
Object newVal)
|
||||||
{
|
{
|
||||||
// last = selected; //for auto-play
|
|
||||||
int selected = entryTreeTable.getSelectionModel()
|
int selected = entryTreeTable.getSelectionModel()
|
||||||
.getSelectedIndex(); // get selected item
|
.getSelectedIndex(); // get selected item
|
||||||
|
|
||||||
|
@ -1024,11 +982,9 @@ public class MainWindowController
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
public void changed(ObservableValue<? extends String> observable,
|
||||||
String oldValue, String newValue)
|
String oldValue, String newValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!newValue.matches("\\d{0,4}([\\.]\\d{0,2})?")) {
|
if (!newValue.matches("\\d{0,4}([\\.]\\d{0,2})?")) {
|
||||||
tftNewValue.setText(oldValue);
|
tftNewValue.setText(oldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1161,7 +1117,6 @@ public class MainWindowController
|
||||||
// print was not disabled and will be enabled again
|
// print was not disabled and will be enabled again
|
||||||
btnPrintBill.setDisable(pState);
|
btnPrintBill.setDisable(pState);
|
||||||
btnDeleteSelectedPosition.setDisable(pState);
|
btnDeleteSelectedPosition.setDisable(pState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pState) {
|
if (pState) {
|
||||||
|
@ -1202,11 +1157,8 @@ public class MainWindowController
|
||||||
|
|
||||||
public void loadGridButtons()
|
public void loadGridButtons()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < 25; i++) {
|
for (int i = 0; i < 25; i++) {
|
||||||
|
|
||||||
getButtonByID(i).setText(dbc.getName_Positionen(i + 1));
|
getButtonByID(i).setText(dbc.getName_Positionen(i + 1));
|
||||||
|
|
||||||
if ((getColorID(dbc.getColor_Positionen(i + 1)) == 0)
|
if ((getColorID(dbc.getColor_Positionen(i + 1)) == 0)
|
||||||
|| (getColorID(dbc.getColor_Positionen(i + 1)) == 7)) {
|
|| (getColorID(dbc.getColor_Positionen(i + 1)) == 7)) {
|
||||||
getButtonByID(i).setStyle("-fx-background-color: "
|
getButtonByID(i).setStyle("-fx-background-color: "
|
||||||
|
@ -1215,19 +1167,14 @@ public class MainWindowController
|
||||||
getButtonByID(i).setStyle("-fx-background-color: "
|
getButtonByID(i).setStyle("-fx-background-color: "
|
||||||
+ dbc.getColor_Positionen(i + 1) + "; -fx-text-fill: black;");
|
+ dbc.getColor_Positionen(i + 1) + "; -fx-text-fill: black;");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 25; i++) {
|
for (int i = 0; i < 25; i++) {
|
||||||
|
|
||||||
if (dbc.getName_Positionen(i + 1).equals("Noch frei")) {
|
if (dbc.getName_Positionen(i + 1).equals("Noch frei")) {
|
||||||
getButtonByID(i).setVisible(false);
|
getButtonByID(i).setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
getButtonByID(i).setVisible(true);
|
getButtonByID(i).setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button getButtonByID(int pID)
|
public Button getButtonByID(int pID)
|
||||||
|
@ -1290,7 +1237,6 @@ public class MainWindowController
|
||||||
|
|
||||||
private void handelGridButtons(int pID)
|
private void handelGridButtons(int pID)
|
||||||
{
|
{
|
||||||
|
|
||||||
currentJob.addPosition(dbc.getName_Positionen(pID),
|
currentJob.addPosition(dbc.getName_Positionen(pID),
|
||||||
Float.parseFloat(dbc.getValue_Positionen(pID)),
|
Float.parseFloat(dbc.getValue_Positionen(pID)),
|
||||||
dbc.getCategoryNameFromPositionen(pID));
|
dbc.getCategoryNameFromPositionen(pID));
|
||||||
|
@ -1308,12 +1254,10 @@ public class MainWindowController
|
||||||
}
|
}
|
||||||
|
|
||||||
setJobPrizeLabel(currentJob.getJobValue());
|
setJobPrizeLabel(currentJob.getJobValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCurrentOrderTreeTableView()
|
private void initCurrentOrderTreeTableView()
|
||||||
{
|
{
|
||||||
|
|
||||||
columnQuantity
|
columnQuantity
|
||||||
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
|
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
|
||||||
columnPosition
|
columnPosition
|
||||||
|
@ -1335,7 +1279,6 @@ public class MainWindowController
|
||||||
public void changed(ObservableValue<?> observable, Object oldVal,
|
public void changed(ObservableValue<?> observable, Object oldVal,
|
||||||
Object newVal)
|
Object newVal)
|
||||||
{
|
{
|
||||||
// last = selected; //for auto-play
|
|
||||||
int selected = tableCurrentOrder.getSelectionModel()
|
int selected = tableCurrentOrder.getSelectionModel()
|
||||||
.getSelectedIndex(); // get selected item
|
.getSelectedIndex(); // get selected item
|
||||||
|
|
||||||
|
@ -1350,7 +1293,6 @@ public class MainWindowController
|
||||||
|
|
||||||
private void initJobTreeTableView()
|
private void initJobTreeTableView()
|
||||||
{
|
{
|
||||||
|
|
||||||
columnJobNumber
|
columnJobNumber
|
||||||
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
|
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
|
||||||
|
|
||||||
|
@ -1401,7 +1343,6 @@ public class MainWindowController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -1464,9 +1405,7 @@ public class MainWindowController
|
||||||
private void setJobPrizeLabel(float pPrize)
|
private void setJobPrizeLabel(float pPrize)
|
||||||
{
|
{
|
||||||
String str = String.format("%.02f", pPrize);
|
String str = String.format("%.02f", pPrize);
|
||||||
|
|
||||||
str.replace('.', ',');
|
str.replace('.', ',');
|
||||||
|
|
||||||
labelAllPrize.setText(str + "€");
|
labelAllPrize.setText(str + "€");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1488,7 +1427,6 @@ public class MainWindowController
|
||||||
|
|
||||||
titlePaneStats.setText("Statistik - " + timedate.getSystemTime() + " "
|
titlePaneStats.setText("Statistik - " + timedate.getSystemTime() + " "
|
||||||
+ timedate.getSystemDate());
|
+ timedate.getSystemDate());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTimeLabel()
|
public void updateTimeLabel()
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class XMLController
|
||||||
|
|
||||||
public XMLController(String filePath)
|
public XMLController(String filePath)
|
||||||
{
|
{
|
||||||
this.filePath = filePath;
|
this.filePath = filePath + "config.xml";
|
||||||
props = new Properties();
|
props = new Properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue