Skip to content
Snippets Groups Projects
Commit 51f5e2dd authored by Dennis Toth's avatar Dennis Toth
Browse files

Initial commit

parent 8d627382
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
package com.example.grademanager_gui;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextField;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Optional;
public class DegreeModificationController extends MainController {
import static com.example.grademanager_gui.MainController.*;
public class DegreeModificationController {
@FXML
protected ComboBox<String> bachelorDegreeComboBox;
@FXML
protected ComboBox<String> durationComboBox;
ObservableList<String> bachelorDegreeList = FXCollections.observableArrayList("B. A.", "B. Eng.", "B. Sc.");
ObservableList<String> durationList = FXCollections.observableArrayList("7 Semester", "8 Semester",
"9 Semester");
@FXML
protected void initialize() {
setComboBox(bachelorDegreeComboBox, bachelorDegreeList);
setComboBox(durationComboBox, durationList);
}
@FXML
protected TextField name;
@FXML
protected TextField bachelorDegree;
protected String bachelorDegree;
@FXML
protected TextField duration;
protected String duration;
@FXML
protected TextField fees;
protected int fees;
@FXML
protected TextField courses;
@FXML
......@@ -38,11 +55,15 @@ public class DegreeModificationController extends MainController {
@FXML
protected void onSaveButtonClick(ActionEvent event) throws IOException {
if(!name.getText().isBlank() && !bachelorDegree.getText().isBlank() &&
!duration.getText().isBlank() && !fees.getText().isBlank() &&
!courses.getText().isBlank() && !fieldOfStudy.getText().isBlank())
if(!name.getText().isBlank() && bachelorDegreeComboBox.getValue() != null &&
durationComboBox.getValue() != null && !courses.getText().isBlank() &&
!fieldOfStudy.getText().isBlank())
{
//studentList.add((String) name);
bachelorDegree = bachelorDegreeComboBox.getValue();
duration = durationComboBox.getValue();
fees = 62;
degreeList.add(name.getText());
switchToMain(event);
}
else {
......
......@@ -12,30 +12,29 @@ import javafx.scene.Node;
import javafx.stage.*;
import java.io.IOException;
import java.util.ArrayList;
public class MainController {
@FXML
protected ComboBox<String> degreeComboBox;
@FXML
protected ComboBox<String> studentComboBox;
public ObservableList<String> degreeList = FXCollections.observableArrayList();
public ObservableList<String> studentList = FXCollections.observableArrayList();
protected void setDegreeComboBox() {
degreeComboBox.setItems(degreeList);
}
protected void setStudentComboBox() {
studentComboBox.setItems(studentList);
static public ObservableList<String> degreeList = FXCollections.observableArrayList();
static public ObservableList<String> studentList = FXCollections.observableArrayList();
static public void setComboBox(ComboBox<String> comboBox, ObservableList<String> list) {
comboBox.setItems(list);
}
@FXML
protected void initialize() {
if(!degreeList.isEmpty())
{
setDegreeComboBox();
setComboBox(degreeComboBox, degreeList);
}
if(!studentList.isEmpty())
{
setStudentComboBox();
setComboBox(studentComboBox, studentList);
}
}
......
......@@ -13,17 +13,26 @@ import javafx.stage.Stage;
import java.io.IOException;
import java.util.Optional;
import static com.example.grademanager_gui.MainController.*;
public class StudentModificationController {
ObservableList<String> genderList = FXCollections.observableArrayList("männlich", "weiblich", "divers");
@FXML
protected ComboBox<String> genderComboBox;
protected void setGenderComboBox() {
genderComboBox.setItems(genderList);
}
@FXML
protected ComboBox<String> bachelorSemesterComboBox;
@FXML
protected ComboBox<String> statusComboBox;
ObservableList<String> genderList = FXCollections.observableArrayList("männlich", "weiblich", "divers");
ObservableList<String> bachelorSemesterList = FXCollections.observableArrayList("1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11",
"12", "13");
ObservableList<String> statusList = FXCollections.observableArrayList("immatrikuliert", "exmatrikuliert");
@FXML
protected void initialize() {
setGenderComboBox();
setComboBox(genderComboBox, genderList);
setComboBox(bachelorSemesterComboBox, bachelorSemesterList);
setComboBox(statusComboBox, statusList);
}
@FXML
......@@ -43,11 +52,11 @@ public class StudentModificationController {
@FXML
protected TextField personalCourses;
@FXML
protected TextField status;
protected String status;
@FXML
protected boolean paidFees;
@FXML
protected TextField bachelorSemester;
protected String bachelorSemester;
@FXML
protected TextField grades;
@FXML
......@@ -67,12 +76,16 @@ public class StudentModificationController {
if(genderComboBox.getValue() != null && !firstName.getText().isBlank() && !lastName.getText().isBlank() &&
!placeOfResidence.getText().isBlank() && !birthPlace.getText().isBlank() &&
!officialEmail.getText().isBlank() && !privateEmail.getText().isBlank() &&
!personalCourses.getText().isBlank() && !status.getText().isBlank() &&
(yes.isSelected() || no.isSelected()) && !bachelorSemester.getText().isBlank() &&
!personalCourses.getText().isBlank() && statusComboBox.getValue() != null &&
(yes.isSelected() || no.isSelected()) && bachelorSemesterComboBox.getValue() != null &&
!grades.getText().isBlank())
{
gender = genderComboBox.getValue();
paidFees = yes.isSelected();
status = statusComboBox.getValue();
bachelorSemester = bachelorSemesterComboBox.getValue();
studentList.add(lastName.getText());
switchToMain(event);
}
else {
......
......@@ -3,6 +3,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?>
......@@ -63,7 +64,7 @@
</font>
</Label>
<Region prefHeight="38.0" prefWidth="86.0" />
<TextField fx:id="bachelorDegree" prefHeight="26.0" prefWidth="280.0" />
<ComboBox fx:id="bachelorDegreeComboBox" prefHeight="26.0" prefWidth="280.0" />
</children>
<opaqueInsets>
<Insets />
......@@ -80,7 +81,7 @@
</font>
</Label>
<Region prefHeight="38.0" prefWidth="126.0" />
<TextField fx:id="duration" prefHeight="26.0" prefWidth="280.0" />
<ComboBox fx:id="durationComboBox" prefHeight="26.0" prefWidth="280.0" />
</children>
</HBox>
<HBox alignment="CENTER" layoutX="10.0" layoutY="118.0" prefHeight="38.0" prefWidth="600.0">
......@@ -94,7 +95,7 @@
</font>
</Label>
<Region prefHeight="38.0" prefWidth="104.0" />
<TextField fx:id="fees" prefHeight="26.0" prefWidth="280.0" />
<TextField disable="true" prefHeight="26.0" prefWidth="280.0" promptText="62€" />
</children>
</HBox>
<HBox alignment="CENTER" layoutX="10.0" layoutY="195.0" prefHeight="38.0" prefWidth="600.0">
......
......@@ -51,8 +51,8 @@
<children>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="50.0">
<children>
<ComboBox fx:id="comboBox" prefHeight="30.0" prefWidth="250.0" promptText="Studiengang wählen" />
<ComboBox layoutX="254.0" layoutY="46.0" prefHeight="30.0" prefWidth="250.0" promptText="Student wählen" />
<ComboBox fx:id="degreeComboBox" prefHeight="30.0" prefWidth="250.0" promptText="Studiengang wählen" />
<ComboBox fx:id="studentComboBox" layoutX="254.0" layoutY="46.0" prefHeight="30.0" prefWidth="250.0" promptText="Student wählen" />
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefHeight="100.0" prefWidth="200.0">
......
......@@ -167,7 +167,7 @@
</font>
</Label>
<Region prefHeight="38.0" prefWidth="162.0" />
<TextField fx:id="status" prefHeight="26.0" prefWidth="280.0" />
<ComboBox fx:id="statusComboBox" prefHeight="26.0" prefWidth="280.0" />
</children>
</HBox>
<HBox alignment="CENTER" layoutX="10.0" layoutY="453.0" prefHeight="38.0" prefWidth="600.0">
......@@ -211,7 +211,7 @@
</font>
</Label>
<Region prefHeight="38.0" prefWidth="148.0" />
<TextField fx:id="bachelorSemester" prefHeight="26.0" prefWidth="280.0" />
<ComboBox fx:id="bachelorSemesterComboBox" prefHeight="26.0" prefWidth="280.0" />
</children>
</HBox>
<HBox alignment="CENTER" layoutX="10.0" layoutY="530.0" prefHeight="38.0" prefWidth="600.0">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment