BakeoutController  0.1
A Controller for the Omicron vacuum chamber
DevicesController.java
1 package ui.controllers;
2 
3 import javafx.fxml.FXML;
4 import javafx.stage.Window;
5 import org.springframework.beans.factory.annotation.Autowired;
7 import ui.Controller;
8 import ui.FXMLLoader;
9 import ui.FXMLStage;
10 
11 import javax.annotation.PostConstruct;
12 import java.io.IOException;
13 import java.net.URL;
14 
19 public class DevicesController {
23  private FXMLStage newDeviceFormStage;
24 
28  private final URL newDeviceFormLocation = getClass().getResource(
29  "/modals/NewDevice.fxml"
30  );
31 
35  @Autowired
36  private FXMLStage applicationStage;
37 
42  @Autowired
43  private FXMLLoader fxmlLoader;
44 
49  @PostConstruct
50  public void setUp() throws IOException {
51  configureNewDeviceFormStage();
52  }
53 
57  @FXML public void displayNewDeviceForm(){
58  newDeviceFormStage.show();
59  }
60 
66  private void configureNewDeviceFormStage() throws IOException {
67  newDeviceFormStage = new AutowiredFXMLStage(
68  newDeviceFormLocation, castStageToWindow(applicationStage)
69  );
70  newDeviceFormStage.setFXMLLoader(fxmlLoader);
71  newDeviceFormStage.loadFXML();
72  }
73 
78  private static Window castStageToWindow(FXMLStage stage){
79  return (Window) stage;
80  }
81 }
void loadFXML()
void setFXMLLoader(FXMLLoader loader)
Git Repo