Fixed conflicts
This commit is contained in:
@@ -9,7 +9,7 @@ public enum SceneCode {
|
|||||||
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
|
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
|
||||||
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
|
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
|
||||||
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
|
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
|
||||||
AIRPORT_DIST_CALC("airport_dist_calc.fxml");
|
AIRPORT_DIST_CALC("airport_dist_calc.fxml"), AIRLINE_ADD("airline_add_form.fxml");
|
||||||
|
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ public class AirlineRDController extends Controller {
|
|||||||
* Opens the Airline add form.
|
* Opens the Airline add form.
|
||||||
*/
|
*/
|
||||||
public void openAdd() {
|
public void openAdd() {
|
||||||
|
createPopUpStage(SceneCode.AIRLINE_ADD, 600, 370);
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader();
|
FXMLLoader loader = new FXMLLoader();
|
||||||
Parent root = loader.load(getClass().getClassLoader().getResource("airline_add_form.fxml"));
|
Parent root = loader.load(getClass().getClassLoader().getResource("airline_add_form.fxml"));
|
||||||
@@ -89,8 +91,13 @@ public class AirlineRDController extends Controller {
|
|||||||
filter.show();
|
filter.show();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
package seng202.group9.GUI;
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.SceneCode;
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@@ -50,6 +58,44 @@ public abstract class Controller implements Initializable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a popup window with a specific fxml scene
|
||||||
|
* @param scene
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
*/
|
||||||
|
public Stage createPopUpStage(SceneCode scene, int width, int height) {
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
InputStream in = getClass().getClassLoader().getResourceAsStream(scene.getFilePath());
|
||||||
|
Parent page = null;
|
||||||
|
try {
|
||||||
|
page = loader.load(in);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//set contorller and call default calls
|
||||||
|
Controller controller = loader.getController();
|
||||||
|
controller.setApp(parent);
|
||||||
|
controller.load();
|
||||||
|
controller.loadOnce();
|
||||||
|
//create a new stage to popup
|
||||||
|
Stage popupStage = new Stage();
|
||||||
|
popupStage.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
//inner layout constraints
|
||||||
|
VBox container = new VBox();
|
||||||
|
container.getChildren().add(page);
|
||||||
|
Scene popupScene = new Scene(container, width, height);
|
||||||
|
//show
|
||||||
|
popupStage.setScene(popupScene);
|
||||||
|
popupStage.showAndWait();
|
||||||
|
return popupStage;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Functions here will only load once and after the load function.
|
* Functions here will only load once and after the load function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user