first commit
parent
e53dc33df3
commit
efb96575c5
|
@ -1 +1,28 @@
|
|||
/Flugbuch/
|
||||
*target*
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.class
|
||||
|
||||
# eclipse specific git ignore
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/**
|
||||
tmp/**
|
||||
tmp/**/*
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="C:/Users/asus/Downloads/sqljdbc_12.6.2.0_enu/sqljdbc_12.6/enu/jars/mssql-jdbc-12.6.2.jre11.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/asus/Downloads/sqljdbc_12.6.2.0_enu/sqljdbc_12.6/enu/jars/mssql-jdbc-12.6.2.jre8.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/asus/Downloads/sqlite-jdbc-3.36.0.3.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1 +0,0 @@
|
|||
/bin/
|
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
|
@ -1,8 +0,0 @@
|
|||
<?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="Digitales_Fluglogbuch"/>
|
||||
<info/>
|
||||
</deploy>
|
||||
<signjar/>
|
||||
</anttasks:AntTask>
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
--module-path "C:\Users\asus\OneDrive\Desktop\openjfx-22.0.1_windows-x64_bin-sdk\javafx-sdk-22.0.1\lib" --add-modules javafx.controls,javafx.graphics,javafx.fxml
|
|
@ -0,0 +1,71 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Controller;
|
||||
|
||||
import View.FluglogbuchUI;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
import Model.Database;
|
||||
|
||||
public class FluglogbuchController extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
Database.createDatabase();
|
||||
showWelcomeScreen(primaryStage);
|
||||
}
|
||||
|
||||
private void showWelcomeScreen(Stage primaryStage) {
|
||||
VBox vbox = new VBox(20);
|
||||
vbox.setAlignment(Pos.CENTER);
|
||||
vbox.setPadding(new Insets(20));
|
||||
|
||||
Label welcomeLabel = new Label("Willkommen zur Software:\nDigitales Fluglogbuch Version 1.0");
|
||||
welcomeLabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold; -fx-text-alignment: center;");
|
||||
Label createdByLabel = new Label("Erstellt von:\nEldarDavudVlada Software GmbH");
|
||||
createdByLabel.setStyle("-fx-font-size: 14px; -fx-text-alignment: center;");
|
||||
|
||||
Button continueButton = new Button("Weiter");
|
||||
continueButton.setStyle(
|
||||
"-fx-font-size: 14px; -fx-padding: 10 20 10 20; -fx-background-color: #0073e6; -fx-text-fill: white;");
|
||||
continueButton.setOnMouseEntered(e -> continueButton.setStyle(
|
||||
"-fx-font-size: 14px; -fx-padding: 10 20 10 20; -fx-background-color: #005bb5; -fx-text-fill: white;"));
|
||||
continueButton.setOnMouseExited(e -> continueButton.setStyle(
|
||||
"-fx-font-size: 14px; -fx-padding: 10 20 10 20; -fx-background-color: #0073e6; -fx-text-fill: white;"));
|
||||
|
||||
vbox.getChildren().addAll(welcomeLabel, createdByLabel, continueButton);
|
||||
|
||||
Scene welcomeScene = new Scene(vbox, 500, 300);
|
||||
primaryStage.setScene(welcomeScene);
|
||||
primaryStage.show();
|
||||
|
||||
continueButton.setOnAction(e -> showMainApplication(primaryStage));
|
||||
}
|
||||
|
||||
private void showMainApplication(Stage primaryStage) {
|
||||
FluglogbuchUI view = new FluglogbuchUI();
|
||||
|
||||
TabPane tabPane = new TabPane();
|
||||
Tab pilotenTab = new Tab("Pilotenverwaltung", view.createPilotenverwaltungPane());
|
||||
Tab lizenzenTab = new Tab("Lizenzverwaltung", view.createLizenzverwaltungPane());
|
||||
Tab berechtigungenTab = new Tab("Berechtigungsverwaltung", view.createBerechtigungsverwaltungPane());
|
||||
Tab logbuchTab = new Tab("Logbucheinträge", view.createLogbucheintragPane());
|
||||
|
||||
tabPane.getTabs().addAll(pilotenTab, lizenzenTab, berechtigungenTab, logbuchTab);
|
||||
|
||||
view.start(primaryStage, tabPane);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Berechtigung {
|
||||
public static void speichereBerechtigung(String berechtigung, String unterschrift, String datumDerPruefung,
|
||||
String gueltigkeitsdatum, String ermaechtigungsnummer) {
|
||||
String sql = "INSERT INTO berechtigungen(berechtigung, unterschrift, datum_der_pruefung, gueltigkeitsdatum, ermaechtigungsnummer) VALUES(?,?,?,?,?)";
|
||||
|
||||
try (Connection conn = Database.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||
pstmt.setString(1, berechtigung);
|
||||
pstmt.setString(2, unterschrift);
|
||||
pstmt.setString(3, datumDerPruefung);
|
||||
pstmt.setString(4, gueltigkeitsdatum);
|
||||
pstmt.setString(5, ermaechtigungsnummer);
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Database {
|
||||
private static final String DB_URL = "jdbc:sqlite:C:\\Users\\asus\\fluglogbuch.db";
|
||||
|
||||
public static void createDatabase() {
|
||||
|
||||
String pilotTable = "CREATE TABLE IF NOT EXISTS piloten (\n"
|
||||
+ " id INTEGER PRIMARY KEY AUTOINCREMENT,\n"
|
||||
+ " vorname TEXT NOT NULL,\n"
|
||||
+ " nachname TEXT NOT NULL,\n"
|
||||
+ " strasse TEXT NOT NULL,\n"
|
||||
+ " stadt TEXT NOT NULL,\n"
|
||||
+ " plz TEXT NOT NULL,\n"
|
||||
+ " hausnummer TEXT NOT NULL,\n"
|
||||
+ " geburtsdatum TEXT NOT NULL,\n"
|
||||
+ " geburtsort TEXT NOT NULL,\n"
|
||||
+ " unterschrift TEXT NOT NULL\n"
|
||||
+ ");";
|
||||
|
||||
String lizenzTable = "CREATE TABLE IF NOT EXISTS lizenzen (\n"
|
||||
+ " id INTEGER PRIMARY KEY AUTOINCREMENT,\n"
|
||||
+ " art_der_lizenz TEXT NOT NULL,\n"
|
||||
+ " ausstellungsbehoerde TEXT NOT NULL,\n"
|
||||
+ " ausstellungsdatum TEXT NOT NULL,\n"
|
||||
+ " lizenznummer TEXT NOT NULL\n"
|
||||
+ ");";
|
||||
|
||||
String berechtigungTable = "CREATE TABLE IF NOT EXISTS berechtigungen (\n"
|
||||
+ " id INTEGER PRIMARY KEY AUTOINCREMENT,\n"
|
||||
+ " berechtigung TEXT NOT NULL,\n"
|
||||
+ " unterschrift TEXT NOT NULL,\n"
|
||||
+ " datum_der_pruefung TEXT NOT NULL,\n"
|
||||
+ " gueltigkeitsdatum TEXT NOT NULL,\n"
|
||||
+ " ermaechtigungsnummer TEXT NOT NULL\n"
|
||||
+ ");";
|
||||
|
||||
String logbuchTable = "CREATE TABLE IF NOT EXISTS logbuch_Eintraege (\n"
|
||||
+ " id INTEGER PRIMARY KEY AUTOINCREMENT,\n"
|
||||
+ " kennzeichen TEXT NOT NULL,\n"
|
||||
+ " start_flughafen TEXT NOT NULL,\n"
|
||||
+ " end_flughafen TEXT NOT NULL,\n"
|
||||
+ " start_zeit TEXT NOT NULL,\n"
|
||||
+ " end_zeit TEXT NOT NULL,\n"
|
||||
+ " anzahl_landungen INTEGER NOT NULL,\n"
|
||||
+ " pilot TEXT NOT NULL,\n"
|
||||
+ " datum TEXT NOT NULL,\n"
|
||||
+ " unterschrift TEXT NOT NULL\n"
|
||||
+ ");";
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(DB_URL);
|
||||
PreparedStatement st1 = conn.prepareStatement(pilotTable);
|
||||
PreparedStatement st2 = conn.prepareStatement(lizenzTable);
|
||||
PreparedStatement st3 = conn.prepareStatement(berechtigungTable);
|
||||
PreparedStatement st4 = conn.prepareStatement(logbuchTable)) {
|
||||
|
||||
st1.execute();
|
||||
st2.execute();
|
||||
st3.execute();
|
||||
st4.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Connection connect() {
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(DB_URL);
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Lizenz {
|
||||
public static void speichereLizenz(String artDerLizenz, String ausstellungsbehoerde, String ausstellungsdatum,
|
||||
String lizenznummer) {
|
||||
String sql = "INSERT INTO lizenzen(art_der_lizenz, ausstellungsbehoerde, ausstellungsdatum, lizenznummer) VALUES(?,?,?,?)";
|
||||
|
||||
try (Connection conn = Database.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||
pstmt.setString(1, artDerLizenz);
|
||||
pstmt.setString(2, ausstellungsbehoerde);
|
||||
pstmt.setString(3, ausstellungsdatum);
|
||||
pstmt.setString(4, lizenznummer);
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Logbuch {
|
||||
public static void speichereLogbuchEintrag(String kennzeichen, String startFlughafen, String endFlughafen,
|
||||
String startZeit, String endZeit, int anzahlLandungen, String pilot, String datum, String unterschrift) {
|
||||
String sql = "INSERT INTO logbuch_Eintraege(kennzeichen, start_flughafen, end_flughafen, start_zeit, end_zeit, anzahl_landungen, pilot, datum, unterschrift) VALUES(?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
try (Connection conn = Database.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||
pstmt.setString(1, kennzeichen);
|
||||
pstmt.setString(2, startFlughafen);
|
||||
pstmt.setString(3, endFlughafen);
|
||||
pstmt.setString(4, startZeit);
|
||||
pstmt.setString(5, endZeit);
|
||||
pstmt.setInt(6, anzahlLandungen);
|
||||
pstmt.setString(7, pilot);
|
||||
pstmt.setString(8, datum);
|
||||
pstmt.setString(9, unterschrift);
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package Model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Pilot {
|
||||
public static void speicherePilot(String vorname, String nachname, String strasse, String stadt, String plz,
|
||||
String hausnummer, String geburtsdatum, String geburtsort, String unterschrift) {
|
||||
String sql = "INSERT INTO piloten(vorname, nachname, strasse, stadt, plz, hausnummer, geburtsdatum, geburtsort, unterschrift) VALUES(?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
try (Connection conn = Database.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||
pstmt.setString(1, vorname);
|
||||
pstmt.setString(2, nachname);
|
||||
pstmt.setString(3, strasse);
|
||||
pstmt.setString(4, stadt);
|
||||
pstmt.setString(5, plz);
|
||||
pstmt.setString(6, hausnummer);
|
||||
pstmt.setString(7, geburtsdatum);
|
||||
pstmt.setString(8, geburtsort);
|
||||
pstmt.setString(9, unterschrift);
|
||||
pstmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
// Fluglogbuch Software Studienleistung
|
||||
// Sabic Eldar (3009675), Hajrovic Davud (3013128), Keiserman Vlada (3012879)
|
||||
|
||||
package View;
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.Stage;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FluglogbuchUI {
|
||||
|
||||
public void start(Stage primaryStage, TabPane tabPane) {
|
||||
primaryStage.setTitle("Digitales Fluglogbuch");
|
||||
|
||||
Scene scene = new Scene(tabPane, 800, 600);
|
||||
scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public GridPane createPilotenverwaltungPane() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(20));
|
||||
grid.setVgap(15);
|
||||
grid.setHgap(15);
|
||||
grid.setAlignment(Pos.CENTER);
|
||||
|
||||
TextField vornameField = new TextField();
|
||||
TextField nachnameField = new TextField();
|
||||
TextField strasseField = new TextField();
|
||||
TextField stadtField = new TextField();
|
||||
TextField plzField = new TextField();
|
||||
TextField hausnummerField = new TextField();
|
||||
DatePicker geburtsdatumPicker = new DatePicker();
|
||||
TextField geburtsortField = new TextField();
|
||||
TextField unterschriftField = new TextField();
|
||||
|
||||
grid.add(createStyledLabel("Vorname:"), 0, 0);
|
||||
grid.add(vornameField, 1, 0);
|
||||
grid.add(createStyledLabel("Nachname:"), 0, 1);
|
||||
grid.add(nachnameField, 1, 1);
|
||||
grid.add(createStyledLabel("Straße:"), 0, 2);
|
||||
grid.add(strasseField, 1, 2);
|
||||
grid.add(createStyledLabel("Stadt:"), 0, 3);
|
||||
grid.add(stadtField, 1, 3);
|
||||
grid.add(createStyledLabel("Postleitzahl:"), 0, 4);
|
||||
grid.add(plzField, 1, 4);
|
||||
grid.add(createStyledLabel("Hausnummer:"), 0, 5);
|
||||
grid.add(hausnummerField, 1, 5);
|
||||
grid.add(createStyledLabel("Geburtsdatum:"), 0, 6);
|
||||
grid.add(geburtsdatumPicker, 1, 6);
|
||||
grid.add(createStyledLabel("Geburtsort:"), 0, 7);
|
||||
grid.add(geburtsortField, 1, 7);
|
||||
grid.add(createStyledLabel("Unterschrift:"), 0, 8);
|
||||
grid.add(unterschriftField, 1, 8);
|
||||
|
||||
Button speichernButton = new Button("Speichern");
|
||||
speichernButton.getStyleClass().add("save-button");
|
||||
|
||||
HBox buttonBox = new HBox(speichernButton);
|
||||
buttonBox.setAlignment(Pos.CENTER);
|
||||
buttonBox.setPadding(new Insets(10, 0, 0, 0));
|
||||
|
||||
grid.add(buttonBox, 1, 9);
|
||||
|
||||
speichernButton.setOnAction(e -> {
|
||||
String vorname = vornameField.getText();
|
||||
String nachname = nachnameField.getText();
|
||||
String strasse = strasseField.getText();
|
||||
String stadt = stadtField.getText();
|
||||
String plz = plzField.getText();
|
||||
String hausnummer = hausnummerField.getText();
|
||||
String geburtsdatum = geburtsdatumPicker.getValue() != null ? geburtsdatumPicker.getValue().toString() : "";
|
||||
String geburtsort = geburtsortField.getText();
|
||||
String unterschrift = unterschriftField.getText();
|
||||
|
||||
if (isInputValidPilot(vorname, nachname, strasse, stadt, geburtsort, unterschrift)
|
||||
&& isAllFieldsFilled(vorname, nachname, strasse, stadt, geburtsort, unterschrift)) {
|
||||
Model.Pilot.speicherePilot(vorname, nachname, strasse, stadt, plz, hausnummer, geburtsdatum, geburtsort,
|
||||
unterschrift);
|
||||
showAlert(Alert.AlertType.INFORMATION, "Erfolg", "Daten erfolgreich gespeichert");
|
||||
}
|
||||
});
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private Label createStyledLabel(String text) {
|
||||
Label label = new Label(text);
|
||||
label.setStyle("-fx-font-weight: bold; -fx-font-size: 14px;");
|
||||
return label;
|
||||
}
|
||||
|
||||
private boolean isInputValidPilot(String... inputs) {
|
||||
Pattern numericPattern = Pattern.compile(".*\\d.*");
|
||||
|
||||
for (String input : inputs) {
|
||||
if (input == null || input.trim().isEmpty()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler", "Alle Felder müssen ausgefüllt sein.");
|
||||
return false;
|
||||
}
|
||||
if (numericPattern.matcher(input).matches()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler",
|
||||
"In den Feldern Vorname, Nachname, Straße, Stadt, Geburtsort und Unterschrift dürfen keine Zahlen stehen.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showAlert(Alert.AlertType alertType, String title, String message) {
|
||||
Alert alert = new Alert(alertType);
|
||||
alert.setTitle(title);
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(message);
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
public GridPane createLizenzverwaltungPane() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(20));
|
||||
grid.setVgap(15);
|
||||
grid.setHgap(15);
|
||||
grid.setAlignment(Pos.CENTER);
|
||||
|
||||
TextField artDerLizenzField = new TextField();
|
||||
TextField ausstellungsbehoerdeField = new TextField();
|
||||
DatePicker ausstellungsdatumPicker = new DatePicker();
|
||||
TextField lizenznummerField = new TextField();
|
||||
|
||||
grid.add(createStyledLabel("Art der Lizenz:"), 0, 0);
|
||||
grid.add(artDerLizenzField, 1, 0);
|
||||
grid.add(createStyledLabel("Ausstellungsbehörde:"), 0, 1);
|
||||
grid.add(ausstellungsbehoerdeField, 1, 1);
|
||||
grid.add(createStyledLabel("Ausstellungsdatum:"), 0, 2);
|
||||
grid.add(ausstellungsdatumPicker, 1, 2);
|
||||
grid.add(createStyledLabel("Lizenznummer:"), 0, 3);
|
||||
grid.add(lizenznummerField, 1, 3);
|
||||
|
||||
Button speichernButton = new Button("Speichern");
|
||||
speichernButton.getStyleClass().add("save-button");
|
||||
|
||||
HBox buttonBox = new HBox(speichernButton);
|
||||
buttonBox.setAlignment(Pos.CENTER);
|
||||
buttonBox.setPadding(new Insets(10, 0, 0, 0));
|
||||
|
||||
grid.add(buttonBox, 1, 4);
|
||||
|
||||
speichernButton.setOnAction(e -> {
|
||||
String artDerLizenz = artDerLizenzField.getText();
|
||||
String ausstellungsbehoerde = ausstellungsbehoerdeField.getText();
|
||||
String ausstellungsdatum = ausstellungsdatumPicker.getValue() != null
|
||||
? ausstellungsdatumPicker.getValue().toString()
|
||||
: "";
|
||||
String lizenznummer = lizenznummerField.getText();
|
||||
|
||||
if (isInputValidLizenz(artDerLizenz, ausstellungsbehoerde)
|
||||
&& isAllFieldsFilled(artDerLizenz, ausstellungsbehoerde, ausstellungsdatum, lizenznummer)) {
|
||||
Model.Lizenz.speichereLizenz(artDerLizenz, ausstellungsbehoerde, ausstellungsdatum, lizenznummer);
|
||||
showAlert(Alert.AlertType.INFORMATION, "Erfolg", "Daten erfolgreich gespeichert");
|
||||
}
|
||||
});
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private boolean isInputValidLizenz(String... inputs) {
|
||||
Pattern numericPattern = Pattern.compile(".*\\d.*");
|
||||
|
||||
for (String input : inputs) {
|
||||
if (input == null || input.trim().isEmpty()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler", "Alle Felder müssen ausgefüllt sein.");
|
||||
return false;
|
||||
}
|
||||
if (numericPattern.matcher(input).matches()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler",
|
||||
"In den Feldern Ausstellungsbehörde und Art der Lizenz dürfen keine Zahlen stehen.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public GridPane createBerechtigungsverwaltungPane() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(20));
|
||||
grid.setVgap(15);
|
||||
grid.setHgap(15);
|
||||
grid.setAlignment(Pos.CENTER);
|
||||
|
||||
TextField berechtigungField = new TextField();
|
||||
TextField unterschriftField = new TextField();
|
||||
DatePicker datumDerPruefungPicker = new DatePicker();
|
||||
DatePicker gueltigkeitsdatumPicker = new DatePicker();
|
||||
TextField ermaechtigungsnummerField = new TextField();
|
||||
|
||||
grid.add(createStyledLabel("Berechtigung:"), 0, 0);
|
||||
grid.add(berechtigungField, 1, 0);
|
||||
grid.add(createStyledLabel("Unterschrift:"), 0, 1);
|
||||
grid.add(unterschriftField, 1, 1);
|
||||
grid.add(createStyledLabel("Datum der Prüfung:"), 0, 2);
|
||||
grid.add(datumDerPruefungPicker, 1, 2);
|
||||
grid.add(createStyledLabel("Gültigkeitsdatum:"), 0, 3);
|
||||
grid.add(gueltigkeitsdatumPicker, 1, 3);
|
||||
grid.add(createStyledLabel("Ermächtigungsnummer:"), 0, 4);
|
||||
grid.add(ermaechtigungsnummerField, 1, 4);
|
||||
|
||||
Button speichernButton = new Button("Speichern");
|
||||
speichernButton.getStyleClass().add("save-button");
|
||||
|
||||
HBox buttonBox = new HBox(speichernButton);
|
||||
buttonBox.setAlignment(Pos.CENTER);
|
||||
buttonBox.setPadding(new Insets(10, 0, 0, 0));
|
||||
|
||||
grid.add(buttonBox, 1, 5);
|
||||
|
||||
speichernButton.setOnAction(e -> {
|
||||
String berechtigung = berechtigungField.getText();
|
||||
String unterschrift = unterschriftField.getText();
|
||||
String datumDerPruefung = datumDerPruefungPicker.getValue() != null
|
||||
? datumDerPruefungPicker.getValue().toString()
|
||||
: "";
|
||||
String gueltigkeitsdatum = gueltigkeitsdatumPicker.getValue() != null
|
||||
? gueltigkeitsdatumPicker.getValue().toString()
|
||||
: "";
|
||||
String ermaechtigungsnummer = ermaechtigungsnummerField.getText();
|
||||
|
||||
if (isInputValidBerechtigung(berechtigung, unterschrift) && isAllFieldsFilled(berechtigung, unterschrift,
|
||||
datumDerPruefung, gueltigkeitsdatum, ermaechtigungsnummer)) {
|
||||
Model.Berechtigung.speichereBerechtigung(berechtigung, unterschrift, datumDerPruefung,
|
||||
gueltigkeitsdatum, ermaechtigungsnummer);
|
||||
showAlert(Alert.AlertType.INFORMATION, "Erfolg", "Daten erfolgreich gespeichert");
|
||||
}
|
||||
});
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private boolean isInputValidBerechtigung(String... inputs) {
|
||||
Pattern numericPattern = Pattern.compile(".*\\d.*");
|
||||
|
||||
for (String input : inputs) {
|
||||
if (input == null || input.trim().isEmpty()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler", "Alle Felder müssen ausgefüllt sein.");
|
||||
return false;
|
||||
}
|
||||
if (numericPattern.matcher(input).matches()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler",
|
||||
"In den Feldern Berechtigung und Unterschrift dürfen keine Zahlen stehen.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public GridPane createLogbucheintragPane() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(20));
|
||||
grid.setVgap(15);
|
||||
grid.setHgap(15);
|
||||
grid.setAlignment(Pos.CENTER);
|
||||
|
||||
TextField kennzeichenField = new TextField();
|
||||
TextField startFlughafenField = new TextField();
|
||||
TextField endFlughafenField = new TextField();
|
||||
TextField startZeitField = new TextField();
|
||||
TextField endZeitField = new TextField();
|
||||
TextField anzahlLandungenField = new TextField("0");
|
||||
TextField pilotField = new TextField();
|
||||
DatePicker datumPicker = new DatePicker();
|
||||
TextField unterschriftField = new TextField();
|
||||
|
||||
grid.add(createStyledLabel("Kennzeichen:"), 0, 0);
|
||||
grid.add(kennzeichenField, 1, 0);
|
||||
grid.add(createStyledLabel("Start Flughafen:"), 0, 1);
|
||||
grid.add(startFlughafenField, 1, 1);
|
||||
grid.add(createStyledLabel("End Flughafen:"), 0, 2);
|
||||
grid.add(endFlughafenField, 1, 2);
|
||||
grid.add(createStyledLabel("Startzeit:"), 0, 3);
|
||||
grid.add(startZeitField, 1, 3);
|
||||
grid.add(createStyledLabel("Endzeit:"), 0, 4);
|
||||
grid.add(endZeitField, 1, 4);
|
||||
grid.add(createStyledLabel("Anzahl Landungen:"), 0, 5);
|
||||
grid.add(anzahlLandungenField, 1, 5);
|
||||
grid.add(createStyledLabel("Pilot:"), 0, 6);
|
||||
grid.add(pilotField, 1, 6);
|
||||
grid.add(createStyledLabel("Datum:"), 0, 7);
|
||||
grid.add(datumPicker, 1, 7);
|
||||
grid.add(createStyledLabel("Unterschrift:"), 0, 8);
|
||||
grid.add(unterschriftField, 1, 8);
|
||||
|
||||
Button startButton = new Button("Start");
|
||||
Button gelandetButton = new Button("Gelandet");
|
||||
Button endeButton = new Button("Ende");
|
||||
Button speichernButton = new Button("Speichern");
|
||||
|
||||
HBox buttonBox = new HBox(10, startButton, gelandetButton, endeButton);
|
||||
buttonBox.setAlignment(Pos.CENTER);
|
||||
HBox saveButtonBox = new HBox(speichernButton);
|
||||
saveButtonBox.setAlignment(Pos.CENTER);
|
||||
saveButtonBox.setPadding(new Insets(10, 0, 0, 0));
|
||||
|
||||
grid.add(buttonBox, 1, 9);
|
||||
grid.add(saveButtonBox, 1, 10);
|
||||
|
||||
startButton.setOnAction(e -> startZeitField.setText(java.time.LocalTime.now().toString()));
|
||||
gelandetButton.setOnAction(e -> {
|
||||
try {
|
||||
int currentLandungen = Integer.parseInt(anzahlLandungenField.getText());
|
||||
anzahlLandungenField.setText(Integer.toString(currentLandungen + 1));
|
||||
} catch (NumberFormatException ex) {
|
||||
anzahlLandungenField.setText("1");
|
||||
}
|
||||
});
|
||||
endeButton.setOnAction(e -> endZeitField.setText(java.time.LocalTime.now().toString()));
|
||||
|
||||
speichernButton.setOnAction(e -> {
|
||||
String kennzeichen = kennzeichenField.getText();
|
||||
String startFlughafen = startFlughafenField.getText();
|
||||
String endFlughafen = endFlughafenField.getText();
|
||||
String startZeit = startZeitField.getText();
|
||||
String endZeit = endZeitField.getText();
|
||||
int anzahlLandungen = Integer.parseInt(anzahlLandungenField.getText());
|
||||
String pilot = pilotField.getText();
|
||||
String datum = datumPicker.getValue() != null ? datumPicker.getValue().toString() : "";
|
||||
String unterschrift = unterschriftField.getText();
|
||||
|
||||
if (isInputValidLogbuch(pilot, unterschrift, startFlughafen, endFlughafen) && isAllFieldsFilled(kennzeichen,
|
||||
startFlughafen, endFlughafen, startZeit, endZeit, pilot, datum, unterschrift)) {
|
||||
Model.Logbuch.speichereLogbuchEintrag(kennzeichen, startFlughafen, endFlughafen, startZeit, endZeit,
|
||||
anzahlLandungen, pilot, datum, unterschrift);
|
||||
showAlert(Alert.AlertType.INFORMATION, "Erfolg", "Daten erfolgreich gespeichert");
|
||||
}
|
||||
});
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private boolean isInputValidLogbuch(String... inputs) {
|
||||
Pattern numericPattern = Pattern.compile(".*\\d.*");
|
||||
|
||||
for (String input : inputs) {
|
||||
if (input == null || input.trim().isEmpty()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler", "Alle Felder müssen ausgefüllt sein.");
|
||||
return false;
|
||||
}
|
||||
if (numericPattern.matcher(input).matches()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler",
|
||||
"In den Feldern Start Flughafen, End Flughafen, Pilot und Unterschrift dürfen keine Zahlen stehen.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isAllFieldsFilled(String... fields) {
|
||||
for (String field : fields) {
|
||||
if (field == null || field.trim().isEmpty()) {
|
||||
showAlert(Alert.AlertType.ERROR, "Fehler", "Alle Felder müssen ausgefüllt werden");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
.root {
|
||||
-fx-font-family: "Arial";
|
||||
}
|
||||
|
||||
.label {
|
||||
-fx-font-size: 14.0px;
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
.text-field {
|
||||
-fx-background-color: #f0f0f0;
|
||||
-fx-border-color: #d3d3d3;
|
||||
-fx-border-radius: 3.0;
|
||||
-fx-padding: 5.0 7.0 5.0 7.0;
|
||||
}
|
||||
|
||||
.button {
|
||||
-fx-background-color: #4CAF50;
|
||||
-fx-text-fill: white;
|
||||
-fx-padding: 8.0 15.0 8.0 15.0;
|
||||
-fx-font-size: 14.0px;
|
||||
-fx-background-radius: 5.0;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
-fx-background-color: #45a049;
|
||||
}
|
||||
|
||||
.button-box {
|
||||
-fx-spacing: 10.0;
|
||||
-fx-padding: 10.0 0.0 0.0 0.0;
|
||||
}
|
Loading…
Reference in New Issue