aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2018-06-18 21:30:20 +0200
committerTharre <tharre3@gmail.com>2018-06-18 21:45:37 +0200
commitfbc917477d106be774d9c093ac42319aeadf1eff (patch)
treeb1071538988f7cdc1e1e7a2e246c93e72e4faa35 /src
parent41eaffacce8c35e517ec5a1e7a914858a0717a1d (diff)
downloadsepm-groupproject-fbc917477d106be774d9c093ac42319aeadf1eff.tar.gz
sepm-groupproject-fbc917477d106be774d9c093ac42319aeadf1eff.tar.xz
sepm-groupproject-fbc917477d106be774d9c093ac42319aeadf1eff.zip
RequestVehicles GUI list seperation #25953
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java24
-rw-r--r--src/main/resources/fxml/OperationDetails.fxml11
2 files changed, 30 insertions, 5 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
index 38d3bd1..937a86a 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/controller/OperationDetailsController.java
@@ -39,6 +39,7 @@ public class OperationDetailsController {
private final VehicleService vehicleService;
private final CreateOperationController createOperationController;
@FXML private FlowPane fpVehicles;
+ @FXML private FlowPane fpAdditional;
@FXML private ListView<Operation> lvActiveOperations;
@FXML private Label lblChosenVehicles;
@FXML private Button btnCloseOperation;
@@ -75,11 +76,20 @@ public class OperationDetailsController {
fpVehicles.getChildren().clear();
for (Vehicle vehicle : operation.vehicles()) {
VehiclePaneController controller = VehiclePaneController.createVehiclePane();
+ controller.setData(vehicle, true, false);
+ fpVehicles.getChildren().add(controller.getRootElement());
+ }
+
+ fpAdditional.getChildren().clear();
+ for (Vehicle vehicle : operationService.rankVehicles(operation.opCode())) {
+ if (operation.vehicles().contains(vehicle)) continue;
+
+ VehiclePaneController controller = VehiclePaneController.createVehiclePane();
controller.setData(vehicle, true, true);
controller.getBtnRequest().setOnAction(e -> requestVehicleClicked(controller));
- fpVehicles.getChildren().add(controller.getRootElement());
+ fpAdditional.getChildren().add(controller.getRootElement());
}
- } catch (IOException e) {
+ } catch (IOException | ServiceException | InvalidOperationException e) {
LOG.error("Error while updating list.", e);
showServiceExceptionAlertAndWait("Error while updating list.");
}
@@ -150,15 +160,21 @@ public class OperationDetailsController {
private void requestVehicleClicked(VehiclePaneController v) {
LOG.debug("Button \"Nachfordern\" clicked.");
+ Vehicle vehicle;
+
try {
- operationService.requestVehicles(operation.id(), Set.of(v.getData().id()));
+ vehicle = v.getData();
+ if (vehicle == null) return;
+
+ operationService.requestVehicles(operation.id(), Set.of(vehicle.id()));
} catch (ServiceException | InvalidOperationException | InvalidVehicleException e) {
LOG.error("Exception in requestVehicleClicked()", e);
showServiceExceptionAlertAndWait(e.getMessage());
return;
}
showSuccessAlertAndWait("Das Fahrzeug wurde erfolgreich angefordert");
- createOperationController.updateList();
+ operation.vehicles().add(vehicle);
+ updateFlowPane();
}
public void closeWindow() {
diff --git a/src/main/resources/fxml/OperationDetails.fxml b/src/main/resources/fxml/OperationDetails.fxml
index e1a4daa..9d2fb5b 100644
--- a/src/main/resources/fxml/OperationDetails.fxml
+++ b/src/main/resources/fxml/OperationDetails.fxml
@@ -9,6 +9,7 @@
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.text.Font?>
+<?import javafx.scene.layout.VBox?>
<AnchorPane fx:id="operationDetailsAP" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="542.0" prefWidth="1100.0" visible="false" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.controller.OperationDetailsController">
<children>
<AnchorPane prefHeight="542.0" prefWidth="1100.0" style="-fx-background-color: rgba(239,235,232,1);" />
@@ -94,7 +95,15 @@
</AnchorPane>
<ScrollPane layoutX="16.0" layoutY="195.0" prefHeight="345.0" prefWidth="846.0">
<content>
- <FlowPane fx:id="fpVehicles" hgap="12" prefHeight="336.0" prefWidth="840.0" vgap="12" />
+ <VBox>
+ <FlowPane fx:id="fpVehicles" hgap="12" prefHeight="168.0" prefWidth="840.0" vgap="12" />
+ <Label text="Weitere Fahrzeuge:" >
+ <font>
+ <Font name="System Bold" size="19.0" />
+ </font>
+ </Label>
+ <FlowPane fx:id="fpAdditional" hgap="12" prefHeight="168.0" prefWidth="840.0" vgap="12" />
+ </VBox>
</content>
</ScrollPane>
</children>