|
|
|
|
@ -1,12 +1,21 @@
|
|
|
|
|
package seng202.group9.Controller;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
import javafx.application.Application;
|
|
|
|
|
import javafx.fxml.FXMLLoader;
|
|
|
|
|
import javafx.fxml.Initializable;
|
|
|
|
|
import javafx.fxml.JavaFXBuilderFactory;
|
|
|
|
|
import javafx.scene.Parent;
|
|
|
|
|
import javafx.scene.Scene;
|
|
|
|
|
import javafx.scene.control.Menu;
|
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
|
import javafx.scene.layout.BorderPane;
|
|
|
|
|
import javafx.scene.layout.VBox;
|
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
import seng202.group9.GUI.MainMenuBar;
|
|
|
|
|
import seng202.group9.GUI.MenuController;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main Application frame of the Flight Data Analyser.
|
|
|
|
|
@ -16,6 +25,7 @@ public class App extends Application
|
|
|
|
|
{
|
|
|
|
|
private ArrayList<Dataset> Datasets = new ArrayList<Dataset>();
|
|
|
|
|
private Dataset currentDataset = null;
|
|
|
|
|
private Stage primaryStage = null;
|
|
|
|
|
|
|
|
|
|
public static void main( String[] args )
|
|
|
|
|
{
|
|
|
|
|
@ -27,14 +37,12 @@ public class App extends Application
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void start(Stage primaryStage) {
|
|
|
|
|
BorderPane root = new BorderPane(); //root panel
|
|
|
|
|
Scene scene = new Scene(root,400,400);
|
|
|
|
|
//create the menu
|
|
|
|
|
MainMenuBar menuBar = new MainMenuBar();
|
|
|
|
|
root.setTop(menuBar.getmenuBar());
|
|
|
|
|
//TODO add the getting started page here.
|
|
|
|
|
|
|
|
|
|
primaryStage.setScene(scene);
|
|
|
|
|
this.primaryStage = primaryStage;
|
|
|
|
|
try {
|
|
|
|
|
replaceSceneContent("menu.fxml");//replace this to check your fxml file
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
primaryStage.show();
|
|
|
|
|
//testing out dataset
|
|
|
|
|
try {
|
|
|
|
|
@ -62,6 +70,30 @@ public class App extends Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Replace Scene Content with fxml file code from oracle.
|
|
|
|
|
* @param fxml
|
|
|
|
|
* @return
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
private Initializable replaceSceneContent(String fxml) throws Exception {
|
|
|
|
|
FXMLLoader loader = new FXMLLoader();
|
|
|
|
|
InputStream in = getClass().getClassLoader().getResourceAsStream(fxml);
|
|
|
|
|
InputStream menuIn = getClass().getClassLoader().getResourceAsStream("menu.fxml");
|
|
|
|
|
VBox page;
|
|
|
|
|
try {
|
|
|
|
|
page = (VBox) loader.load(menuIn);
|
|
|
|
|
Parent content = loader.load(getClass().getClassLoader().getResource(fxml));
|
|
|
|
|
page.getChildren().add(content);
|
|
|
|
|
} finally {
|
|
|
|
|
in.close();
|
|
|
|
|
}
|
|
|
|
|
Scene scene = new Scene(page, 800, 600);
|
|
|
|
|
primaryStage.setScene(scene);
|
|
|
|
|
primaryStage.sizeToScene();
|
|
|
|
|
return (Initializable) loader.getController();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dataset getCurrentDataset(){
|
|
|
|
|
return currentDataset;
|
|
|
|
|
}
|
|
|
|
|
|