Skip to content
Snippets Groups Projects
Commit 99ae2123 authored by Kevin Thaller's avatar Kevin Thaller
Browse files

fix SwitchWindowHelper to work with all event types

parent 8547fcd3
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,14 @@ ...@@ -4,10 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ce56effb-683b-43e9-9335-7e3aa5d26c29" name="Changes" comment="small bugfix in modification option"> <list default="true" id="ce56effb-683b-43e9-9335-7e3aa5d26c29" name="Changes" comment="fix SwitchWindowHelper to work with all event types">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/StudentStatsController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/StudentStatsController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/JpaService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/JpaService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/de/thdeg/grademanager/gui/student-stats.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/de/thdeg/grademanager/gui/student-stats.fxml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/CoursesOfStudyDetailsController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/CoursesOfStudyDetailsController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/SwitchWindowHelper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/gui/SwitchWindowHelper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/model/Enrollment.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/model/Enrollment.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/model/Student.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/thdeg/grademanager/model/Student.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -129,7 +133,14 @@ ...@@ -129,7 +133,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1655630432247</updated> <updated>1655630432247</updated>
</task> </task>
<option name="localTasksCounter" value="7" /> <task id="LOCAL-00007" summary="add StudentStats Screen + Controller">
<created>1655647132967</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1655647132967</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -162,6 +173,7 @@ ...@@ -162,6 +173,7 @@
<MESSAGE value="Course modification added" /> <MESSAGE value="Course modification added" />
<MESSAGE value="bugfix in course modification option" /> <MESSAGE value="bugfix in course modification option" />
<MESSAGE value="created new window for student courses and grades" /> <MESSAGE value="created new window for student courses and grades" />
<option name="LAST_COMMIT_MESSAGE" value="created new window for student courses and grades" /> <MESSAGE value="add StudentStats Screen + Controller" />
<option name="LAST_COMMIT_MESSAGE" value="add StudentStats Screen + Controller" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -12,6 +12,7 @@ import javafx.fxml.FXMLLoader; ...@@ -12,6 +12,7 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage; import javafx.stage.Stage;
import java.io.IOException; import java.io.IOException;
...@@ -109,17 +110,10 @@ public class CoursesOfStudyDetailsController { ...@@ -109,17 +110,10 @@ public class CoursesOfStudyDetailsController {
} }
@FXML @FXML
protected void onCourseClick() throws IOException { protected void onCourseClick(MouseEvent event) throws IOException {
CourseModificationController.setCoursesOfStudy(coursesOfStudy); CourseModificationController.setCoursesOfStudy(coursesOfStudy);
CourseModificationController.setCourse(courseListView.getSelectionModel().getSelectedItem()); CourseModificationController.setCourse(courseListView.getSelectionModel().getSelectedItem());
FXMLLoader root = new FXMLLoader(Main.class.getResource("course-modification.fxml")); SwitchWindowHelper.switchTo("Course Modification", event);
Stage stage = (Stage) (courseListView.getScene().getWindow());
Scene scene = new Scene(root.load(), 960, 540);
if (stage != null){
stage.setTitle("Course Mofidification");
stage.setScene(scene);
stage.show();
}
} }
@FXML @FXML
......
package de.thdeg.grademanager.gui; package de.thdeg.grademanager.gui;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node; import javafx.scene.Node;
...@@ -11,7 +12,7 @@ import java.io.IOException; ...@@ -11,7 +12,7 @@ import java.io.IOException;
public class SwitchWindowHelper { public class SwitchWindowHelper {
@FXML @FXML
public static void switchTo(String windowTitle, ActionEvent event) throws IOException { public static void switchTo(String windowTitle, Event event) throws IOException {
FXMLLoader root = new FXMLLoader(Main.class.getResource(getResourceName(windowTitle))); FXMLLoader root = new FXMLLoader(Main.class.getResource(getResourceName(windowTitle)));
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
Scene scene = new Scene(root.load(), 960, 540); Scene scene = new Scene(root.load(), 960, 540);
......
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