parent
247bd9a20b
commit
4b80f983fb
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -68,18 +68,21 @@
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0">
|
<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0">
|
||||||
<columns>
|
<columns>
|
||||||
<TreeTableColumn fx:id="columnColor" editable="false" prefWidth="135.0" resizable="false" sortable="false" text="Farbe" />
|
<TreeTableColumn fx:id="columnColor" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Farbe" />
|
||||||
<TreeTableColumn fx:id="columnPrize" editable="false" prefWidth="117.0" resizable="false" sortable="false" text="Preis" />
|
<TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Preis" />
|
||||||
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" prefWidth="982.0" resizable="false" sortable="false" text="Positionen" />
|
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="800.0" minWidth="800.0" prefWidth="800.0" resizable="false" sortable="false" text="Positionen" />
|
||||||
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="3000.0" prefWidth="111.0" resizable="false" sortable="false" text="Nummer" />
|
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="120.0" minWidth="120.0" prefWidth="120.0" resizable="false" sortable="false" text="Nummer" />
|
||||||
</columns>
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||||
|
</columnResizePolicy>
|
||||||
</TreeTableView>
|
</TreeTableView>
|
||||||
<Button fx:id="btnSaveEntry" layoutX="66.0" layoutY="620.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
|
<Button fx:id="btnSaveEntry" layoutX="494.0" layoutY="631.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="17.0" />
|
<Font name="Cantarell Regular" size="17.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="btnClearEntry" layoutX="437.0" layoutY="620.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
|
<Button fx:id="btnClearEntry" layoutX="462.0" layoutY="525.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="17.0" />
|
<Font name="Cantarell Regular" size="17.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -93,13 +96,19 @@
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<JFXTextField fx:id="tftNewPosition" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.0" />
|
<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.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="442.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<JFXTextField fx:id="tftNewValue" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0" />
|
<JFXTextField fx:id="tftNewValue" alignment="CENTER" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0">
|
||||||
|
<font>
|
||||||
|
<Font name="Cantarell Regular" size="13.0" />
|
||||||
|
</font></JFXTextField>
|
||||||
<Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
|
<Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -12,27 +12,20 @@ import java.io.FileInputStream;
|
||||||
|
|
||||||
class DBController
|
class DBController
|
||||||
{
|
{
|
||||||
|
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
private String DB_PATH_Linux = System.getProperty("user.home")
|
private String DB_PATH_Linux = System.getProperty("user.home")
|
||||||
+ "/bin/jFxKasse/";
|
+ "/bin/jFxKasse/";
|
||||||
|
|
||||||
public String dbname;
|
public String dbname;
|
||||||
|
|
||||||
private Main main;
|
|
||||||
|
|
||||||
// private Cryption crypo = new Cryption();
|
private Main main;
|
||||||
private String schluessel; // Für Ver-/Entschlüsselung
|
|
||||||
|
|
||||||
boolean databasepresent = false;
|
|
||||||
|
|
||||||
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_Linux + dbname + ".db");
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -44,16 +37,14 @@ class DBController
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verbindeDatenbank()
|
public void connectDatabase()
|
||||||
{ // Verbinde mit der Datenbank-Datei
|
{ // connect to database
|
||||||
System.out.println("Verbinde ... DB name: " + dbname);
|
System.out.println("Verbinde ... 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_Linux + dbname + ".db");
|
||||||
|
|
||||||
|
|
||||||
if (!connection.isClosed())
|
if (!connection.isClosed())
|
||||||
System.out.println("DB Datei-Verbindung erstellt");
|
System.out.println("DB Datei-Verbindung erstellt");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -75,63 +66,6 @@ class DBController
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fuellenPositionen(int pID, String pName, float pValue,
|
|
||||||
String pColor)
|
|
||||||
{ // Neuen Eintrag erstellen
|
|
||||||
System.out.println("Erstelle neuen positionen eintrag");
|
|
||||||
try {
|
|
||||||
PreparedStatement ps = connection.prepareStatement(
|
|
||||||
"INSERT INTO positionen VALUES (?, ?, ?, ?);");
|
|
||||||
ps.setInt(1, pID); // Primärschlässel
|
|
||||||
ps.setString(2, pName);
|
|
||||||
ps.setFloat(3, pValue);
|
|
||||||
ps.setString(4, pColor);
|
|
||||||
|
|
||||||
|
|
||||||
ps.addBatch();
|
|
||||||
connection.setAutoCommit(false);
|
|
||||||
ps.executeBatch(); // SQL ausführen
|
|
||||||
connection.setAutoCommit(true);
|
|
||||||
// connection.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void erstelleTabellePositionen()
|
|
||||||
{ // Erstelle Tabelle mit Reihen
|
|
||||||
System.out.println("Erstelle Tabelle Positionen");
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
stmt.executeUpdate("DROP TABLE IF EXISTS positionen;");
|
|
||||||
stmt.executeUpdate(
|
|
||||||
"CREATE TABLE positionen (id, name, value, color);");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 25; i++) {
|
|
||||||
fuellenPositionen(i+1, "Noch frei", (float) 0.00, "#FAF0E6");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void erstelleTabelleJobs()
|
|
||||||
{ // Erstelle Tabelle mit Reihen
|
|
||||||
System.out.println("Erstelle Tabelle Jobs");
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
stmt.executeUpdate("DROP TABLE IF EXISTS jobs;");
|
|
||||||
stmt.executeUpdate(
|
|
||||||
"CREATE TABLE jobs (id, time, positionen, state, value);");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean existiertDatenbank(String pPfad)
|
public boolean existiertDatenbank(String pPfad)
|
||||||
{ // Prüft ob die Datenbank existiert
|
{ // Prüft ob die Datenbank existiert
|
||||||
File varTmpDir = new File(pPfad);
|
File varTmpDir = new File(pPfad);
|
||||||
|
@ -142,20 +76,43 @@ class DBController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ausgebenSysoPositionen()
|
|
||||||
{ // Debugging Ausgabe der kompletten Tabelle
|
// table Position section
|
||||||
System.out.println("Print positionen");
|
public void createTablePositionen()
|
||||||
|
{ // create table position
|
||||||
|
System.out.println("Erstelle Tabelle Positionen");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM positionen;");
|
stmt.executeUpdate("DROP TABLE IF EXISTS positionen;");
|
||||||
while (rs.next()) {
|
stmt.executeUpdate(
|
||||||
System.out.println("id = " + rs.getString("id"));
|
"CREATE TABLE positionen (id, name, value, color);");
|
||||||
System.out.println("name = " + rs.getString("name"));
|
} catch (SQLException e) {
|
||||||
System.out.println("vale = " + rs.getString("value"));
|
System.err.println("Couldn't handle DB-Query");
|
||||||
System.out.println("color = " + rs.getString("color"));
|
e.printStackTrace();
|
||||||
System.out.println(" ");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// create 25 demo/default data entries
|
||||||
|
for (int i = 0; i < 25; i++) {
|
||||||
|
fillPositionen(i + 1, "Noch frei", (float) 0.00, "#FAF0E6");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillPositionen(int pID, String pName, float pValue,
|
||||||
|
String pColor)
|
||||||
|
{ // create new data in table
|
||||||
|
System.out.println("Erstelle neuen positionen eintrag");
|
||||||
|
try {
|
||||||
|
PreparedStatement ps = connection
|
||||||
|
.prepareStatement("INSERT INTO positionen VALUES (?, ?, ?, ?);");
|
||||||
|
ps.setInt(1, pID); // primary
|
||||||
|
ps.setString(2, pName);
|
||||||
|
ps.setFloat(3, pValue);
|
||||||
|
ps.setString(4, pColor);
|
||||||
|
|
||||||
|
ps.addBatch();
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
ps.executeBatch(); // SQL execution
|
||||||
|
connection.setAutoCommit(true);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.err.println("Couldn't handle DB-Query");
|
System.err.println("Couldn't handle DB-Query");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -204,37 +161,6 @@ class DBController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail(int pID)
|
|
||||||
{ // Gibt die Email zurück
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(
|
|
||||||
"SELECT id, email FROM konten WHERE id = " + pID + ";");
|
|
||||||
return rs.getString("email");
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
return "Error 404";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPasswort(int pID)
|
|
||||||
{ // Gibt das Passwort zurück
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(
|
|
||||||
"SELECT id, passwort FROM konten WHERE id = " + pID + ";");
|
|
||||||
return rs.getString("passwort");
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
return "Error 404";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(int pID, String pName)
|
public void setName(int pID, String pName)
|
||||||
{ // Setzt das Datum
|
{ // Setzt das Datum
|
||||||
try {
|
try {
|
||||||
|
@ -271,89 +197,6 @@ class DBController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(int pID, String pEmail)
|
|
||||||
{ // Setzt die Email
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
stmt.executeUpdate("UPDATE konten SET email = '" + pEmail
|
|
||||||
+ "'WHERE id =" + pID + ";");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPasswort(int pID, String pPasswort)
|
|
||||||
{ // Setzt das Passwort
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
stmt.executeUpdate("UPDATE konten SET passwort = '" + pPasswort
|
|
||||||
+ "'WHERE id =" + pID + ";");
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loeschenEintrag(int pID)
|
|
||||||
{ // Löscht den Eintrag
|
|
||||||
int alteOrdnung = getNeueID(); // Speichert die ID des letzten Eintrags
|
|
||||||
try {
|
|
||||||
if (pID == getNeueID() - 1) { // Falls letzter Eintrag gelöscht werden
|
|
||||||
// soll
|
|
||||||
PreparedStatement ps = connection
|
|
||||||
.prepareStatement("DELETE FROM konten WHERE id=?");
|
|
||||||
ps.setInt(1, pID);
|
|
||||||
ps.executeUpdate();
|
|
||||||
} else { // Wenn ein Eintrag in mitten der DB gelöscht wird, dann wird
|
|
||||||
// hochkopiert
|
|
||||||
while (!(pID + 1 == alteOrdnung - 1)) {
|
|
||||||
int pIDneu = pID + 1;
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(
|
|
||||||
"SELECT id, datum, konto, nutzername, email, passwort FROM konten WHERE id = "
|
|
||||||
+ pIDneu + ";");
|
|
||||||
|
|
||||||
String pDatum = rs.getString("datum");
|
|
||||||
String pKonto = rs.getString("konto");
|
|
||||||
String pNutzername = rs.getString("nutzername");
|
|
||||||
String pEmail = rs.getString("email");
|
|
||||||
String pPasswort = rs.getString("passwort");
|
|
||||||
|
|
||||||
stmt.executeUpdate("UPDATE konten SET datum = '" + pDatum
|
|
||||||
+ "', konto = '" + pKonto + "', nutzername = '"
|
|
||||||
+ pNutzername + "', email = '" + pEmail + "', passwort = '"
|
|
||||||
+ pPasswort + "'WHERE id =" + pID + ";");
|
|
||||||
pID = pID + 1;
|
|
||||||
}
|
|
||||||
PreparedStatement ps = connection
|
|
||||||
.prepareStatement("DELETE FROM konten WHERE id=?");
|
|
||||||
ps.setInt(1, alteOrdnung - 1);
|
|
||||||
ps.executeUpdate();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNeueID()
|
|
||||||
{ // Gibt die ID des nächsten Eintrags zurück
|
|
||||||
int neueID = 0;
|
|
||||||
try {
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM konten;");
|
|
||||||
while (rs.next()) {
|
|
||||||
neueID = rs.getInt("id") + 1;
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.err.println("Couldn't handle DB-Query");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return neueID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<tableDataPositionen> ladeTabellePositionen()
|
public ArrayList<tableDataPositionen> ladeTabellePositionen()
|
||||||
{ // Gibt ein Objekt daten mit allen Einträgen der DB zurück
|
{ // Gibt ein Objekt daten mit allen Einträgen der DB zurück
|
||||||
ArrayList<tableDataPositionen> daten = new ArrayList<>();
|
ArrayList<tableDataPositionen> daten = new ArrayList<>();
|
||||||
|
@ -363,7 +206,9 @@ class DBController
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
try {
|
try {
|
||||||
// Entschlüsselte Daten werden als Datenobjekt gespeichert
|
// Entschlüsselte Daten werden als Datenobjekt gespeichert
|
||||||
daten.add(new tableDataPositionen(rs.getInt("id"), rs.getString("name"), rs.getString("value"), rs.getString("color")));
|
daten.add(new tableDataPositionen(rs.getInt("id"),
|
||||||
|
rs.getString("name"), rs.getString("value"),
|
||||||
|
rs.getString("color")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -375,11 +220,44 @@ class DBController
|
||||||
}
|
}
|
||||||
return daten;
|
return daten;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ausgebenSysoPositionen()
|
||||||
|
{ // Debugging Ausgabe der kompletten Tabelle
|
||||||
|
System.out.println("Print positionen");
|
||||||
|
try {
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM positionen;");
|
||||||
|
while (rs.next()) {
|
||||||
|
System.out.println("id = " + rs.getString("id"));
|
||||||
|
System.out.println("name = " + rs.getString("name"));
|
||||||
|
System.out.println("vale = " + rs.getString("value"));
|
||||||
|
System.out.println("color = " + rs.getString("color"));
|
||||||
|
System.out.println(" ");
|
||||||
|
}
|
||||||
|
|
||||||
public void setSchluessel(String pSchluessel)
|
} catch (SQLException e) {
|
||||||
{ // Setzt den Schlüssel für die Ver-/Entschlüsslung
|
System.err.println("Couldn't handle DB-Query");
|
||||||
schluessel = pSchluessel;
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// table Jobs section
|
||||||
|
public void erstelleTabelleJobs()
|
||||||
|
{ // Erstelle Tabelle mit Reihen
|
||||||
|
System.out.println("Erstelle Tabelle Jobs");
|
||||||
|
try {
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
stmt.executeUpdate("DROP TABLE IF EXISTS jobs;");
|
||||||
|
stmt.executeUpdate(
|
||||||
|
"CREATE TABLE jobs (id, time, positionen, state, value);");
|
||||||
|
} catch (SQLException e) {
|
||||||
|
System.err.println("Couldn't handle DB-Query");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@ public class Main extends Application
|
||||||
|
|
||||||
private DBController dbc = new DBController(this);
|
private DBController dbc = new DBController(this);
|
||||||
|
|
||||||
private String schluesselNutzer; // Passwort des Nutzers
|
|
||||||
|
|
||||||
private Stage primaryStage;
|
private Stage primaryStage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,7 +40,6 @@ public class Main extends Application
|
||||||
{
|
{
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
mainWindow();
|
mainWindow();
|
||||||
//this.primaryStage.setResizable(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mainWindow()
|
private void mainWindow()
|
||||||
|
@ -51,22 +48,12 @@ public class Main extends Application
|
||||||
FXMLLoader loader = new FXMLLoader(
|
FXMLLoader loader = new FXMLLoader(
|
||||||
getClass().getResource("MainWindow.fxml"));
|
getClass().getResource("MainWindow.fxml"));
|
||||||
AnchorPane pane = loader.load();
|
AnchorPane pane = loader.load();
|
||||||
// Test
|
primaryStage.setTitle("jFxKasse"); // Title of window
|
||||||
//Test
|
|
||||||
//primaryStage.setWidth(1366);
|
|
||||||
//primaryStage.setHeight(732);
|
|
||||||
primaryStage.setTitle("jFxKasse"); // Title der Stage
|
|
||||||
|
|
||||||
mwc = loader.getController();
|
mwc = loader.getController();
|
||||||
mwc.setMain(this, dbc);
|
mwc.setMain(this, dbc);
|
||||||
|
|
||||||
firstStart(); // Prüft ob das Programm zuvor gestartet wurde
|
firstStart();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// dbc.main(); // Startet die Datenbank
|
|
||||||
|
|
||||||
//mwc.fuelleTablle(); // Ladt die Einträge in die Tabelle
|
|
||||||
|
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
scene.getStylesheets()
|
scene.getStylesheets()
|
||||||
|
@ -83,42 +70,26 @@ public class Main extends Application
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the config.xml is preset.
|
||||||
|
* @author hendrik
|
||||||
|
*/
|
||||||
private void firstStart() throws Exception
|
private void firstStart() throws Exception
|
||||||
{
|
{
|
||||||
|
if (mwc.loadSettings()) {
|
||||||
if (mwc.loadSettings()) { // Wenn XML gefunden
|
// config.xml found, app starting normal
|
||||||
System.out.println("XML gefunden!");
|
System.out.println("XML gefunden!");
|
||||||
mwc.initUI(); // Startet die UI
|
mwc.initUI(); // Starting the UI elements
|
||||||
mwc.setDBLabel();
|
mwc.setDBLabel(); // Set databese labels
|
||||||
dbc.dbname = mwc.getDatabaseName();
|
dbc.dbname = mwc.getDatabaseName(); // handover database name
|
||||||
dbc.verbindeDatenbank(); // Verbindet mit der Datenbank-Datei
|
dbc.connectDatabase(); // estabishing DB conection
|
||||||
mwc.fuelleTabllePositionen();
|
mwc.fillTablePositionen(); // fill TreeTable 'Positionen'
|
||||||
|
} else {
|
||||||
|
// config.xml NOT found, first start of app
|
||||||
} else { // Wenn keine XML gefunden --> erster Start
|
|
||||||
System.out.println("keine XML gefunden!");
|
System.out.println("keine XML gefunden!");
|
||||||
mwc.blockUI(true);
|
mwc.blockUI(true); // disable UI elements that need DB
|
||||||
if (System.getProperty("os.name").equals("Linux")) {
|
File dir = new File(System.getProperty("user.home") + "/bin/jFxKasse");
|
||||||
|
dir.mkdir(); // Create new Subfolder
|
||||||
File dir = new File(
|
|
||||||
System.getProperty("user.home") + "/bin/jFxKasse"); // Erstellt
|
|
||||||
// den
|
|
||||||
// Unterordner
|
|
||||||
dir.mkdir(); // Erstellt den Unterordner
|
|
||||||
} else {
|
|
||||||
File dir = new File("C:/ProgramData/jFxKasse/"); // Erstellt den
|
|
||||||
// Unterordner
|
|
||||||
dir.mkdir(); // Erstellt den Unterordner
|
|
||||||
}
|
|
||||||
|
|
||||||
// mwc.saveSettings(mwc.getDatabaseName(), "dd"); // speichert das Passwort und
|
|
||||||
// den Individueller
|
|
||||||
// Schlüssel für die API in
|
|
||||||
// der XML
|
|
||||||
//dbc.verbindeDatenbank(); // Verbindet mit der Datenbank-Datei
|
|
||||||
//dbc.erstelleDatenbank(); // Neue Datenbank-Datei wird erstellt
|
|
||||||
//System.exit(0); // Programm wird beendet
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,18 +68,21 @@
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0">
|
<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0">
|
||||||
<columns>
|
<columns>
|
||||||
<TreeTableColumn fx:id="columnColor" editable="false" prefWidth="135.0" resizable="false" sortable="false" text="Farbe" />
|
<TreeTableColumn fx:id="columnColor" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Farbe" />
|
||||||
<TreeTableColumn fx:id="columnPrize" editable="false" prefWidth="117.0" resizable="false" sortable="false" text="Preis" />
|
<TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Preis" />
|
||||||
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" prefWidth="982.0" resizable="false" sortable="false" text="Positionen" />
|
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="800.0" minWidth="800.0" prefWidth="800.0" resizable="false" sortable="false" text="Positionen" />
|
||||||
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="3000.0" prefWidth="111.0" resizable="false" sortable="false" text="Nummer" />
|
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="120.0" minWidth="120.0" prefWidth="120.0" resizable="false" sortable="false" text="Nummer" />
|
||||||
</columns>
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||||
|
</columnResizePolicy>
|
||||||
</TreeTableView>
|
</TreeTableView>
|
||||||
<Button fx:id="btnSaveEntry" layoutX="66.0" layoutY="620.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
|
<Button fx:id="btnSaveEntry" layoutX="494.0" layoutY="631.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="17.0" />
|
<Font name="Cantarell Regular" size="17.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="btnClearEntry" layoutX="437.0" layoutY="620.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
|
<Button fx:id="btnClearEntry" layoutX="462.0" layoutY="525.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="17.0" />
|
<Font name="Cantarell Regular" size="17.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -93,13 +96,19 @@
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<JFXTextField fx:id="tftNewPosition" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.0" />
|
<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.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="442.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<JFXTextField fx:id="tftNewValue" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0" />
|
<JFXTextField fx:id="tftNewValue" alignment="CENTER" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0">
|
||||||
|
<font>
|
||||||
|
<Font name="Cantarell Regular" size="13.0" />
|
||||||
|
</font></JFXTextField>
|
||||||
<Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
|
<Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Cantarell Regular" size="18.0" />
|
<Font name="Cantarell Regular" size="18.0" />
|
||||||
|
|
|
@ -15,11 +15,7 @@ import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.TreeItem;
|
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 com.sun.java.swing.action.NewAction;
|
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
|
@ -35,10 +31,8 @@ import java.net.URISyntaxException;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.security.auth.callback.Callback;
|
import javax.security.auth.callback.Callback;
|
||||||
import javax.swing.plaf.basic.BasicInternalFrameTitlePane.TitlePaneLayout;
|
import javax.swing.plaf.basic.BasicInternalFrameTitlePane.TitlePaneLayout;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
|
@ -286,9 +280,6 @@ public class MainWindowController
|
||||||
|
|
||||||
private String databaseName;
|
private String databaseName;
|
||||||
|
|
||||||
// private ObservableList<String> color =
|
|
||||||
// FXCollections.observableArrayList("English", "Deutsch");
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
TreeItem<tableData> rootCurrentJob = new TreeItem<>(
|
TreeItem<tableData> rootCurrentJob = new TreeItem<>(
|
||||||
new tableData(0, "0", "0"));
|
new tableData(0, "0", "0"));
|
||||||
|
@ -304,18 +295,16 @@ public class MainWindowController
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void ueberbtnAction(ActionEvent event)
|
public void ueberbtnAction(ActionEvent event)
|
||||||
{ // Öffnet den Über-Dialog
|
{ // opens the 'Über' dialog
|
||||||
|
|
||||||
// Erstellt einen Dialog
|
// creates a dialog
|
||||||
Dialog<Pair<String, String>> dialog = new Dialog<>();
|
Dialog<Pair<String, String>> dialog = new Dialog<>();
|
||||||
dialog.setTitle("Über jFxKasse");
|
dialog.setTitle("Über jFxKasse");
|
||||||
dialog.setHeaderText(
|
dialog.setHeaderText(
|
||||||
"Informationen und Lizenzen - Version 0.7 - UI Techdemo");
|
"Informationen und Lizenzen - Version 0.8 - UI Techdemo");
|
||||||
|
|
||||||
// Erzeugt den Button
|
|
||||||
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
|
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
|
||||||
|
|
||||||
// Erzeugt die Textfelder und Label
|
|
||||||
GridPane grid = new GridPane();
|
GridPane grid = new GridPane();
|
||||||
grid.setHgap(10);
|
grid.setHgap(10);
|
||||||
grid.setVgap(10);
|
grid.setVgap(10);
|
||||||
|
@ -343,27 +332,21 @@ public class MainWindowController
|
||||||
@FXML
|
@FXML
|
||||||
public void btnCreateNewDatabaseAction(ActionEvent event) throws Exception
|
public void btnCreateNewDatabaseAction(ActionEvent event) throws Exception
|
||||||
{
|
{
|
||||||
System.out.println("Button!");
|
|
||||||
|
|
||||||
System.out.println(tftNewDBName.getText());
|
|
||||||
|
|
||||||
setDatabaseName(tftNewDBName.getText());
|
setDatabaseName(tftNewDBName.getText());
|
||||||
dbc.dbname = getDatabaseName();
|
dbc.dbname = getDatabaseName();
|
||||||
dbc.verbindeDatenbank(); // Verbindet mit der Datenbank-Datei
|
dbc.connectDatabase(); // establish DB connection
|
||||||
dbc.erstelleTabellePositionen();
|
dbc.createTablePositionen(); // Create new table
|
||||||
dbc.erstelleTabelleJobs();
|
dbc.erstelleTabelleJobs(); // Create new table
|
||||||
|
|
||||||
try {
|
try {
|
||||||
saveSettings(getDatabaseName());
|
saveSettings(getDatabaseName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
setDBLabel(); // Set new databese labels
|
||||||
setDBLabel();
|
blockUI(false); // unlock UI elements that need DB
|
||||||
blockUI(false);
|
fillTablePositionen(); // fill TreeTable 'Positionen'
|
||||||
fuelleTabllePositionen();
|
initUI(); // Starting the UI elements
|
||||||
initUI(); // Startet die UI
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,14 +359,19 @@ public class MainWindowController
|
||||||
dbc.setValue(idPositionen, tftNewValue.getText());
|
dbc.setValue(idPositionen, tftNewValue.getText());
|
||||||
dbc.setColor(idPositionen, getColorCodes(selectedColorName));
|
dbc.setColor(idPositionen, getColorCodes(selectedColorName));
|
||||||
|
|
||||||
fuelleTabllePositionen();
|
fillTablePositionen(); // fill TreeTable 'Positionen'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void btnClearEntryAction(ActionEvent event)
|
public void btnClearEntryAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
System.out.println("Button!");
|
// set default values
|
||||||
|
dbc.setName(idPositionen, "Noch frei");
|
||||||
|
dbc.setValue(idPositionen, "0.00");
|
||||||
|
dbc.setColor(idPositionen, "#FAF0E6");
|
||||||
|
|
||||||
|
fillTablePositionen(); // fill TreeTable 'Positionen'
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -395,8 +383,7 @@ public class MainWindowController
|
||||||
@FXML
|
@FXML
|
||||||
public void btnReprintJobAction(ActionEvent event)
|
public void btnReprintJobAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
// System.out.println("fuelleTabellePositionen");
|
|
||||||
// fuelleTabllePositionen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -409,7 +396,6 @@ public class MainWindowController
|
||||||
public void btnLockAction(ActionEvent event)
|
public void btnLockAction(ActionEvent event)
|
||||||
{
|
{
|
||||||
System.out.println("Button!");
|
System.out.println("Button!");
|
||||||
dbc.ausgebenSysoPositionen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -575,12 +561,8 @@ public class MainWindowController
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
public void fillTablePositionen()
|
||||||
public void fuelleTabllePositionen()
|
{ // loads the table in the TreeTableView
|
||||||
{ // Lädt die Datenbank in die Tabelle
|
|
||||||
|
|
||||||
// dbc.setSchluessel(schluessel);
|
|
||||||
|
|
||||||
rootPositionen.getChildren().remove(0,
|
rootPositionen.getChildren().remove(0,
|
||||||
rootPositionen.getChildren().size());
|
rootPositionen.getChildren().size());
|
||||||
|
|
||||||
|
@ -588,7 +570,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(),
|
||||||
dbc.ladeTabellePositionen().get(i).getValue(),
|
dbc.ladeTabellePositionen().get(i).getValue() + " €",
|
||||||
getColorNames(dbc.ladeTabellePositionen().get(i).getColor()));
|
getColorNames(dbc.ladeTabellePositionen().get(i).getColor()));
|
||||||
|
|
||||||
rootPositionen.getChildren()
|
rootPositionen.getChildren()
|
||||||
|
@ -599,12 +581,10 @@ public class MainWindowController
|
||||||
public void initUI()
|
public void initUI()
|
||||||
{
|
{
|
||||||
System.out.println("initUI");
|
System.out.println("initUI");
|
||||||
|
|
||||||
tftNewDBName.setText(getDatabaseName());
|
tftNewDBName.setText(getDatabaseName());
|
||||||
|
|
||||||
initPositionen();
|
initPositionen();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initPositionen()
|
private void initPositionen()
|
||||||
{
|
{
|
||||||
|
@ -668,51 +648,64 @@ public class MainWindowController
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
columnPosnumber.setStyle("-fx-alignment: CENTER;");
|
||||||
|
columnPositionsEdit.setStyle("-fx-alignment: CENTER;");
|
||||||
|
columnPrize.setStyle("-fx-alignment: CENTER;");
|
||||||
|
columnColor.setStyle("-fx-alignment: CENTER;");
|
||||||
|
|
||||||
|
tftNewValue.textProperty().addListener(new ChangeListener<String>() {
|
||||||
|
@Override
|
||||||
|
public void changed(ObservableValue<? extends String> observable,
|
||||||
|
String oldValue, String newValue)
|
||||||
|
{
|
||||||
|
if (!newValue.matches("\\d{0,7}([\\.]\\d{0,2})?")) {
|
||||||
|
tftNewValue.setText(oldValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setMain(Main main, DBController dbc)
|
public void setMain(Main main, DBController dbc)
|
||||||
{
|
{
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.dbc = dbc;
|
this.dbc = dbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getSystemDatum()
|
public String getSystemDatum()
|
||||||
{ // Gibt das System-Datum zurück
|
{
|
||||||
java.util.Date now = new java.util.Date();
|
java.util.Date now = new java.util.Date();
|
||||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
|
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
|
||||||
"dd.MM.yyyy");
|
"dd.MM.yyyy");
|
||||||
String heutigesDatum = sdf.format(now);
|
String heutigesDatum = sdf.format(now);
|
||||||
return heutigesDatum;
|
return heutigesDatum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveSettings(String databasename) throws Exception
|
public void saveSettings(String databasename) throws Exception
|
||||||
{
|
{ //Save settings to config.xml
|
||||||
OutputStream outputStream; // new output-stream
|
OutputStream outputStream;
|
||||||
try {
|
try {
|
||||||
props.setProperty("databasename", databasename); // writes dbname into
|
props.setProperty("databasename", databasename);
|
||||||
// property
|
|
||||||
|
|
||||||
outputStream = new FileOutputStream(filepathXMLLinux);
|
outputStream = new FileOutputStream(filepathXMLLinux);
|
||||||
|
props.storeToXML(outputStream, "jFxKasse settings");
|
||||||
props.storeToXML(outputStream, "jFxKasse settings"); // writes new .xml
|
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean loadSettings() throws Exception
|
public boolean loadSettings() throws Exception
|
||||||
{ // Ladt die Daten aus der XML
|
{ // reads the settings from config.xml
|
||||||
InputStream inputStream;
|
InputStream inputStream;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
inputStream = new FileInputStream(filepathXMLLinux);
|
inputStream = new FileInputStream(filepathXMLLinux);
|
||||||
|
|
||||||
props.loadFromXML(inputStream);
|
props.loadFromXML(inputStream);
|
||||||
setDatabaseName(props.getProperty("databasename"));
|
setDatabaseName(props.getProperty("databasename"));
|
||||||
// = crypo.entschluesseln(props.getProperty("key"),
|
|
||||||
// crypo.getProgrammSchluessel()); //liest schluessel von property
|
|
||||||
// base32Secret = crypo.entschluesseln(props.getProperty("TOTPkey"),
|
|
||||||
// crypo.getProgrammSchluessel()); //liest schluessel von property
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -720,21 +713,21 @@ public class MainWindowController
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void starteDB()
|
|
||||||
{ // Startet die Datenbank
|
|
||||||
dbc.verbindeDatenbank();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDatabaseName()
|
public String getDatabaseName()
|
||||||
{
|
{
|
||||||
return databaseName;
|
return databaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDatabaseName(String NewDatabaseName)
|
public void setDatabaseName(String NewDatabaseName)
|
||||||
{
|
{
|
||||||
databaseName = NewDatabaseName;
|
databaseName = NewDatabaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setDBLabel() throws Exception
|
public void setDBLabel() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -754,8 +747,8 @@ public class MainWindowController
|
||||||
} else {
|
} else {
|
||||||
labelDBStatus.setText("Keine Datenbank gefunden!");
|
labelDBStatus.setText("Keine Datenbank gefunden!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getColorCodes(String pColorName)
|
private String getColorCodes(String pColorName)
|
||||||
{
|
{
|
||||||
|
@ -781,6 +774,8 @@ public class MainWindowController
|
||||||
return "#FFFFFF";
|
return "#FFFFFF";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String getColorNames(String pColorCode)
|
private String getColorNames(String pColorCode)
|
||||||
{
|
{
|
||||||
|
@ -806,6 +801,7 @@ public class MainWindowController
|
||||||
return "Farbe";
|
return "Farbe";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Integer getColorID(String pColorCode)
|
private Integer getColorID(String pColorCode)
|
||||||
{
|
{
|
||||||
|
@ -830,12 +826,11 @@ public class MainWindowController
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void blockUI(boolean pState)
|
public void blockUI(boolean pState)
|
||||||
{
|
{
|
||||||
|
|
||||||
btnCalcStats.setDisable(pState);
|
btnCalcStats.setDisable(pState);
|
||||||
btnClearEntry.setDisable(pState);
|
btnClearEntry.setDisable(pState);
|
||||||
btnDeleteSelectedPosition.setDisable(pState);
|
btnDeleteSelectedPosition.setDisable(pState);
|
||||||
|
@ -881,7 +876,6 @@ public class MainWindowController
|
||||||
labelJobCounter.setVisible(!pState);
|
labelJobCounter.setVisible(!pState);
|
||||||
|
|
||||||
titlePaneStats.setVisible(!pState);
|
titlePaneStats.setVisible(!pState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue