Story one is minimalistically working.

main
Fan-Wu Yang 9 years ago
parent 1516fc3916
commit 360909eb38

@ -0,0 +1,73 @@
package controllers;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.TextField;
import model.Ride;
import model.SceneCode;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Gondr on 4/04/2017.
*/
public class AddRideController extends Controller{
@FXML
TextField model;
@FXML
TextField colour;
@FXML
TextField license;
@FXML
TextField year;
@FXML
TextField numSeats;
public void addRide() throws Exception {
//check for invalid data
String failure = "";
if (model.getText().length() == 0){
failure += "Mandatory Field model is not entered.\n";
}
if (colour.getText().length() == 0){
failure += "Mandatory Field colour is not entered.\n";
}
if (license.getText().length() == 0){
failure += "Mandatory Field license is not entered.\n";
}
if (year.getText().length() == 0){
failure += "Mandatory Field year is not entered.\n";
}
int numYear = 0;
try{
numYear = Integer.parseInt(year.getText());
//TODO other checks here like the year cannot be too old, cannot be more than this year etc
}catch (Exception e){
failure += "Year must be a Integer.\n";
}
if (numSeats.getText().length() == 0){
failure += "Mandatory Field number of seats is not entered.\n";
}
int seats = 0;
try{
seats = Integer.parseInt(numSeats.getText());
//TODO other checks here like the year cannot be too old, cannot be more than this year etc
}catch (Exception e){
failure += "Seats must be a Integer.\n";
}
if (failure == ""){
//pass
Ride ride = new Ride(model.getText(), colour.getText(), license.getText(), numYear, seats);
parent.getSession().getDataManager().addRides(ride);
changeScene(SceneCode.MY_RIDES);
}else{
popUp(Alert.AlertType.WARNING, "Unable to Add Ride!", "Invalid Data", failure);
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}

@ -0,0 +1,48 @@
package controllers;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import model.SceneCode;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Gondr on 4/04/2017.
*/
public class BaseController extends Controller {
@FXML
GridPane base;
@FXML
Label loggedInAs;
private final int childNum = 3;//number of children before appending
public void addRide() throws Exception {
changeScene(SceneCode.ADD_RIDE);
}
public void myRides() throws Exception{
changeScene(SceneCode.MY_RIDES);
}
public void setContent(Parent parent1){
//remove all children that do not belong to the original fxml
while (base.getChildren().size() > childNum) {
base.getChildren().remove(base.getChildren().size() - 1);
}
base.add(parent1, 1, 0);
loggedInAs.setText(String.format("Logged in as %s", parent.getSession().getUserCode()));
}
public void logout() throws Exception {
changeScene(SceneCode.MAIN);
}
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}

@ -0,0 +1,47 @@
package controllers;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Modality;
import javafx.stage.Stage;
import model.SceneCode;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Gondr on 4/04/2017.
*/
public abstract class Controller implements Initializable {
protected Main parent;
public Controller(){
}
public void setParent(Main parent){
this.parent = parent;
}
public void changeScene(SceneCode scene) throws Exception {
parent.replaceSceneContent(scene);
}
public void runLater(){
}
public void popUp(Alert.AlertType alertType, String title, String header, String content){
Alert alert = new Alert(alertType);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(content);
alert.showAndWait();
}
}

@ -0,0 +1,15 @@
package controllers;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Gondr on 4/04/2017.
*/
public class HomeController extends Controller{
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}

@ -1,3 +1,4 @@
package controllers;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
@ -7,6 +8,7 @@ import javafx.scene.Scene;
import javafx.stage.Stage;
import model.SceneCode;
import model.Session;
import java.io.InputStream;
@ -17,17 +19,25 @@ import java.io.InputStream;
public class Main extends Application {
private Stage primaryStage;
private Scene base;
private BaseController baseController;
private Session session;
public void start(Stage stage) throws Exception {
this.primaryStage = stage;
replaceSceneContent(SceneCode.MAIN);
//FXMLLoader loader = new FXMLLoader(getClass().getResource("scenes/main.fxml"));
//load up base pane
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("scenes/base.fxml"));
Parent root = loader.load();
base = new Scene(root, SceneCode.prefWidth, SceneCode.prefHeight);
baseController = (BaseController) loader.getController();
baseController.setParent(this);
//Parent root = loader.load();
//Scene scene = new Scene(root, 500, 400);
this.session = new Session();
//set up stage
stage.setTitle("UC RSS");
//stage.setScene(scene);
stage.show();
}
@ -38,7 +48,7 @@ public class Main extends Application {
* @return
* @throws Exception
*/
public Initializable replaceSceneContent(SceneCode fxml) throws Exception {
public void replaceSceneContent(SceneCode fxml) throws Exception {
FXMLLoader loader = new FXMLLoader();
InputStream in = getClass().getClassLoader().getResourceAsStream(fxml.getPath());
Parent page;
@ -49,11 +59,24 @@ public class Main extends Application {
}
Scene scene = null;
if (fxml.isLoadMenu()){
scene = base;
baseController.setContent(page);
}else {
scene = new Scene(page, SceneCode.prefWidth, SceneCode.prefHeight);
}
primaryStage.setScene(scene);
return (Initializable) loader.getController();
Controller controller = loader.getController();
if (controller != null) {
controller.setParent(this);
controller.runLater();
}
}
public Session getSession() {
return session;
}
public Stage getPrimaryStage() {
return primaryStage;
}
}

@ -1,6 +1,12 @@
package controllers;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Control;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import model.SceneCode;
import java.net.URL;
import java.util.ResourceBundle;
@ -8,7 +14,29 @@ import java.util.ResourceBundle;
/**
* Created by samschofield on 15/03/17.
*/
public class MainController implements Initializable {
public class MainController extends Controller{
@FXML
TextField username;
@FXML
PasswordField password;
public boolean validateLogin(){
if (username.getText().equals(password.getText())){
return true;
}
return false;
}
public void login() throws Exception {
//validate login
if (validateLogin()){
parent.getSession().setUserCode(username.getText());
changeScene(SceneCode.HOME);
}else{
popUp(Alert.AlertType.WARNING, "Warning!", "Invalid Login!", "Your password and username do not match a record in our database.");
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {

@ -0,0 +1,28 @@
package controllers;
import javafx.fxml.FXML;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import model.Ride;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Gondr on 4/04/2017.
*/
public class MyRidesController extends Controller{
@FXML
ListView<Ride> rideList;
@Override
public void initialize(URL location, ResourceBundle resources) {
}
@Override
public void runLater() {
rideList.setItems(parent.getSession().getDataManager().getRides());
}
}

@ -0,0 +1,39 @@
package model;
import javafx.collections.FXCollections;
import javafx.collections.ObservableArray;
import javafx.collections.ObservableList;
import javafx.collections.ObservableSet;
import java.util.ArrayList;
/**
* Created by Gondr on 4/04/2017.
*/
public class DataManager {
private ObservableList<Ride> rides;
public DataManager(){
rides = FXCollections.observableArrayList();
}
public ObservableList<Ride> getRides() {
return rides;
}
public void setRides(ObservableList<Ride> rides) {
this.rides = rides;
}
public void addRides(Ride ride){
rides.add(ride);
}
public void removeRide(Ride ride){
rides.remove(ride);
}
public void removeRide(int i){
rides.remove(i);
}
}

@ -0,0 +1,25 @@
package model;
/**
* Created by Gondr on 4/04/2017.
*/
public class Ride {
private String model, colour, licensePlate;
private int year, numSeats;
public Ride(String model, String colour, String licensePlate, int year, int numSeats){
//model,colour, license plate, year and the number of physical seats
this.model = model;
this.colour = colour;
this.licensePlate = licensePlate;
this.year = year;
this.numSeats = numSeats;
}
@Override
public String toString(){
return String.format("%s - %s %s", licensePlate, colour, model);
}
}

@ -11,19 +11,22 @@ import java.io.InputStream;
* Created by fwy13 on 4/04/17.
*/
public enum SceneCode {
MAIN("main", false);
//screens before log in
MAIN("main", false), BASE("base", false),
//screens after login
HOME("home"),ADD_RIDE("addride"),MY_RIDES("myrides");
private String path;
private boolean loadMenu;
public static int prefWidth = 1200;
public static int prefHeight = 900;
public static int prefWidth = 600;
public static int prefHeight = 400;
SceneCode(String path){
this(path, true);
}
SceneCode(String path, boolean loadMenu){
this.path = path;
this.path = "scenes/"+path+".fxml";
this.loadMenu = loadMenu;
}

@ -6,8 +6,25 @@ package model;
public class Session {
private String userCode;//this is like fwy13
DataManager dataManager;
public Session(){
dataManager = new DataManager();
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public DataManager getDataManager() {
return dataManager;
}
public void setDataManager(DataManager dataManager) {
this.dataManager = dataManager;
}
}

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.AddRideController">
<children>
<GridPane layoutX="154.0" layoutY="68.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Add a Ride" GridPane.columnSpan="4" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Model:" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="1" />
<Label text="Colour:" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="License Plate:" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Year:" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="Number of Seats:" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Button mnemonicParsing="false" onAction="#addRide" prefHeight="25.0" prefWidth="187.0" text="Submit" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="6" />
<TextField fx:id="model" GridPane.columnIndex="2" GridPane.rowIndex="1" />
<TextField fx:id="colour" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<TextField fx:id="license" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<TextField fx:id="year" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<TextField fx:id="numSeats" GridPane.columnIndex="2" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.BaseController">
<children>
<GridPane fx:id="base" layoutX="56.0" layoutY="75.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="376.0" minHeight="10.0" prefHeight="365.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Accordion GridPane.rowSpan="2">
<panes>
<TitledPane animated="false" text="User Profile">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane>
<children>
<Button mnemonicParsing="false" onAction="#myRides" text="Rides" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" GridPane.hgrow="ALWAYS" GridPane.valignment="TOP" />
</children>
</AnchorPane>
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</TitledPane>
<TitledPane text="User Controls">
<content>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane>
<children>
<Button mnemonicParsing="false" onAction="#addRide" text="Add Ride" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" GridPane.hgrow="ALWAYS" GridPane.valignment="TOP" GridPane.vgrow="ALWAYS" />
</children>
</AnchorPane>
</children>
</GridPane>
</content>
</TitledPane>
</panes>
</Accordion>
<Label fx:id="loggedInAs" text="Logged in as " GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets right="55.0" />
</GridPane.margin>
</Label>
<Button mnemonicParsing="false" onAction="#logout" text="Logout" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.HomeController">
<children>
<GridPane layoutX="130.0" layoutY="40.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to UC Ride Sharing System" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</children>
</GridPane>
</children>
</AnchorPane>

@ -1,24 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MainController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="332.0" minWidth="10.0" prefWidth="218.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="307.0" minWidth="10.0" prefWidth="304.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to the UC Ride Sharing System" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="22.0" />
</font>
</Label>
</children>
</GridPane>
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MainController">
<children>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="0.0" prefWidth="150.0" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="0.0" prefWidth="150.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to the UC Ride Sharing System" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="1">
<font>
<Font size="22.0" />
</font>
</Label>
<Label text="Login" textAlignment="CENTER" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
<GridPane GridPane.columnIndex="1" GridPane.rowIndex="3">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="65.0" minWidth="10.0" prefWidth="65.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="80.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Username:" />
<Label text="Password" GridPane.rowIndex="1" />
<TextField fx:id="username" GridPane.columnIndex="1" />
<PasswordField fx:id="password" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Button mnemonicParsing="false" onAction="#login" text="Login" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowSpan="2" GridPane.valignment="CENTER" />
</children>
</GridPane>
<Label text="Note for now as long as the username is the same as the password the application will work." GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MyRidesController">
<children>
<GridPane layoutX="213.0" layoutY="99.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="348.0" minHeight="10.0" prefHeight="348.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ListView fx:id="rideList" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<Label text="My Rides" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,18 @@
package model;/**
* Created by Gondr on 4/04/2017.
*/
import static org.junit.Assert.*;
import org.junit.Test;
public class DataManagerTest {
@Test
public void AddRide(){
DataManager dataManager = new DataManager();
Ride ride = new Ride("Nissan March", "Blue", "HB9999", 2008, 4);
dataManager.addRides(ride);
}
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.AddRideController">
<children>
<GridPane layoutX="154.0" layoutY="68.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Add a Ride" GridPane.columnSpan="4" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Model:" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="1" />
<Label text="Colour:" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="License Plate:" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Year:" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="Number of Seats:" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Button mnemonicParsing="false" onAction="#addRide" prefHeight="25.0" prefWidth="187.0" text="Submit" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="6" />
<TextField fx:id="model" GridPane.columnIndex="2" GridPane.rowIndex="1" />
<TextField fx:id="colour" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<TextField fx:id="license" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<TextField fx:id="year" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<TextField fx:id="numSeats" GridPane.columnIndex="2" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.BaseController">
<children>
<GridPane fx:id="base" layoutX="56.0" layoutY="75.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="376.0" minHeight="10.0" prefHeight="365.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Accordion GridPane.rowSpan="2">
<panes>
<TitledPane animated="false" text="User Profile">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane>
<children>
<Button mnemonicParsing="false" onAction="#myRides" text="Rides" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" GridPane.hgrow="ALWAYS" GridPane.valignment="TOP" />
</children>
</AnchorPane>
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</TitledPane>
<TitledPane text="User Controls">
<content>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane>
<children>
<Button mnemonicParsing="false" onAction="#addRide" text="Add Ride" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" GridPane.hgrow="ALWAYS" GridPane.valignment="TOP" GridPane.vgrow="ALWAYS" />
</children>
</AnchorPane>
</children>
</GridPane>
</content>
</TitledPane>
</panes>
</Accordion>
<Label fx:id="loggedInAs" text="Logged in as " GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets right="55.0" />
</GridPane.margin>
</Label>
<Button mnemonicParsing="false" onAction="#logout" text="Logout" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.HomeController">
<children>
<GridPane layoutX="130.0" layoutY="40.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to UC Ride Sharing System" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</children>
</GridPane>
</children>
</AnchorPane>

@ -1,24 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MainController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="332.0" minWidth="10.0" prefWidth="218.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="307.0" minWidth="10.0" prefWidth="304.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to the UC Ride Sharing System" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="22.0" />
</font>
</Label>
</children>
</GridPane>
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MainController">
<children>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="0.0" prefWidth="150.0" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="0.0" prefWidth="150.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="10.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Welcome to the UC Ride Sharing System" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="1">
<font>
<Font size="22.0" />
</font>
</Label>
<Label text="Login" textAlignment="CENTER" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
<GridPane GridPane.columnIndex="1" GridPane.rowIndex="3">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="65.0" minWidth="10.0" prefWidth="65.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="80.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Username:" />
<Label text="Password" GridPane.rowIndex="1" />
<TextField fx:id="username" GridPane.columnIndex="1" />
<PasswordField fx:id="password" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Button mnemonicParsing="false" onAction="#login" text="Login" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowSpan="2" GridPane.valignment="CENTER" />
</children>
</GridPane>
<Label text="Note for now as long as the username is the same as the password the application will work." GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
</children>
</GridPane>
</children>
</AnchorPane>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MyRidesController">
<children>
<GridPane layoutX="213.0" layoutY="99.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="348.0" minHeight="10.0" prefHeight="348.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ListView fx:id="rideList" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
<Label text="My Rides" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</children>
</GridPane>
</children>
</AnchorPane>
Loading…
Cancel
Save