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

added working ListView for courses in CoursesOfStudyDetailsController

parent 98efa33e
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
......@@ -13,6 +13,8 @@ import javafx.scene.control.*;
import java.io.IOException;
import java.util.Optional;
import static de.thdeg.grademanager.gui.CoursesOfStudyDetailsController.courseList;
public class CourseModificationController {
@FXML
protected ComboBox<BachelorSemester> bachelorSemesterComboBox;
......@@ -57,6 +59,14 @@ public class CourseModificationController {
courseType = courseTypeComboBox.getValue();
examType = examTypeComboBox.getValue();
CoursesOfStudyDetailsController.courseList.add(new Course(1,
name.getText(),
bachelorSemester,
courseType,
Integer.parseInt(sws.getText()),
Integer.parseInt(ects.getText()),
examType));
/*
Course k = new Course(1,
name.getText(),
bachelorSemester,
......@@ -64,6 +74,7 @@ public class CourseModificationController {
Integer.parseInt(sws.getText()),
Integer.parseInt(ects.getText()),
examType);
*/
SwitchWindowHelper.switchTo("CoursesOfStudy Details", event);
} else {
warning.setText("Bitte alle Felder ausfüllen.");
......
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.Course;
import de.thdeg.grademanager.model.CoursesOfStudy;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import java.io.IOException;
......@@ -12,6 +17,18 @@ public class CoursesOfStudyDetailsController {
@FXML
protected TextField courses;
@FXML
protected ListView<Course> courseListView;
static public ObservableList<Course> courseList = FXCollections.observableArrayList();
@FXML
protected void initialize() {
if (!courseList.isEmpty()) {
courseListView.setItems(courseList);
}
}
@FXML
protected void switchToMain(ActionEvent event) throws IOException {
SwitchWindowHelper.switchTo("Main", event);
......
......@@ -32,13 +32,6 @@ public class Course
@Override
public String toString() {
return "\nCourse: " +
"id=" + id +
", name='" + name + '\'' +
", bachelorSemester=" + bachelorSemester +
", courseType=" + courseType +
", sws=" + sws +
", ects=" + ects +
", examType=" + examType;
return name;
}
}
......@@ -13,7 +13,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.thdeg.grademanager.gui.CoursesOfStudyDetailsController">
<BorderPane prefHeight="500.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.thdeg.grademanager.gui.CoursesOfStudyDetailsController">
<top>
<VBox fillWidth="false" prefHeight="42.0" prefWidth="600.0" BorderPane.alignment="CENTER">
<children>
......@@ -103,11 +103,11 @@
<Button layoutX="263.0" layoutY="16.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="127.0" text="Statistiken anzeigen" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="46.0" prefWidth="600.0">
<HBox alignment="CENTER" prefHeight="133.0" prefWidth="600.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Angelegte Kurse:" />
<Region prefHeight="99.0" prefWidth="18.0" />
<ListView disable="true" prefHeight="46.0" prefWidth="269.0" />
<ListView fx:id="courseListView" editable="true" prefHeight="133.0" prefWidth="270.0" />
</children>
</HBox>
</children>
......
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