parent
caed3e64b3
commit
8abe49ab15
@ -0,0 +1,86 @@
|
||||
package controllers;
|
||||
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.BackgroundFill;
|
||||
import javafx.scene.paint.Color;
|
||||
import model.Trip;
|
||||
import model.TripStop;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Created by Gondr on 24/05/2017.
|
||||
*/
|
||||
public class MyTripsController extends Controller{
|
||||
@FXML
|
||||
private Label rideLabel;
|
||||
@FXML
|
||||
private Label directionLabel;
|
||||
@FXML
|
||||
private Label mondayLabel;
|
||||
@FXML
|
||||
private Label tuesdayLabel;
|
||||
@FXML
|
||||
private Label wednesdayLabel;
|
||||
@FXML
|
||||
private Label thursdayLabel;
|
||||
@FXML
|
||||
private Label fridayLabel;
|
||||
@FXML
|
||||
private Label reoccuringLabel;
|
||||
@FXML
|
||||
private Label endDateLabel;
|
||||
@FXML
|
||||
private TableView<TripStop> stopsList;
|
||||
@FXML
|
||||
private ListView<Trip> tripsList;
|
||||
@FXML
|
||||
private ObservableList<Trip> trips;
|
||||
|
||||
public void setRideDays(Label day, boolean travelling){
|
||||
if (travelling){
|
||||
day.setTextFill(Color.GREEN);
|
||||
}else{
|
||||
day.setTextFill(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runLater(){
|
||||
//fill tables etc;
|
||||
trips = parent.getSession().getDataManager().getTrips();
|
||||
tripsList.setItems(trips);
|
||||
tripsList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
Trip trip = tripsList.getSelectionModel().getSelectedItem();
|
||||
stopsList.setItems(trip.route);
|
||||
rideLabel.setText(trip.ride.toString());
|
||||
directionLabel.setText(trip.direction);
|
||||
setRideDays(mondayLabel, trip.days[Trip.MONDAY]);
|
||||
setRideDays(tuesdayLabel, trip.days[Trip.TUESDAY]);
|
||||
setRideDays(wednesdayLabel, trip.days[Trip.WEDNESDAY]);
|
||||
setRideDays(thursdayLabel, trip.days[Trip.THURSDAY]);
|
||||
setRideDays(fridayLabel, trip.days[Trip.FRIDAY]);
|
||||
if (trip.reoccur){
|
||||
reoccuringLabel.setText("Yes");
|
||||
endDateLabel.setText(trip.endDate);
|
||||
}else{
|
||||
reoccuringLabel.setText("No");
|
||||
endDateLabel.setText("-");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
rideLabel.setText("-");
|
||||
directionLabel.setText("-");
|
||||
reoccuringLabel.setText("-");
|
||||
endDateLabel.setText("-");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?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.MyTripsController">
|
||||
<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="300.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="300.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="300.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="40.0" minHeight="40.0" prefHeight="40.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="348.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<ListView fx:id="tripsList" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="2" />
|
||||
<Label text="My Trips" GridPane.columnSpan="3" GridPane.halignment="CENTER">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="Trips" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="Stops" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TableView fx:id="stopsList" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<columns>
|
||||
<TableColumn prefWidth="104.0" text="Time" />
|
||||
<TableColumn prefWidth="95.0" text="Stop" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<Label text="Information" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<GridPane GridPane.columnIndex="2" GridPane.rowIndex="2">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="80.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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label text="Ride:" />
|
||||
<Label fx:id="rideLabel" text="Label" GridPane.columnIndex="1" />
|
||||
<Label text="Direction:" GridPane.rowIndex="1" />
|
||||
<Label fx:id="directionLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||
<Label text="Days:" GridPane.rowIndex="2" />
|
||||
<Label text="Reoccuring:" GridPane.rowIndex="3" />
|
||||
<Label text="Trip End Date:" GridPane.rowIndex="4" />
|
||||
<Label fx:id="reoccuringLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||
<Label fx:id="endDateLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
||||
<children>
|
||||
<Label fx:id="mondayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="M" AnchorPane.bottomAnchor="23.0" AnchorPane.topAnchor="22.0">
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="tuesdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="T">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="wednesdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="W">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="thursdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="T">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="fridayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="F">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets left="10.0" />
|
||||
</GridPane.margin>
|
||||
</GridPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?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.MyTripsController">
|
||||
<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="300.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="300.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="300.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="40.0" minHeight="40.0" prefHeight="40.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="348.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<ListView fx:id="tripsList" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="2" />
|
||||
<Label text="My Trips" GridPane.columnSpan="3" GridPane.halignment="CENTER">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="Trips" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="Stops" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TableView fx:id="stopsList" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<columns>
|
||||
<TableColumn prefWidth="104.0" text="Time" />
|
||||
<TableColumn prefWidth="95.0" text="Stop" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<Label text="Information" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<GridPane GridPane.columnIndex="2" GridPane.rowIndex="2">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="80.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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label text="Ride:" />
|
||||
<Label fx:id="rideLabel" text="Label" GridPane.columnIndex="1" />
|
||||
<Label text="Direction:" GridPane.rowIndex="1" />
|
||||
<Label fx:id="directionLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||
<Label text="Days:" GridPane.rowIndex="2" />
|
||||
<Label text="Reoccuring:" GridPane.rowIndex="3" />
|
||||
<Label text="Trip End Date:" GridPane.rowIndex="4" />
|
||||
<Label fx:id="reoccuringLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||
<Label fx:id="endDateLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
||||
<children>
|
||||
<Label fx:id="mondayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="M" AnchorPane.bottomAnchor="23.0" AnchorPane.topAnchor="22.0">
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="tuesdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="T">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="wednesdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="W">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="thursdayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="T">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="fridayLabel" style="-fx-border-color: #F0F0F0; -fx-border-width: 1;" text="F">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets left="10.0" />
|
||||
</GridPane.margin>
|
||||
</GridPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
@ -1 +1 @@
|
||||
[{"serialisedRoute":[{"serialiseTime":"3:00","serialiseName":"1 University Drive"},{"serialiseTime":"3:10","serialiseName":"1 Homestead Lane"}],"direction":"Home","ride":{"model":"Nissan March","colour":"Baby Blue","licensePlate":"H19405661","year":2004,"numSeats":4},"days":[true,false,false,false,false,false,false],"reoccur":false,"endDate":""}]
|
||||
[{"serialisedRoute":[{"serialiseTime":"3:00","serialiseName":"1 University Drive"},{"serialiseTime":"3:10","serialiseName":"1 Homestead Lane"}],"direction":"Home","ride":{"model":"Nissan March","colour":"Baby Blue","licensePlate":"H19405661","year":2004,"numSeats":4},"days":[true,false,false,false,false,false,false],"reoccur":false,"endDate":"","name":"University to Home"}]
|
||||
Loading…
Reference in new issue