first commit

This commit is contained in:
Hendrik Schutter 2018-03-29 19:45:41 +02:00 committed by GitHub
parent 3f1fd8f9c0
commit d9e84b899d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 988 additions and 0 deletions

Binary file not shown.

Binary file not shown.

BIN
bin/application/Main.class Normal file

Binary file not shown.

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TreeTableColumn?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="mainAnchorpane" maxHeight="520.0" maxWidth="950.0" minHeight="864.0" minWidth="1536.0" prefHeight="520.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<children>
<TreeTableView fx:id="mainTreeTable" layoutX="1181.0" layoutY="353.0" prefHeight="450.0" prefWidth="330.0">
<columns>
<TreeTableColumn fx:id="datumSpalte" prefWidth="160.0" text="Datum" />
<TreeTableColumn fx:id="kontoSpalte" prefWidth="169.0" text="Konto" />
</columns>
</TreeTableView>
<Button fx:id="ueberbtn" layoutX="1354.0" layoutY="71.0" mnemonicParsing="false" onAction="#ueberbtnAction" text="Über" />
<GridPane gridLinesVisible="true" layoutX="9.0" layoutY="7.0" prefHeight="850.0" prefWidth="1100.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<JFXButton fx:id="gridButton02" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton02Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton01" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton01Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton03" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton03Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton04" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton04Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton05" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton05Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton06" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton06Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton07" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton07Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton08" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton08Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton09" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton09Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton10" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton10Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton11" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton11Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton12" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton12Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton13" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton13Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton14" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton14Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton15" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton15Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton16" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton16Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton17" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton17Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton18" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton18Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton19" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton19Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton20" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton20Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton21" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton21Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton23" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton23Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton24" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton24Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton25" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton25Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton22" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton22Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
</children>
</GridPane>
</children>
</AnchorPane>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

8
build.fxbuild Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="FxPWMaster01"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>

View File

@ -0,0 +1,304 @@
package application;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.io.File;
import java.io.FileInputStream;
class DBController {
private Connection connection;
private String DB_PATH_Win = "C:/ProgramData/PWMaster/datenbank.db";
private String DB_PATH_Linux = System.getProperty("user.home") + "/bin/PWMaster/datenbank.db";
private Main main;
//private Cryption crypo = new Cryption();
private String schluessel; //Für Ver-/Entschlüsselung
public void main() {
try {
if(System.getProperty("os.name").equals("Linux")) {
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_Linux);
} else {
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_Win);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
DBController(Main main){
this.main = main;
}
public void verbindeDatenbank() { //Verbinde mit der Datenbank-Datei
try {
if (connection != null)
return;
if(System.getProperty("os.name").equals("Linux")) {
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_Linux);
} else {
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH_Win);
}
if (!connection.isClosed())
System.out.println();
} catch (SQLException e) {
throw new RuntimeException(e);
}
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
if (!connection.isClosed() && connection != null) {
connection.close();
if (connection.isClosed())
System.out.println();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
});
}
public void fuellenDatenbank(int pID, String pDatum, String pKonto, String pNutzername, String pEmail, String pPasswort) { //Neuen Eintrag erstellen
try {
PreparedStatement ps = connection.prepareStatement("INSERT INTO konten VALUES (?, ?, ?, ?, ?, ?);");
ps.setInt(1, pID); //Primärschlässel
ps.setString(2, pDatum);
ps.setString(3, pKonto);
ps.setString(4, pNutzername);
ps.setString(5, pEmail);
ps.setString(6, pPasswort);
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 erstelleDatenbank(){ //Erstelle Tabelle mit Reihen
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("DROP TABLE IF EXISTS konten;");
stmt.executeUpdate("CREATE TABLE konten (id, datum, konto, nutzername, email, passwort);");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
public boolean existiertDatenbank(String pPfad){ //Prüft ob die Datenbank existiert
File varTmpDir = new File(pPfad);
if(!varTmpDir.exists()){
return false;
}else{
return true;
}
}
private void ausgebenSyso(){ //Debugging Ausgabe der kompletten Datenbank
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM konten;");
while (rs.next()) {
System.out.println("Datum = " + rs.getString("datum"));
System.out.println("Konto = " + rs.getString("konto"));
System.out.println("Nutzername = " + rs.getString("nutzername"));
System.out.println("E-Mail = " + rs.getString("email"));
System.out.println("Passwort = " + rs.getString("passwort"));
System.out.println(" ");
}
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
public String getDatum(int pID){ //Gibt das Datum zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id, datum FROM konten WHERE id = "+pID+";" );
return rs.getString("datum");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "Error 404";
}
}
public String getKonto(int pID){ //Gibt das Konto zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id, konto FROM konten WHERE id = "+pID+";" );
return rs.getString("konto");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "Error 404";
}
}
public String getNutzername(int pID){ //Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id, nutzername FROM konten WHERE id = "+pID+";" );
return rs.getString("nutzername");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "Error 404";
}
}
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 setDatum(int pID, String pDatum){ //Setzt das Datum
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE konten SET datum = '"+pDatum+"'WHERE id ="+pID+";");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
public void setKonto(int pID, String pKonto){ //Setzt das Konto
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE konten SET konto = '"+pKonto+"'WHERE id ="+pID+";");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
public void setNutername(int pID, String pNutername){ //Setzt den Nutzername
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE konten SET nutzername = '"+pNutername+"'WHERE id ="+pID+";");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
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<tableData> ladeTabelle(){ //Gibt ein Objekt daten mit allen Einträgen der DB zurück
ArrayList<tableData> daten = new ArrayList<>();
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM konten;");
while (rs.next()) {
try {
// Entschlüsselte Daten werden als Datenobjekt gespeichert
//daten.add(new tableData(rs.getInt("id"), crypo.entschluesseln(rs.getString("datum"), schluessel), crypo.entschluesseln(rs.getString("konto"),schluessel)));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
return daten;
}
public void setSchluessel(String pSchluessel){ //Setzt den Schlüssel für die Ver-/Entschlüsslung
schluessel = pSchluessel;
}
}

95
src/application/Main.java Normal file
View File

@ -0,0 +1,95 @@
package application;
import java.io.File;
import java.io.FileInputStream;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.util.Optional;
import java.util.Random;
import com.j256.twofactorauth.TimeBasedOneTimePasswordUtil;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.stage.Stage;
import javafx.util.Pair;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
public class Main extends Application {
private MainWindowController mwc;
private DBController dbc = new DBController(this);
private String schluesselNutzer; //Passwort des Nutzers
private Stage primaryStage;
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
mainWindow();
}
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("MainWindow.fxml"));
AnchorPane pane = loader.load();
//primaryStage.setWidth(1536);
//primaryStage.setHeight(864);
primaryStage.setTitle("jFxKasse"); //Title der Stage
mwc = loader.getController();
mwc.setMain(this, dbc);
firstStart(); //Prüft ob das Programm zuvor gestartet wurde
dbc.main(); //Startet die Datenbank
mwc.initUI(); //Startet die UI
mwc.fuelleTablle(); //Ladt die Einträge in die Tabelle
Scene scene = new Scene(pane);
scene.getStylesheets().add(Main.class.getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show(); //zeigt die Stage an
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
private void firstStart() throws Exception{
if(mwc.loadSettings()){ //Wenn XML gefunden
dbc.verbindeDatenbank(); //Verbindet mit der Datenbank-Datei
}else{ //Wenn keine XML gefunden --> erster Start
System.out.println("keine XML gefunden!");
if(System.getProperty("os.name").equals("Linux")) {
File dir = new File(System.getProperty("user.home") + "/bin/PWMaster"); //Erstellt den Unterordner
dir.mkdir(); //Erstellt den Unterordner
} else {
File dir = new File("C:/ProgramData/PWMaster/"); //Erstellt den Unterordner
dir.mkdir(); //Erstellt den Unterordner
}
mwc.saveSettings(schluesselNutzer, "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
}
}
}

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TreeTableColumn?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="mainAnchorpane" maxHeight="520.0" maxWidth="950.0" minHeight="864.0" minWidth="1536.0" prefHeight="520.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<children>
<TreeTableView fx:id="mainTreeTable" layoutX="1181.0" layoutY="353.0" prefHeight="450.0" prefWidth="330.0">
<columns>
<TreeTableColumn fx:id="datumSpalte" prefWidth="160.0" text="Datum" />
<TreeTableColumn fx:id="kontoSpalte" prefWidth="169.0" text="Konto" />
</columns>
</TreeTableView>
<Button fx:id="ueberbtn" layoutX="1354.0" layoutY="71.0" mnemonicParsing="false" onAction="#ueberbtnAction" text="Über" />
<GridPane gridLinesVisible="true" layoutX="9.0" layoutY="7.0" prefHeight="850.0" prefWidth="1100.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<JFXButton fx:id="gridButton02" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton02Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton01" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton01Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton03" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton03Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton04" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton04Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton05" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton05Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton06" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton06Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton07" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton07Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton08" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton08Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton09" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton09Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton10" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton10Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton11" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton11Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton12" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton12Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton13" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton13Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton14" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton14Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton15" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton15Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton16" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton16Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton17" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton17Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton18" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton18Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton19" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton19Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton20" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton20Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton21" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton21Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton23" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton23Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton24" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton24Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton25" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton25Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton22" buttonType="RAISED" maxWidth="235.0" minWidth="200.0" onAction="#gridButton22Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="Rote Wurst 2,60€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="30.0" />
</font>
</JFXButton>
</children>
</GridPane>
</children>
</AnchorPane>

View File

@ -0,0 +1,201 @@
package application;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableView;
import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem;
import java.awt.Desktop;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.DriverManager;
import java.util.Optional;
import java.util.Properties;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.util.Pair;
public class MainWindowController {
private static final String String = null;
Toolkit toolkit = Toolkit.getDefaultToolkit();
Clipboard clipboard = toolkit.getSystemClipboard();
@FXML
private AnchorPane mainAnchorpane;
@FXML
private TreeTableView<tableData> mainTreeTable;
@FXML
private TreeTableColumn<tableData, String> datumSpalte;
@FXML
private TreeTableColumn<tableData, String> kontoSpalte;
@FXML
private TreeTableColumn<tableData, Integer> idSpalte = new TreeTableColumn<>("");
@FXML
private Button ueberbtn;
private Main main;
private DBController dbc;
private String filepathXMLWin = "C:/ProgramData/PWMaster/config.xml"; //Pfad wo die XML liegt
private String filepathXMLLinux = System.getProperty("user.home") + "/bin/PWMaster/config.xml"; //Pfad wo die XML liegt
private boolean showPasswort = false;
private String schluessel;
private String base32Secret;
private int id;
@FXML
TreeItem<tableData> root = new TreeItem<>(new tableData(0, "0", "0"));
Properties props = new Properties();
@FXML
public void ueberbtnAction(ActionEvent event) { //Öffnet den Über-Dialog
// Erstellt einen Dialog
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("Über PWMaster");
dialog.setHeaderText("Informationen und Lizenzen - Version 0.5");
// Erzeugt den Button
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
// Erzeugt die Textfelder und Label
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
grid.add(new Label("Datenbank: sqlite.org - Public Domain"
+"\nBASE64Decoder: java2s.com/Code/Jar/s/DownloadsunmiscBASE64Decoderjar.htm - GPLv2"
+"\nCrypo: blog.axxg.de/ - Copyright 2013 AxxG Alexander Grösel"
+" \nzwei Faktoren: github.com/j256/two-factor-auth - ISC License"
+" \nUI Design: eclipse.org/efxclipse/install.html - Eclipse Public License 1.0"
+" \nUI - Datenbank Integration: basierend auf Project-HomeFlix - github.com/Seil0/Project-HomeFlix - GPLv3 \n"
+" \nMaintainer: hendrik.schutter@icloud.com"
+" \n(c) 2017 Hendrik Schutter"), 0, 0);
dialog.getDialogPane().setContent(grid); //Setzt die GridPane auf die DialogPane
dialog.showAndWait();
}
@FXML
public void fuelleTablle(){ //Lädt die Datenbank in die Tabelle
dbc.setSchluessel(schluessel);
for(int i = 0; i < dbc.ladeTabelle().size(); i++){
tableData helpTableData = new tableData(dbc.ladeTabelle().get(i).getID(),
dbc.ladeTabelle().get(i).getDatum(), dbc.ladeTabelle().get(i).getKonto());
root.getChildren().add(new TreeItem<tableData>(helpTableData));
}
}
public void initUI(){
mainTreeTable.setRoot(root);
mainTreeTable.setShowRoot(false);
mainTreeTable.setEditable(false);
//Setzt die Textfelder
idSpalte.setCellValueFactory(cellData -> cellData.getValue().getValue().idProperty().asObject());
datumSpalte.setCellValueFactory(cellData -> cellData.getValue().getValue().datumProperty());
kontoSpalte.setCellValueFactory(cellData -> cellData.getValue().getValue().kontoProperty());
mainTreeTable.getColumns().add(idSpalte);
mainTreeTable.getColumns().get(2).setVisible(false);
mainTreeTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
@Override
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal){
// last = selected; //for auto-play
int selected = mainTreeTable.getSelectionModel().getSelectedIndex(); //get selected item
id = idSpalte.getCellData(selected); //Ausgewählte Spalte
showPasswort =false;
try { //Setzt den entschlüsselten Inhalt in die Textfelder
//tf01.setText("Verschlüsseltes Passwort von " + crypo.entschluesseln(dbc.getKonto(id), schluessel) + " : " + dbc.getPasswort(id));
//tfNutzername.setText(crypo.entschluesseln(dbc.getNutzername(id), schluessel));
//tfEmail.setText(crypo.entschluesseln(dbc.getEmail(id), schluessel));
//tfPasswort.setText(crypo.entschluesseln(dbc.getPasswort(id), schluessel));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
public void setMain(Main main, DBController dbc){
this.main = main;
this.dbc = dbc;
}
public String getSystemDatum(){ //Gibt das System-Datum zurück
java.util.Date now = new java.util.Date();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd.MM.yyyy");
String heutigesDatum = sdf.format(now);
return heutigesDatum;
}
public void saveSettings(String schluessel, String base32Secret) throws Exception{
OutputStream outputStream; //new output-stream
try {
//props.setProperty("key", crypo.verschluesseln(schluessel, crypo.getProgrammSchluessel())); //writes path into property
//props.setProperty("TOTPkey", crypo.verschluesseln(base32Secret, crypo.getProgrammSchluessel())); //writes path into property
if(System.getProperty("os.name").equals("Linux")) {
outputStream = new FileOutputStream(filepathXMLLinux);
} else {
outputStream = new FileOutputStream(filepathXMLWin);
}
props.storeToXML(outputStream, "PWMaster settings"); //writes new .xml
outputStream.close();
} catch (IOException e) {
}
}
public boolean loadSettings() throws Exception{ //Ladt die Daten aus der XML
InputStream inputStream;
try {
if(System.getProperty("os.name").equals("Linux")) {
inputStream = new FileInputStream(filepathXMLLinux);
} else {
inputStream = new FileInputStream(filepathXMLWin);
}
props.loadFromXML(inputStream);
//schluessel = 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();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
public String getSchluesselXML(){ //Gibt den Schlüssel zurück für die Main
return schluessel;
}
public void starteDB(){ //Startet die Datenbank
dbc.verbindeDatenbank();
}
public void erzeugeDB(){ //Erzeuge die Datenbank
dbc.erstelleDatenbank();
dbc.verbindeDatenbank();
}
public String getbase32Secret(){ //Gibt den base32Secret zurück für die Main
return base32Secret;
}
}

View File

@ -0,0 +1 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

View File

@ -0,0 +1,46 @@
package application;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class tableData { //Datenobjekt mit der ID, Datum und Konto
private final IntegerProperty id = new SimpleIntegerProperty();
private final StringProperty datum = new SimpleStringProperty();
private final StringProperty konto = new SimpleStringProperty();
public tableData(final int id, final String datum, final String konto){
this.id.set(id);
this.datum.set(datum);
this.konto.set(konto);
}
public IntegerProperty idProperty(){
return id;
}
public StringProperty datumProperty(){
return datum;
}
public StringProperty kontoProperty(){
return konto;
}
public int getID(){
return idProperty().get();
}
public String getDatum(){
return datumProperty().get();
}
public String getKonto(){
return kontoProperty().get();
}
public final void setID(int id){
idProperty().set(id);
}
public final void setdatum(String datum){
datumProperty().set(datum);
}
public final void setkonto(String konto){
kontoProperty().set(konto);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B