Einige änderungen am aussehen und Funktionen
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 2.1 KiB |
|
|
@ -0,0 +1,22 @@
|
||||||
|
.root {
|
||||||
|
-fx-font-family: 'Arial';
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
-fx-background-color: #000000;
|
||||||
|
-fx-text-fill: #FFFFFF;
|
||||||
|
-fx-font-size: 14px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-pref-height: 40px;
|
||||||
|
-fx-pref-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
-fx-font-size: 14px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-field, .date-picker, .combo-box {
|
||||||
|
-fx-pref-height: 30px;
|
||||||
|
-fx-pref-width: 250px;
|
||||||
|
}
|
||||||
96
flights.xml
|
|
@ -185,6 +185,102 @@
|
||||||
</void>
|
</void>
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
|
<void method="add">
|
||||||
|
<object class="models.Flight">
|
||||||
|
<void property="TToF">
|
||||||
|
<double>123.0</double>
|
||||||
|
</void>
|
||||||
|
<void property="abflugort">
|
||||||
|
<string>asd</string>
|
||||||
|
</void>
|
||||||
|
<void property="abflugzeit">
|
||||||
|
<string>dsa</string>
|
||||||
|
</void>
|
||||||
|
<void property="ankunftszeit">
|
||||||
|
<string>asda</string>
|
||||||
|
</void>
|
||||||
|
<void property="anzahlLandungen">
|
||||||
|
<int>12</int>
|
||||||
|
</void>
|
||||||
|
<void property="kommentar">
|
||||||
|
<string>123</string>
|
||||||
|
</void>
|
||||||
|
<void property="muster">
|
||||||
|
<string>asda</string>
|
||||||
|
</void>
|
||||||
|
<void property="pilot">
|
||||||
|
<object class="models.Pilot" id="Pilot3">
|
||||||
|
<void property="adresse">
|
||||||
|
<string>asdasdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="kontaktinformationen">
|
||||||
|
<string>asdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="lizenzen">
|
||||||
|
<void method="add">
|
||||||
|
<string>124312</string>
|
||||||
|
</void>
|
||||||
|
</void>
|
||||||
|
<void property="name">
|
||||||
|
<string>asdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="zertifikate">
|
||||||
|
<void method="add">
|
||||||
|
<string>asd</string>
|
||||||
|
</void>
|
||||||
|
</void>
|
||||||
|
</object>
|
||||||
|
</void>
|
||||||
|
</object>
|
||||||
|
</void>
|
||||||
|
<void method="add">
|
||||||
|
<object class="models.Flight">
|
||||||
|
<void property="TToF">
|
||||||
|
<double>1.0</double>
|
||||||
|
</void>
|
||||||
|
<void property="abflugort">
|
||||||
|
<string>ea</string>
|
||||||
|
</void>
|
||||||
|
<void property="abflugzeit">
|
||||||
|
<string>11:00</string>
|
||||||
|
</void>
|
||||||
|
<void property="ankunftszeit">
|
||||||
|
<string>12:30</string>
|
||||||
|
</void>
|
||||||
|
<void property="anzahlLandungen">
|
||||||
|
<int>2</int>
|
||||||
|
</void>
|
||||||
|
<void property="kommentar">
|
||||||
|
<string>lol</string>
|
||||||
|
</void>
|
||||||
|
<void property="muster">
|
||||||
|
<string>test</string>
|
||||||
|
</void>
|
||||||
|
<void property="pilot">
|
||||||
|
<object class="models.Pilot" id="Pilot4">
|
||||||
|
<void property="adresse">
|
||||||
|
<string>asdasdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="kontaktinformationen">
|
||||||
|
<string>asdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="lizenzen">
|
||||||
|
<void method="add">
|
||||||
|
<string>124312</string>
|
||||||
|
</void>
|
||||||
|
</void>
|
||||||
|
<void property="name">
|
||||||
|
<string>asdasd</string>
|
||||||
|
</void>
|
||||||
|
<void property="zertifikate">
|
||||||
|
<void method="add">
|
||||||
|
<string>asd</string>
|
||||||
|
</void>
|
||||||
|
</void>
|
||||||
|
</object>
|
||||||
|
</void>
|
||||||
|
</object>
|
||||||
|
</void>
|
||||||
</void>
|
</void>
|
||||||
</object>
|
</object>
|
||||||
</java>
|
</java>
|
||||||
|
|
|
||||||
39
pilots.xml
|
|
@ -5,49 +5,14 @@
|
||||||
<void method="add">
|
<void method="add">
|
||||||
<object class="models.Pilot">
|
<object class="models.Pilot">
|
||||||
<void property="adresse">
|
<void property="adresse">
|
||||||
<string>asd</string>
|
<string>sad</string>
|
||||||
</void>
|
</void>
|
||||||
<void property="kontaktinformationen">
|
<void property="kontaktinformationen">
|
||||||
<string>23</string>
|
<string>ads</string>
|
||||||
</void>
|
|
||||||
<void property="name">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
</object>
|
|
||||||
</void>
|
|
||||||
<void method="add">
|
|
||||||
<object class="models.Pilot" id="Pilot0">
|
|
||||||
<void property="adresse">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
<void property="kontaktinformationen">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
<void property="lizenzen">
|
|
||||||
<void method="add">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
<void method="add">
|
|
||||||
<string>ss</string>
|
|
||||||
</void>
|
|
||||||
<void method="add">
|
|
||||||
<string>ddas</string>
|
|
||||||
</void>
|
|
||||||
</void>
|
</void>
|
||||||
<void property="name">
|
<void property="name">
|
||||||
<string>sad</string>
|
<string>sad</string>
|
||||||
</void>
|
</void>
|
||||||
<void property="zertifikate">
|
|
||||||
<void method="add">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
<void method="add">
|
|
||||||
<string>asd</string>
|
|
||||||
</void>
|
|
||||||
<void method="add">
|
|
||||||
<string>eee</string>
|
|
||||||
</void>
|
|
||||||
</void>
|
|
||||||
</object>
|
</object>
|
||||||
</void>
|
</void>
|
||||||
</void>
|
</void>
|
||||||
|
|
|
||||||
|
|
@ -1,121 +1,184 @@
|
||||||
package models;
|
package models;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import javafx.beans.property.*;
|
||||||
|
|
||||||
public class Flight implements Serializable {
|
public class Flight implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private LocalDate datum;
|
private transient ObjectProperty<LocalDate> datum;
|
||||||
private String muster;
|
private String datumStr;
|
||||||
private String abflugort;
|
private StringProperty muster;
|
||||||
private String abflugzeit;
|
private StringProperty abflugort;
|
||||||
private String ankunftszeit;
|
private StringProperty abflugzeit;
|
||||||
private double tToF; // Flugdauer in Stunden
|
private StringProperty ankunftszeit;
|
||||||
private int anzahlLandungen;
|
private DoubleProperty tToF;
|
||||||
private Pilot pilot;
|
private IntegerProperty anzahlLandungen;
|
||||||
private boolean isNachtflug;
|
private ObjectProperty<Pilot> pilot;
|
||||||
private String kommentar;
|
private BooleanProperty nachtflug;
|
||||||
|
private StringProperty kommentar;
|
||||||
|
|
||||||
|
// Standardkonstruktor
|
||||||
public Flight() {
|
public Flight() {
|
||||||
|
this.datum = new SimpleObjectProperty<>();
|
||||||
|
this.muster = new SimpleStringProperty();
|
||||||
|
this.abflugort = new SimpleStringProperty();
|
||||||
|
this.abflugzeit = new SimpleStringProperty();
|
||||||
|
this.ankunftszeit = new SimpleStringProperty();
|
||||||
|
this.tToF = new SimpleDoubleProperty();
|
||||||
|
this.anzahlLandungen = new SimpleIntegerProperty();
|
||||||
|
this.pilot = new SimpleObjectProperty<>();
|
||||||
|
this.nachtflug = new SimpleBooleanProperty();
|
||||||
|
this.kommentar = new SimpleStringProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flight(LocalDate datum, String muster, String abflugort, String abflugzeit, String ankunftszeit, double tToF,
|
public Flight(LocalDate datum, String muster, String abflugort, String abflugzeit, String ankunftszeit, double tToF, int anzahlLandungen, Pilot pilot, boolean nachtflug, String kommentar) {
|
||||||
int anzahlLandungen, Pilot pilot, boolean isNachtflug, String kommentar) {
|
this.datum = new SimpleObjectProperty<>(datum);
|
||||||
this.datum = datum;
|
this.datumStr = datum.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
this.muster = muster;
|
this.muster = new SimpleStringProperty(muster);
|
||||||
this.abflugort = abflugort;
|
this.abflugort = new SimpleStringProperty(abflugort);
|
||||||
this.abflugzeit = abflugzeit;
|
this.abflugzeit = new SimpleStringProperty(abflugzeit);
|
||||||
this.ankunftszeit = ankunftszeit;
|
this.ankunftszeit = new SimpleStringProperty(ankunftszeit);
|
||||||
this.tToF = tToF;
|
this.tToF = new SimpleDoubleProperty(tToF);
|
||||||
this.anzahlLandungen = anzahlLandungen;
|
this.anzahlLandungen = new SimpleIntegerProperty(anzahlLandungen);
|
||||||
this.pilot = pilot;
|
this.pilot = new SimpleObjectProperty<>(pilot);
|
||||||
this.isNachtflug = isNachtflug;
|
this.nachtflug = new SimpleBooleanProperty(nachtflug);
|
||||||
this.kommentar = kommentar;
|
this.kommentar = new SimpleStringProperty(kommentar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getter und Setter für alle Felder
|
|
||||||
public LocalDate getDatum() {
|
public LocalDate getDatum() {
|
||||||
return datum;
|
return datum.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDatum(LocalDate datum) {
|
public void setDatum(LocalDate datum) {
|
||||||
this.datum = datum;
|
this.datum.set(datum);
|
||||||
|
this.datumStr = datum.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectProperty<LocalDate> datumProperty() {
|
||||||
|
return datum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMuster() {
|
public String getMuster() {
|
||||||
return muster;
|
return muster.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMuster(String muster) {
|
public void setMuster(String muster) {
|
||||||
this.muster = muster;
|
this.muster.set(muster);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty musterProperty() {
|
||||||
|
return muster;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAbflugort() {
|
public String getAbflugort() {
|
||||||
return abflugort;
|
return abflugort.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAbflugort(String abflugort) {
|
public void setAbflugort(String abflugort) {
|
||||||
this.abflugort = abflugort;
|
this.abflugort.set(abflugort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty abflugortProperty() {
|
||||||
|
return abflugort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAbflugzeit() {
|
public String getAbflugzeit() {
|
||||||
return abflugzeit;
|
return abflugzeit.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAbflugzeit(String abflugzeit) {
|
public void setAbflugzeit(String abflugzeit) {
|
||||||
this.abflugzeit = abflugzeit;
|
this.abflugzeit.set(abflugzeit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty abflugzeitProperty() {
|
||||||
|
return abflugzeit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAnkunftszeit() {
|
public String getAnkunftszeit() {
|
||||||
return ankunftszeit;
|
return ankunftszeit.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnkunftszeit(String ankunftszeit) {
|
public void setAnkunftszeit(String ankunftszeit) {
|
||||||
this.ankunftszeit = ankunftszeit;
|
this.ankunftszeit.set(ankunftszeit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty ankunftszeitProperty() {
|
||||||
|
return ankunftszeit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getTToF() {
|
public double getTToF() {
|
||||||
return tToF;
|
return tToF.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTToF(double tToF) {
|
public void setTToF(double tToF) {
|
||||||
this.tToF = tToF;
|
this.tToF.set(tToF);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleProperty tToFProperty() {
|
||||||
|
return tToF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAnzahlLandungen() {
|
public int getAnzahlLandungen() {
|
||||||
return anzahlLandungen;
|
return anzahlLandungen.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnzahlLandungen(int anzahlLandungen) {
|
public void setAnzahlLandungen(int anzahlLandungen) {
|
||||||
this.anzahlLandungen = anzahlLandungen;
|
this.anzahlLandungen.set(anzahlLandungen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntegerProperty anzahlLandungenProperty() {
|
||||||
|
return anzahlLandungen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pilot getPilot() {
|
public Pilot getPilot() {
|
||||||
return pilot;
|
return pilot.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPilot(Pilot pilot) {
|
public void setPilot(Pilot pilot) {
|
||||||
this.pilot = pilot;
|
this.pilot.set(pilot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectProperty<Pilot> pilotProperty() {
|
||||||
|
return pilot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNachtflug() {
|
public boolean isNachtflug() {
|
||||||
return isNachtflug;
|
return nachtflug.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNachtflug(boolean nachtflug) {
|
public void setNachtflug(boolean nachtflug) {
|
||||||
isNachtflug = nachtflug;
|
this.nachtflug.set(nachtflug);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanProperty nachtflugProperty() {
|
||||||
|
return nachtflug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKommentar() {
|
public String getKommentar() {
|
||||||
return kommentar;
|
return kommentar.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKommentar(String kommentar) {
|
public void setKommentar(String kommentar) {
|
||||||
this.kommentar = kommentar;
|
this.kommentar.set(kommentar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty kommentarProperty() {
|
||||||
|
return kommentar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPilotInformationen() {
|
public String getPilotInformationen() {
|
||||||
return pilot != null ? pilot.getInformationen() : "Kein Pilot zugewiesen";
|
Pilot pilot = getPilot();
|
||||||
|
if (pilot != null) {
|
||||||
|
return "Name: " + pilot.getName() + ", Adresse: " + pilot.getAdresse() + ", Kontaktinformationen: " + pilot.getKontaktinformationen();
|
||||||
|
}
|
||||||
|
return "Keine Pilotinformationen verfügbar";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,51 +3,69 @@ package models;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.beans.property.StringProperty;
|
||||||
|
|
||||||
public class Pilot implements Serializable {
|
public class Pilot implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String name;
|
private StringProperty name;
|
||||||
private String adresse;
|
private StringProperty adresse;
|
||||||
private String kontaktinformationen;
|
private StringProperty kontaktinformationen;
|
||||||
private List<String> lizenzen;
|
private List<String> lizenzen;
|
||||||
private List<String> zertifikate;
|
private List<String> zertifikate;
|
||||||
|
|
||||||
|
// Standardkonstruktor
|
||||||
public Pilot() {
|
public Pilot() {
|
||||||
|
this.name = new SimpleStringProperty();
|
||||||
|
this.adresse = new SimpleStringProperty();
|
||||||
|
this.kontaktinformationen = new SimpleStringProperty();
|
||||||
this.lizenzen = new ArrayList<>();
|
this.lizenzen = new ArrayList<>();
|
||||||
this.zertifikate = new ArrayList<>();
|
this.zertifikate = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pilot(String name, String adresse, String kontaktinformationen) {
|
public Pilot(String name, String adresse, String kontaktinformationen) {
|
||||||
this.name = name;
|
this.name = new SimpleStringProperty(name);
|
||||||
this.adresse = adresse;
|
this.adresse = new SimpleStringProperty(adresse);
|
||||||
this.kontaktinformationen = kontaktinformationen;
|
this.kontaktinformationen = new SimpleStringProperty(kontaktinformationen);
|
||||||
this.lizenzen = new ArrayList<>();
|
this.lizenzen = new ArrayList<>();
|
||||||
this.zertifikate = new ArrayList<>();
|
this.zertifikate = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name.set(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty nameProperty() {
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdresse() {
|
public String getAdresse() {
|
||||||
return adresse;
|
return adresse.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdresse(String adresse) {
|
public void setAdresse(String adresse) {
|
||||||
this.adresse = adresse;
|
this.adresse.set(adresse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty adresseProperty() {
|
||||||
|
return adresse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKontaktinformationen() {
|
public String getKontaktinformationen() {
|
||||||
return kontaktinformationen;
|
return kontaktinformationen.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKontaktinformationen(String kontaktinformationen) {
|
public void setKontaktinformationen(String kontaktinformationen) {
|
||||||
this.kontaktinformationen = kontaktinformationen;
|
this.kontaktinformationen.set(kontaktinformationen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringProperty kontaktinformationenProperty() {
|
||||||
|
return kontaktinformationen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getLizenzen() {
|
public List<String> getLizenzen() {
|
||||||
|
|
@ -58,6 +76,10 @@ public class Pilot implements Serializable {
|
||||||
this.lizenzen = lizenzen;
|
this.lizenzen = lizenzen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addLizenz(String lizenz) {
|
||||||
|
this.lizenzen.add(lizenz);
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getZertifikate() {
|
public List<String> getZertifikate() {
|
||||||
return zertifikate;
|
return zertifikate;
|
||||||
}
|
}
|
||||||
|
|
@ -66,20 +88,12 @@ public class Pilot implements Serializable {
|
||||||
this.zertifikate = zertifikate;
|
this.zertifikate = zertifikate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLizenz(String lizenz) {
|
|
||||||
this.lizenzen.add(lizenz);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addZertifikat(String zertifikat) {
|
public void addZertifikat(String zertifikat) {
|
||||||
this.zertifikate.add(zertifikat);
|
this.zertifikate.add(zertifikat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInformationen() {
|
|
||||||
return "Name: " + name + ", Adresse: " + adresse + ", Kontaktinformationen: " + kontaktinformationen;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 2.1 KiB |
|
|
@ -0,0 +1,22 @@
|
||||||
|
.root {
|
||||||
|
-fx-font-family: 'Arial';
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
-fx-background-color: #000000;
|
||||||
|
-fx-text-fill: #FFFFFF;
|
||||||
|
-fx-font-size: 14px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-pref-height: 40px;
|
||||||
|
-fx-pref-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
-fx-font-size: 14px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-field, .date-picker, .combo-box {
|
||||||
|
-fx-pref-height: 30px;
|
||||||
|
-fx-pref-width: 250px;
|
||||||
|
}
|
||||||
|
|
@ -2,28 +2,24 @@ package utils;
|
||||||
|
|
||||||
import java.beans.XMLDecoder;
|
import java.beans.XMLDecoder;
|
||||||
import java.beans.XMLEncoder;
|
import java.beans.XMLEncoder;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.*;
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XMLHelper {
|
public class XMLHelper {
|
||||||
|
|
||||||
public static void saveToXML(Object data, String filename) {
|
public static void saveToXML(Object obj, String filePath) {
|
||||||
try (XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(filename)))) {
|
try (XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(filePath)))) {
|
||||||
encoder.writeObject(data);
|
encoder.writeObject(obj);
|
||||||
encoder.flush();
|
encoder.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object loadFromXML(String filename) {
|
public static Object loadFromXML(String filePath) {
|
||||||
try (XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(filename)))) {
|
try (XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(filePath)))) {
|
||||||
return decoder.readObject();
|
return decoder.readObject();
|
||||||
} catch (IOException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
System.out.println("File not found: " + filePath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,12 @@ public class AddFlightScreen {
|
||||||
pilotComboBox.setPromptText("Pilot auswählen");
|
pilotComboBox.setPromptText("Pilot auswählen");
|
||||||
|
|
||||||
Button submitBtn = new Button("Hinzufügen");
|
Button submitBtn = new Button("Hinzufügen");
|
||||||
submitBtn.setStyle("-fx-background-color: #431EB9; -fx-text-fill: #FFFFFF;");
|
submitBtn.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
submitBtn.setOnAction(
|
submitBtn.setOnAction(e -> handleAddFlight(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
||||||
e -> handleAddFlight(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
tToFField, anzahlLandungenField, nachtflugBox.isSelected(), kommentarField, pilotComboBox));
|
||||||
tToFField, anzahlLandungenField, nachtflugBox.isSelected(), kommentarField, pilotComboBox));
|
|
||||||
|
|
||||||
Button backButton = new Button("Zurück");
|
Button backButton = new Button("Zurück");
|
||||||
|
backButton.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
backButton.setOnAction(e -> new HomeScreen(stage).display());
|
backButton.setOnAction(e -> new HomeScreen(stage).display());
|
||||||
|
|
||||||
VBox vbox = new VBox(10, label, datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
VBox vbox = new VBox(10, label, datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
||||||
|
|
@ -90,18 +90,24 @@ public class AddFlightScreen {
|
||||||
BorderPane.setAlignment(backButton, Pos.TOP_LEFT);
|
BorderPane.setAlignment(backButton, Pos.TOP_LEFT);
|
||||||
BorderPane.setMargin(backButton, new Insets(10));
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
Scene scene = new Scene(borderPane, 600, 700);
|
if (pilots.isEmpty()) {
|
||||||
|
Button addPilotBtn = new Button("Pilot hinzufügen");
|
||||||
|
addPilotBtn.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
addPilotBtn.setOnAction(e -> new ManagePilotProfileScreen(stage).display());
|
||||||
|
vbox.getChildren().add(addPilotBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(borderPane, 800, 700);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleAddFlight(DatePicker datumField, TextField musterField, TextField abflugortField,
|
private void handleAddFlight(DatePicker datumField, TextField musterField, TextField abflugortField, TextField abflugzeitField,
|
||||||
TextField abflugzeitField,
|
TextField ankunftszeitField, TextField tToFField, TextField anzahlLandungenField, boolean isNachtflug,
|
||||||
TextField ankunftszeitField, TextField tToFField, TextField anzahlLandungenField, boolean isNachtflug,
|
TextField kommentarField, ComboBox<Pilot> pilotComboBox) {
|
||||||
TextField kommentarField, ComboBox<Pilot> pilotComboBox) {
|
clearFieldStyles(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField, tToFField, anzahlLandungenField, pilotComboBox);
|
||||||
clearFieldStyles(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField, tToFField,
|
|
||||||
anzahlLandungenField, pilotComboBox);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (datumField.getValue() == null) {
|
if (datumField.getValue() == null) {
|
||||||
|
|
@ -153,8 +159,7 @@ public class AddFlightScreen {
|
||||||
|
|
||||||
new HomeScreen(stage).display();
|
new HomeScreen(stage).display();
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
showAlert("Ungültige Eingabe",
|
showAlert("Ungültige Eingabe", "Bitte stellen Sie sicher, dass die Flugdauer und die Anzahl der Landungen numerisch sind.");
|
||||||
"Bitte stellen Sie sicher, dass die Flugdauer und die Anzahl der Landungen numerisch sind.");
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
showAlert("Fehlende Eingabe", e.getMessage());
|
showAlert("Fehlende Eingabe", e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
package views;
|
||||||
|
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ComboBox;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import models.Pilot;
|
||||||
|
import models.Pilots;
|
||||||
|
import utils.XMLHelper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DeletePilotScreen {
|
||||||
|
private Stage stage;
|
||||||
|
|
||||||
|
public DeletePilotScreen(Stage stage) {
|
||||||
|
this.stage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void display() {
|
||||||
|
Label label = new Label("Piloten löschen");
|
||||||
|
label.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
|
||||||
|
|
||||||
|
Pilots pilotsData = (Pilots) XMLHelper.loadFromXML("pilots.xml");
|
||||||
|
List<Pilot> pilotList = pilotsData != null ? pilotsData.getPilots() : new java.util.ArrayList<>();
|
||||||
|
ComboBox<Pilot> pilotComboBox = new ComboBox<>(javafx.collections.FXCollections.observableArrayList(pilotList));
|
||||||
|
pilotComboBox.setPromptText("Pilot auswählen");
|
||||||
|
|
||||||
|
Button deleteBtn = new Button("Löschen");
|
||||||
|
deleteBtn.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
deleteBtn.setOnAction(e -> {
|
||||||
|
Pilot selectedPilot = pilotComboBox.getValue();
|
||||||
|
if (selectedPilot != null) {
|
||||||
|
pilotList.remove(selectedPilot);
|
||||||
|
XMLHelper.saveToXML(new Pilots(pilotList), "pilots.xml");
|
||||||
|
new HomeScreen(stage).display();
|
||||||
|
} else {
|
||||||
|
showAlert("Fehler", "Bitte wählen Sie einen Piloten aus.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button backButton = new Button("Zurück");
|
||||||
|
backButton.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
backButton.setOnAction(e -> new HomeScreen(stage).display());
|
||||||
|
|
||||||
|
VBox vbox = new VBox(10, label, pilotComboBox, deleteBtn);
|
||||||
|
vbox.setAlignment(Pos.CENTER);
|
||||||
|
vbox.setPadding(new Insets(20));
|
||||||
|
vbox.setStyle("-fx-background-color: #E6F2FF;");
|
||||||
|
|
||||||
|
BorderPane borderPane = new BorderPane();
|
||||||
|
borderPane.setTop(backButton);
|
||||||
|
borderPane.setCenter(vbox);
|
||||||
|
BorderPane.setAlignment(backButton, Pos.TOP_LEFT);
|
||||||
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
|
Scene scene = new Scene(borderPane, 800, 600);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAlert(String title, String message) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setTitle(title);
|
||||||
|
alert.setHeaderText(null);
|
||||||
|
alert.setContentText(message);
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
package views;
|
||||||
|
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import models.Flight;
|
||||||
|
import models.Flights;
|
||||||
|
import utils.XMLHelper;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EditFlightScreen {
|
||||||
|
private Stage stage;
|
||||||
|
private Flight flight;
|
||||||
|
|
||||||
|
public EditFlightScreen(Stage stage, Flight flight) {
|
||||||
|
this.stage = stage;
|
||||||
|
this.flight = flight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void display() {
|
||||||
|
Label label = new Label("Flugdaten bearbeiten:");
|
||||||
|
label.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
|
||||||
|
DatePicker datumField = new DatePicker(flight.getDatum());
|
||||||
|
TextField musterField = new TextField(flight.getMuster());
|
||||||
|
TextField abflugortField = new TextField(flight.getAbflugort());
|
||||||
|
TextField abflugzeitField = new TextField(flight.getAbflugzeit());
|
||||||
|
TextField ankunftszeitField = new TextField(flight.getAnkunftszeit());
|
||||||
|
TextField tToFField = new TextField(String.valueOf(flight.getTToF()));
|
||||||
|
TextField anzahlLandungenField = new TextField(String.valueOf(flight.getAnzahlLandungen()));
|
||||||
|
CheckBox nachtflugBox = new CheckBox("Nachtflug");
|
||||||
|
nachtflugBox.setSelected(flight.isNachtflug());
|
||||||
|
TextField kommentarField = new TextField(flight.getKommentar());
|
||||||
|
|
||||||
|
datumField.setPromptText("YYYY-MM-DD");
|
||||||
|
musterField.setPromptText("Muster");
|
||||||
|
abflugortField.setPromptText("Abflugort");
|
||||||
|
abflugzeitField.setPromptText("HH:MM");
|
||||||
|
ankunftszeitField.setPromptText("HH:MM");
|
||||||
|
tToFField.setPromptText("Flugdauer (Stunden)");
|
||||||
|
anzahlLandungenField.setPromptText("Anzahl der Landungen");
|
||||||
|
kommentarField.setPromptText("Kommentar");
|
||||||
|
|
||||||
|
// Nur numerische Eingaben für Flugdauer und Anzahl der Landungen zulassen
|
||||||
|
tToFField.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (!newValue.matches("\\d*\\.?\\d*")) {
|
||||||
|
tToFField.setText(oldValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
anzahlLandungenField.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (!newValue.matches("\\d*")) {
|
||||||
|
anzahlLandungenField.setText(oldValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button saveBtn = new Button("Speichern");
|
||||||
|
saveBtn.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
saveBtn.setOnAction(e -> handleSaveFlight(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
||||||
|
tToFField, anzahlLandungenField, nachtflugBox.isSelected(), kommentarField));
|
||||||
|
|
||||||
|
Button backButton = new Button("Zurück");
|
||||||
|
backButton.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
backButton.setOnAction(e -> new ViewLogbookScreen(stage).display());
|
||||||
|
|
||||||
|
VBox vbox = new VBox(10, label, datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField,
|
||||||
|
tToFField, anzahlLandungenField, nachtflugBox, kommentarField, saveBtn);
|
||||||
|
vbox.setAlignment(Pos.CENTER);
|
||||||
|
vbox.setPadding(new Insets(20));
|
||||||
|
vbox.setStyle("-fx-background-color: #E6F2FF;");
|
||||||
|
|
||||||
|
BorderPane borderPane = new BorderPane();
|
||||||
|
borderPane.setTop(backButton);
|
||||||
|
borderPane.setCenter(vbox);
|
||||||
|
BorderPane.setAlignment(backButton, Pos.TOP_LEFT);
|
||||||
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
|
Scene scene = new Scene(borderPane, 800, 700);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleSaveFlight(DatePicker datumField, TextField musterField, TextField abflugortField, TextField abflugzeitField,
|
||||||
|
TextField ankunftszeitField, TextField tToFField, TextField anzahlLandungenField, boolean isNachtflug,
|
||||||
|
TextField kommentarField) {
|
||||||
|
clearFieldStyles(datumField, musterField, abflugortField, abflugzeitField, ankunftszeitField, tToFField, anzahlLandungenField);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (datumField.getValue() == null) {
|
||||||
|
setErrorStyle(datumField);
|
||||||
|
throw new IllegalArgumentException("Datum ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (musterField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(musterField);
|
||||||
|
throw new IllegalArgumentException("Muster ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (abflugortField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(abflugortField);
|
||||||
|
throw new IllegalArgumentException("Abflugort ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (abflugzeitField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(abflugzeitField);
|
||||||
|
throw new IllegalArgumentException("Abflugzeit ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (ankunftszeitField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(ankunftszeitField);
|
||||||
|
throw new IllegalArgumentException("Ankunftszeit ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (tToFField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(tToFField);
|
||||||
|
throw new IllegalArgumentException("Flugdauer ist erforderlich.");
|
||||||
|
}
|
||||||
|
if (anzahlLandungenField.getText().isEmpty()) {
|
||||||
|
setErrorStyle(anzahlLandungenField);
|
||||||
|
throw new IllegalArgumentException("Anzahl der Landungen ist erforderlich.");
|
||||||
|
}
|
||||||
|
|
||||||
|
double flightDuration = Double.parseDouble(tToFField.getText());
|
||||||
|
int landings = Integer.parseInt(anzahlLandungenField.getText());
|
||||||
|
|
||||||
|
flight.setDatum(datumField.getValue());
|
||||||
|
flight.setMuster(musterField.getText());
|
||||||
|
flight.setAbflugort(abflugortField.getText());
|
||||||
|
flight.setAbflugzeit(abflugzeitField.getText());
|
||||||
|
flight.setAnkunftszeit(ankunftszeitField.getText());
|
||||||
|
flight.setTToF(flightDuration);
|
||||||
|
flight.setAnzahlLandungen(landings);
|
||||||
|
flight.setNachtflug(isNachtflug);
|
||||||
|
flight.setKommentar(kommentarField.getText());
|
||||||
|
|
||||||
|
Flights flights = (Flights) XMLHelper.loadFromXML("flights.xml");
|
||||||
|
if (flights != null) {
|
||||||
|
List<Flight> flightEntries = flights.getFlights();
|
||||||
|
for (int i = 0; i < flightEntries.size(); i++) {
|
||||||
|
if (flightEntries.get(i).equals(flight)) {
|
||||||
|
flightEntries.set(i, flight);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XMLHelper.saveToXML(flights, "flights.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
new ViewLogbookScreen(stage).display();
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
showAlert("Ungültige Eingabe", "Bitte stellen Sie sicher, dass die Flugdauer und die Anzahl der Landungen numerisch sind.");
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
showAlert("Fehlende Eingabe", e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
showAlert("Fehler", "Es ist ein Fehler beim Speichern des Flugs aufgetreten.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setErrorStyle(Control field) {
|
||||||
|
field.setStyle("-fx-border-color: red;");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearFieldStyles(Control... fields) {
|
||||||
|
for (Control field : fields) {
|
||||||
|
field.setStyle(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAlert(String title, String message) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setTitle(title);
|
||||||
|
alert.setHeaderText(null);
|
||||||
|
alert.setContentText(message);
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -35,6 +35,7 @@ public class HelpScreen {
|
||||||
vbox.setStyle("-fx-background-color: #FFFFFF;");
|
vbox.setStyle("-fx-background-color: #FFFFFF;");
|
||||||
|
|
||||||
Scene scene = new Scene(vbox, 400, 300);
|
Scene scene = new Scene(vbox, 400, 300);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,14 @@ import javafx.geometry.Pos;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import models.Pilots;
|
import models.Pilots;
|
||||||
import utils.XMLHelper;
|
import utils.XMLHelper;
|
||||||
|
|
@ -20,16 +25,22 @@ public class HomeScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void display() {
|
public void display() {
|
||||||
Button btn1 = createButton("Flug erfassen", "/resources/icons/add_flight_icon.png");
|
// Titel des Projekts
|
||||||
Button btn2 = createButton("Logbuch einsehen", "/resources/icons/view_logbook_icon.png");
|
Label title = new Label("Fluglogbuch Pegasus");
|
||||||
Button btn3 = createButton("Pilotenprofil verwalten", "/resources/icons/manage_pilot_icon.png");
|
title.setStyle("-fx-font-size: 32px; -fx-font-weight: bold; -fx-text-fill: #000000; -fx-font-family: 'Arial Black';");
|
||||||
Button helpBtn = createButton("Hilfe", "/resources/icons/help_icon.png");
|
|
||||||
Button pilotsBtn = createButton("Alle Piloten anzeigen", "/resources/icons/view_pilot_icon.png");
|
Button btn1 = createButton("Flug erfassen", "/resources/icons/add_flight_icon.png", "Erfassen Sie einen neuen Flug");
|
||||||
Button editPilotsBtn = createButton("Pilot bearbeiten", "/resources/icons/edit_pilot_icon.png");
|
Button btn2 = createButton("Logbuch einsehen", "/resources/icons/view_logbook_icon.png", "Sehen Sie das Fluglogbuch ein");
|
||||||
|
Button btn3 = createButton("Pilotenprofil verwalten", "/resources/icons/manage_pilot_icon.png", "Verwalten Sie das Profil eines Piloten");
|
||||||
|
Button btn4 = createButton("Piloten löschen", "/resources/icons/delete_pilot_icon.png", "Löschen Sie einen Piloten");
|
||||||
|
Button helpBtn = createHelpButton("/resources/icons/help_icon.png", "Hilfe anzeigen");
|
||||||
|
Button pilotsBtn = createButton("Alle Piloten anzeigen", "/resources/icons/view_pilot_icon.png", "Alle Piloten anzeigen");
|
||||||
|
Button editPilotsBtn = createButton("Pilot bearbeiten", "/resources/icons/edit_pilot_icon.png", "Bearbeiten Sie ein Pilotenprofil");
|
||||||
|
|
||||||
btn1.setOnAction(e -> new AddFlightScreen(stage).display());
|
btn1.setOnAction(e -> new AddFlightScreen(stage).display());
|
||||||
btn2.setOnAction(e -> new ViewLogbookScreen(stage).display());
|
btn2.setOnAction(e -> new ViewLogbookScreen(stage).display());
|
||||||
btn3.setOnAction(e -> new ManagePilotProfileScreen(stage).display());
|
btn3.setOnAction(e -> new ManagePilotProfileScreen(stage).display());
|
||||||
|
btn4.setOnAction(e -> new DeletePilotScreen(stage).display());
|
||||||
helpBtn.setOnAction(e -> new HelpScreen(stage).display());
|
helpBtn.setOnAction(e -> new HelpScreen(stage).display());
|
||||||
pilotsBtn.setOnAction(e -> new PilotView(stage).displayAllPilots());
|
pilotsBtn.setOnAction(e -> new PilotView(stage).displayAllPilots());
|
||||||
editPilotsBtn.setOnAction(e -> {
|
editPilotsBtn.setOnAction(e -> {
|
||||||
|
|
@ -41,33 +52,63 @@ public class HomeScreen {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
VBox vbox = new VBox(20, btn1, btn2, btn3, helpBtn, pilotsBtn, editPilotsBtn);
|
GridPane gridPane = new GridPane();
|
||||||
vbox.setAlignment(Pos.CENTER);
|
gridPane.setPadding(new Insets(20));
|
||||||
vbox.setPadding(new Insets(30));
|
gridPane.setHgap(20);
|
||||||
vbox.setStyle("-fx-background-color: #E6F2FF;");
|
gridPane.setVgap(20);
|
||||||
|
gridPane.setAlignment(Pos.CENTER);
|
||||||
|
gridPane.add(btn1, 0, 0);
|
||||||
|
gridPane.add(btn2, 1, 0);
|
||||||
|
gridPane.add(btn3, 0, 1);
|
||||||
|
gridPane.add(pilotsBtn, 1, 1);
|
||||||
|
gridPane.add(editPilotsBtn, 0, 2);
|
||||||
|
gridPane.add(btn4, 1, 2);
|
||||||
|
|
||||||
Scene scene = new Scene(vbox, 600, 400);
|
VBox vbox = new VBox(20, title, gridPane);
|
||||||
|
vbox.setAlignment(Pos.CENTER);
|
||||||
|
|
||||||
|
BorderPane borderPane = new BorderPane();
|
||||||
|
borderPane.setCenter(vbox);
|
||||||
|
borderPane.setRight(helpBtn);
|
||||||
|
BorderPane.setAlignment(helpBtn, Pos.TOP_RIGHT);
|
||||||
|
BorderPane.setMargin(helpBtn, new Insets(10));
|
||||||
|
|
||||||
|
Scene scene = new Scene(borderPane, 800, 600);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setTitle("Fluglogbuch");
|
stage.setTitle("Fluglogbuch Pegasus");
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createButton(String text, String iconPath) {
|
private Button createButton(String text, String iconPath, String tooltipText) {
|
||||||
Image icon = new Image(getClass().getResourceAsStream(iconPath));
|
Image icon = new Image(getClass().getResourceAsStream(iconPath));
|
||||||
if (icon.isError()) {
|
|
||||||
System.out.println("Fehler beim Laden des Icons: " + iconPath);
|
|
||||||
}
|
|
||||||
ImageView iconView = new ImageView(icon);
|
ImageView iconView = new ImageView(icon);
|
||||||
iconView.setFitHeight(20);
|
iconView.setFitHeight(20);
|
||||||
iconView.setFitWidth(20);
|
iconView.setFitWidth(20);
|
||||||
|
|
||||||
Button button = new Button(text, iconView);
|
Button button = new Button(text, iconView);
|
||||||
button.setStyle("-fx-background-color: #431EB9; -fx-text-fill: #FFFFFF;");
|
button.setTooltip(new Tooltip(tooltipText));
|
||||||
|
button.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
button.setPrefSize(250, 50);
|
button.setPrefSize(250, 50);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Button createHelpButton(String iconPath, String tooltipText) {
|
||||||
|
Image icon = new Image(getClass().getResourceAsStream(iconPath));
|
||||||
|
ImageView iconView = new ImageView(icon);
|
||||||
|
iconView.setFitHeight(30);
|
||||||
|
iconView.setFitWidth(30);
|
||||||
|
|
||||||
|
Button button = new Button("", iconView);
|
||||||
|
button.setTooltip(new Tooltip(tooltipText));
|
||||||
|
button.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
button.setShape(new Circle(25)); // Set button shape to circle
|
||||||
|
button.setMinSize(50, 50); // Set the min size to ensure it remains circular
|
||||||
|
button.setMaxSize(50, 50); // Set the max size to ensure it remains circular
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
private void showAlert(String title, String message) {
|
private void showAlert(String title, String message) {
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
alert.setTitle(title);
|
alert.setTitle(title);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import javafx.geometry.Pos;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import models.Pilot;
|
import models.Pilot;
|
||||||
|
|
@ -56,6 +55,8 @@ public class ManagePilotProfileScreen {
|
||||||
BorderPane.setMargin(backButton, new Insets(10));
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
Scene scene = new Scene(borderPane, 400, 300);
|
Scene scene = new Scene(borderPane, 400, 300);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
@ -123,6 +124,7 @@ public class ManagePilotProfileScreen {
|
||||||
BorderPane.setMargin(backButton, new Insets(10));
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
Scene scene = new Scene(borderPane, 400, 600);
|
Scene scene = new Scene(borderPane, 400, 600);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ public class PilotView {
|
||||||
BorderPane.setMargin(backButton, new Insets(10));
|
BorderPane.setMargin(backButton, new Insets(10));
|
||||||
|
|
||||||
Scene scene = new Scene(borderPane, 400, 300);
|
Scene scene = new Scene(borderPane, 400, 300);
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setTitle("Alle Piloten");
|
stage.setTitle("Alle Piloten");
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
package views;
|
package views;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
@ -16,6 +14,8 @@ import models.Flight;
|
||||||
import models.Flights;
|
import models.Flights;
|
||||||
import utils.XMLHelper;
|
import utils.XMLHelper;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ViewLogbookScreen {
|
public class ViewLogbookScreen {
|
||||||
|
|
@ -26,68 +26,88 @@ public class ViewLogbookScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void display() {
|
public void display() {
|
||||||
Flights flightsData = (Flights) XMLHelper.loadFromXML("flights.xml");
|
Label label = new Label("Fluglogbuch Pegasus");
|
||||||
List<Flight> flightList = flightsData != null ? flightsData.getFlights() : List.of();
|
label.setStyle("-fx-font-size: 32px; -fx-font-weight: bold; -fx-text-fill: #431EB9; -fx-font-family: 'Arial Black';");
|
||||||
|
|
||||||
ObservableList<Flight> flights = FXCollections.observableArrayList(flightList);
|
TableView<Flight> table = new TableView<>();
|
||||||
|
table.setStyle("-fx-font-weight: bold;");
|
||||||
|
|
||||||
TableView<Flight> tableView = new TableView<>(flights);
|
TableColumn<Flight, String> datumCol = new TableColumn<>("Datum");
|
||||||
|
datumCol.setCellValueFactory(cellData -> {
|
||||||
|
LocalDate date = cellData.getValue().getDatum();
|
||||||
|
String formattedDate = date != null ? date.format(DateTimeFormatter.ISO_LOCAL_DATE) : "";
|
||||||
|
return new SimpleStringProperty(formattedDate);
|
||||||
|
});
|
||||||
|
|
||||||
TableColumn<Flight, String> dateColumn = new TableColumn<>("Datum");
|
TableColumn<Flight, String> musterCol = new TableColumn<>("Muster");
|
||||||
dateColumn.setCellValueFactory(new PropertyValueFactory<>("datum"));
|
musterCol.setCellValueFactory(cellData -> cellData.getValue().musterProperty());
|
||||||
|
|
||||||
TableColumn<Flight, String> modelColumn = new TableColumn<>("Muster");
|
TableColumn<Flight, String> abflugortCol = new TableColumn<>("Abflugort");
|
||||||
modelColumn.setCellValueFactory(new PropertyValueFactory<>("muster"));
|
abflugortCol.setCellValueFactory(cellData -> cellData.getValue().abflugortProperty());
|
||||||
|
|
||||||
TableColumn<Flight, String> departureColumn = new TableColumn<>("Abflugort");
|
TableColumn<Flight, String> abflugzeitCol = new TableColumn<>("Abflugzeit");
|
||||||
departureColumn.setCellValueFactory(new PropertyValueFactory<>("abflugort"));
|
abflugzeitCol.setCellValueFactory(cellData -> cellData.getValue().abflugzeitProperty());
|
||||||
|
|
||||||
TableColumn<Flight, String> departureTimeColumn = new TableColumn<>("Abflugzeit");
|
TableColumn<Flight, String> ankunftszeitCol = new TableColumn<>("Ankunftszeit");
|
||||||
departureTimeColumn.setCellValueFactory(new PropertyValueFactory<>("abflugzeit"));
|
ankunftszeitCol.setCellValueFactory(cellData -> cellData.getValue().ankunftszeitProperty());
|
||||||
|
|
||||||
TableColumn<Flight, String> arrivalTimeColumn = new TableColumn<>("Ankunftszeit");
|
TableColumn<Flight, Double> tToFCol = new TableColumn<>("Flugdauer");
|
||||||
arrivalTimeColumn.setCellValueFactory(new PropertyValueFactory<>("ankunftszeit"));
|
tToFCol.setCellValueFactory(cellData -> cellData.getValue().tToFProperty().asObject());
|
||||||
|
|
||||||
TableColumn<Flight, Double> durationColumn = new TableColumn<>("Flugdauer");
|
TableColumn<Flight, Integer> anzahlLandungenCol = new TableColumn<>("Landungen");
|
||||||
durationColumn.setCellValueFactory(new PropertyValueFactory<>("tToF"));
|
anzahlLandungenCol.setCellValueFactory(cellData -> cellData.getValue().anzahlLandungenProperty().asObject());
|
||||||
|
|
||||||
TableColumn<Flight, Integer> landingsColumn = new TableColumn<>("Anzahl der Landungen");
|
TableColumn<Flight, String> pilotCol = new TableColumn<>("Pilot");
|
||||||
landingsColumn.setCellValueFactory(new PropertyValueFactory<>("anzahlLandungen"));
|
pilotCol.setCellValueFactory(cellData -> cellData.getValue().pilotProperty().get().nameProperty());
|
||||||
|
|
||||||
TableColumn<Flight, Boolean> nightFlightColumn = new TableColumn<>("Nachtflug");
|
TableColumn<Flight, Boolean> nachtflugCol = new TableColumn<>("Nachtflug");
|
||||||
nightFlightColumn.setCellValueFactory(new PropertyValueFactory<>("isNachtflug"));
|
nachtflugCol.setCellValueFactory(cellData -> cellData.getValue().nachtflugProperty().asObject());
|
||||||
|
|
||||||
TableColumn<Flight, String> commentColumn = new TableColumn<>("Kommentar");
|
TableColumn<Flight, String> kommentarCol = new TableColumn<>("Kommentar");
|
||||||
commentColumn.setCellValueFactory(new PropertyValueFactory<>("kommentar"));
|
kommentarCol.setCellValueFactory(cellData -> cellData.getValue().kommentarProperty());
|
||||||
|
|
||||||
tableView.getColumns().add(dateColumn);
|
table.getColumns().addAll(datumCol, musterCol, abflugortCol, abflugzeitCol, ankunftszeitCol, tToFCol, anzahlLandungenCol, pilotCol, nachtflugCol, kommentarCol);
|
||||||
tableView.getColumns().add(modelColumn);
|
|
||||||
tableView.getColumns().add(departureColumn);
|
ObservableList<Flight> flightList = FXCollections.observableArrayList();
|
||||||
tableView.getColumns().add(departureTimeColumn);
|
Flights flights = (Flights) XMLHelper.loadFromXML("flights.xml");
|
||||||
tableView.getColumns().add(arrivalTimeColumn);
|
if (flights != null) {
|
||||||
tableView.getColumns().add(durationColumn);
|
List<Flight> flightEntries = flights.getFlights();
|
||||||
tableView.getColumns().add(landingsColumn);
|
flightList.addAll(flightEntries);
|
||||||
tableView.getColumns().add(nightFlightColumn);
|
}
|
||||||
tableView.getColumns().add(commentColumn);
|
table.setItems(flightList);
|
||||||
|
|
||||||
|
Button editBtn = new Button("Bearbeiten");
|
||||||
|
editBtn.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
|
editBtn.setOnAction(e -> {
|
||||||
|
Flight selectedFlight = table.getSelectionModel().getSelectedItem();
|
||||||
|
if (selectedFlight != null) {
|
||||||
|
new EditFlightScreen(stage, selectedFlight).display();
|
||||||
|
} else {
|
||||||
|
showAlert("Fehler", "Bitte wählen Sie einen Flug aus.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Button backButton = new Button("Zurück");
|
Button backButton = new Button("Zurück");
|
||||||
|
backButton.setStyle("-fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");
|
||||||
backButton.setOnAction(e -> new HomeScreen(stage).display());
|
backButton.setOnAction(e -> new HomeScreen(stage).display());
|
||||||
|
|
||||||
VBox vbox = new VBox(tableView);
|
VBox vbox = new VBox(20, label, table, editBtn, backButton);
|
||||||
vbox.setAlignment(Pos.CENTER);
|
vbox.setAlignment(Pos.CENTER);
|
||||||
vbox.setPadding(new Insets(20));
|
vbox.setPadding(new Insets(20));
|
||||||
vbox.setStyle("-fx-background-color: #FFFFFF;");
|
vbox.setStyle("-fx-background-color: #E6F2FF;");
|
||||||
|
|
||||||
BorderPane borderPane = new BorderPane();
|
Scene scene = new Scene(vbox, 800, 600);
|
||||||
borderPane.setTop(backButton);
|
scene.getStylesheets().add(getClass().getResource("/resources/styles.css").toExternalForm());
|
||||||
borderPane.setCenter(vbox);
|
|
||||||
BorderPane.setAlignment(backButton, Pos.TOP_LEFT);
|
|
||||||
BorderPane.setMargin(backButton, new Insets(10));
|
|
||||||
|
|
||||||
Scene scene = new Scene(borderPane, 800, 600);
|
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setTitle("Fluglogbuch einsehen");
|
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showAlert(String title, String message) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setTitle(title);
|
||||||
|
alert.setHeaderText(null);
|
||||||
|
alert.setContentText(message);
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||