BakeoutController-Basic  0.1
A Controller for the Omicron vacuum chamber
AutowiredFXMLStage.java
1 package ui;
2 
3 import javafx.scene.Scene;
4 import javafx.stage.Modality;
5 import javafx.stage.Stage;
6 import javafx.stage.StageStyle;
7 import javafx.stage.Window;
8 import org.springframework.beans.factory.annotation.Autowired;
9 
10 import java.io.IOException;
11 import java.net.URL;
12 
18 public class AutowiredFXMLStage extends Stage implements FXMLStage {
19 
24  @Autowired
25  private FXMLLoader fxmlLoader;
26 
30  private URL fxml;
31 
37  public AutowiredFXMLStage(URL fxml, Window owner){
38  this(fxml, owner, StageStyle.DECORATED);
39  }
40 
47  public AutowiredFXMLStage(URL fxml, Window owner, StageStyle style){
48  super(style);
49  this.fxml = fxml;
50  initOwner(owner);
51  initModality(Modality.NONE);
52  }
53 
57  @Override public void loadFXML() throws IOException {
58  resetLoader();
59  this.fxmlLoader.setLocation(this.fxml);
60  setScene(new Scene(this.fxmlLoader.load()));
61  }
62 
66  @Override public void setFXMLLoader(FXMLLoader loader){
67  this.fxmlLoader = loader;
68  }
69 
74  private void resetLoader(){
75  this.fxmlLoader.setRoot(null);
76  this.fxmlLoader.setLocation(null);
77  }
78 }
void setFXMLLoader(FXMLLoader loader)
AutowiredFXMLStage(URL fxml, Window owner, StageStyle style)
AutowiredFXMLStage(URL fxml, Window owner)
Git Repo