Gets information for airlines

main
Sunguin Peng 9 years ago
parent 8fb7a36d80
commit e237d058bd

Binary file not shown.

@ -11,7 +11,7 @@ public enum SceneCode {
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
AIRPORT_DIST_CALC("airport_dist_calc.fxml"), AIRLINE_ADD("airline_add_form.fxml"), AIRLINE_FILTER("airline_filter_form.fxml"),
AIRPORT_ADD("airport_add_form.fxml"), AIRPORT_FILTER("airport_filter_form.fxml"), ROUTE_ADD("route_add_form.fxml"),
ROUTE_FILTER("route_filter_form.fxml");
ROUTE_FILTER("route_filter_form.fxml"), AIRLINE_EDIT("airline_edit_form.fxml");
private String filePath;

@ -12,10 +12,14 @@ import java.util.HashMap;
*/
public class Session implements Serializable {
private SceneCode sceneDisplayed;
private HashMap<Integer, String> filteredAirlines;
private HashMap<Integer, String> filteredAirports;
private HashMap<Integer, String> filteredRoutes;
private String airlineToEdit;
/**
* Constructor for a new session
*/
@ -71,4 +75,12 @@ public class Session implements Serializable {
public HashMap<Integer, String> getFilteredRoutes() {
return filteredRoutes;
}
public void setAirlineToEdit(String name) {
this.airlineToEdit = name;
}
public String getAirlineToEdit() {
return airlineToEdit;
}
}

@ -0,0 +1,54 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airline;
/**
* Created by Sunguin on 2016/09/24.
*/
public class AirlineEditController extends Controller {
//Setting up text fields for editing data
@FXML
private TextField airlNameEdit;
@FXML
private TextField airlAliasEdit;
@FXML
private TextField airlIATAEdit;
@FXML
private TextField airlICAOEdit;
@FXML
private TextField airlCallsignEdit;
@FXML
private TextField airlCountryEdit;
@FXML
private TextField airlActiveEdit;
@FXML
private Button applyButton;
private Dataset theDataSet = null;
private Session currentSession = null;
public void editAirline() {
}
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
//System.out.println(currentSession.getAirlineToEdit());
Airline toEdit = theDataSet.getAirlineDictionary().get(currentSession.getAirlineToEdit());
airlNameEdit.setText(toEdit.getName());
airlAliasEdit.setText(toEdit.getAlias());
airlIATAEdit.setText(toEdit.getIATA());
airlICAOEdit.setText(toEdit.getICAO());
airlCallsignEdit.setText(toEdit.getCallSign());
airlCountryEdit.setText(toEdit.getCountryName());
airlActiveEdit.setText(toEdit.getActive());
}
}

@ -104,7 +104,6 @@ public class AirlineRDController extends Controller {
alert.setTitle("Airline Delete Confirmation");
alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected airline(s)?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait();
Airline air = null;
if (result.isPresent() && result.get() == ButtonType.OK) {
@ -116,6 +115,11 @@ public class AirlineRDController extends Controller {
}
}
public void editAirline() {
Airline toEdit = tableViewAirlineRD.getSelectionModel().getSelectedItem();
currentSession.setAirlineToEdit(toEdit.getName());
createPopUpStage(SceneCode.AIRLINE_EDIT, 600, 370);
}
/**
* Analyses the current data and creates a graph based on the data.

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="370.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirlineEditController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="125.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="445.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Edit Airline" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Name" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Alias" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="IATA" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="ICAO" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Callsign" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Country" GridPane.halignment="LEFT" GridPane.rowIndex="6">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Active" GridPane.halignment="LEFT" GridPane.rowIndex="7">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="applyButton" mnemonicParsing="false" onAction="#editAirline" text="Apply Conditions" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
<TextField fx:id="airlNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airlAliasEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airlIATAEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airlICAOEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airlCallsignEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airlCountryEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="airlActiveEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
</children>
</GridPane>

@ -49,6 +49,7 @@
<contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#editAirline" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deleteAirline" text="Delete" />
</items>
</ContextMenu>

Loading…
Cancel
Save