From 41f094201aaeb573968d2b96b9dc6760e0c5aedc Mon Sep 17 00:00:00 2001 From: Tharre Date: Sat, 12 May 2018 01:58:06 +0200 Subject: Fix DBUnit's enums and revert database changes --- src/main/resources/sql/database.sql | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/sql/database.sql b/src/main/resources/sql/database.sql index 4f3adf7..ddedeac 100644 --- a/src/main/resources/sql/database.sql +++ b/src/main/resources/sql/database.sql @@ -1,30 +1,26 @@ CREATE TABLE IF NOT EXISTS VehicleVersion ( id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, - constructionType VARCHAR NOT NULL, - type VARCHAR NOT NULL, + constructionType ENUM('NORMAL', 'HOCHDACH', 'MITTELHOCHDACH') NOT NULL, + type ENUM('BKTW', 'KTW_B', 'KTW', 'RTW', 'NEF', 'NAH') NOT NULL, hasNef BOOLEAN NOT NULL, - CHECK constructionType IN ('NORMAL', 'HOCHDACH', 'MITTELHOCHDACH'), - CHECK type IN ('BKTW', 'KTW-B', 'KTW', 'RTW', 'NEF', 'NAH') ); CREATE TABLE IF NOT EXISTS Vehicle ( id BIGINT AUTO_INCREMENT PRIMARY KEY, version BIGINT NOT NULL, - status VARCHAR NOT NULL, + status ENUM('ABGEMELDET', 'FREI_WACHE', 'ZUM_BERUFUNGSORT', 'AM_BERUFUNGSORT', 'ZUM_ZIELORT', + 'AM_ZIELORT', 'FREI_FUNK', 'DELETED') NOT NULL, FOREIGN KEY (version) REFERENCES VehicleVersion(id), - CHECK status IN ('ABGEMELDET', 'FREI_WACHE', 'ZUM_BERUFUNGSORT', 'AM_BERUFUNGSORT', 'ZUM_ZIELORT', - 'AM_ZIELORT', 'FREI_FUNK', 'DELETED') ); CREATE TABLE IF NOT EXISTS EmployeeVersion ( id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, birthday DATE NOT NULL, - educationLevel VARCHAR NOT NULL, + educationLevel ENUM('RS', 'NFS', 'NKV', 'NKA', 'NKI', 'NA') NOT NULL, isDriver BOOLEAN NOT NULL, isPilot BOOLEAN NOT NULL, - CHECK educationLevel IN ('RS', 'NFS', 'NKV', 'NKA', 'NKI', 'NA') ); CREATE TABLE IF NOT EXISTS Employee ( @@ -47,13 +43,11 @@ CREATE TABLE IF NOT EXISTS Registration ( CREATE TABLE IF NOT EXISTS Operation ( id BIGINT AUTO_INCREMENT PRIMARY KEY, opCode VARCHAR(20) NOT NULL, - severity VARCHAR NOT NULL, + severity ENUM('A', 'B', 'C', 'D', 'E', 'O') NOT NULL, created TIMESTAMP NOT NULL, destination VARCHAR(100) NOT NULL, additionalInfo VARCHAR(100), - status VARCHAR NOT NULL, - CHECK severity IN ('A', 'B', 'C', 'D', 'E', 'O'), - CHECK status IN ('ACTIVE', 'COMPLETED', 'CANCELLED') + status ENUM('ACTIVE', 'COMPLETED', 'CANCELLED'), ); CREATE TABLE IF NOT EXISTS VehicleOperation ( -- cgit v1.2.3-70-g09d2 From 166ff610e62f0671f65a6fd27d4760f0881eb6f4 Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Fri, 11 May 2018 16:17:42 +0200 Subject: UI Changes Main Window --- .../einsatzverwaltung/dto/Registration.java | 7 + .../ui/vehiclepane/VehiclePaneController.java | 23 ++- .../userInterface/CreateOperationController.java | 143 ++++++++-------- .../resources/fxml/CreateOperationController.fxml | 179 ++++++++++++--------- src/main/resources/fxml/vehiclePane.fxml | 51 +++--- src/main/resources/styles/main.css | 0 6 files changed, 226 insertions(+), 177 deletions(-) create mode 100644 src/main/resources/styles/main.css (limited to 'src/main/resources') diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java index 8551266..93530bc 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java @@ -2,6 +2,7 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto; import com.google.auto.value.AutoValue; import java.time.Instant; +import java.util.Date; @AutoValue public abstract class Registration { @@ -17,6 +18,12 @@ public abstract class Registration { return new AutoValue_Registration.Builder().id(0); } + public boolean isActive() { + Instant now = (new Date()).toInstant(); + + return start().isBefore(now) && end().isAfter(now); + } + @AutoValue.Builder public abstract static class Builder { public abstract Builder id(long id); diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java index 2db6f37..29230f3 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java @@ -4,8 +4,6 @@ import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee.Ed import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; import java.io.IOException; -import java.time.Instant; -import java.util.Date; import java.util.List; import java.util.Optional; import javafx.fxml.FXML; @@ -16,6 +14,7 @@ import javafx.scene.image.ImageView; import javafx.scene.text.Text; public class VehiclePaneController { + @FXML private Text txtType; @FXML private Text txtNumber; @FXML private ImageView ivNEF; @@ -35,11 +34,16 @@ public class VehiclePaneController { } private Node rootElement; + private Vehicle data; public Node getRootElement() { return rootElement; } + public Vehicle getData() { + return data; + } + /** * * Set the displayed data of this VehiclePane. * @@ -52,23 +56,22 @@ public class VehiclePaneController { String constrType = vehicle.constructionType().name(); txtRooftype.setText( constrType.substring(0, 1).toUpperCase() + constrType.substring(1).toLowerCase()); - txtNumber.setText("" + vehicle.id()); + txtNumber.setText("-" + vehicle.id()); if (vehicle.hasNef()) { - ivNEF.setImage(new Image("../images/NEF.png")); + ivNEF.setImage(new Image("images/NEF.png")); txtNEF.setText("hat NEF-Halterung"); } else { - ivNEF.setImage(new Image("../images/NotNEF.png")); + ivNEF.setImage(new Image("images/NotNEF.png")); txtNEF.setText("keine NEF-Halterung"); } if (showQualification) { - Instant now = (new Date()).toInstant(); List regs = vehicle.registrations(); assert regs != null; Optional edu = regs.stream() - .filter(reg -> reg.start().isBefore(now) && reg.end().isAfter(now)) + .filter(Registration::isActive) .map(reg -> reg.employee().educationLevel()) .max(EducationLevel::compareTo); @@ -80,5 +83,11 @@ public class VehiclePaneController { ivQualification.setVisible(false); ivQualification.setManaged(false); } + + this.data = vehicle; + } + + public void setSelected(boolean selected) { + // TODO } } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java index 7b04efe..58874da 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/CreateOperationController.java @@ -1,13 +1,19 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.DBOperationDAO; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee.EducationLevel; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Severity; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Status; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.ConstructionType; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.VehicleType; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.OperationService; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.OperationServiceImpl; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service.VehicleService; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.ui.vehiclepane.VehiclePaneController; import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidOperationException; import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; @@ -15,10 +21,11 @@ import at.ac.tuwien.sepm.assignment.groupphase.util.SpringFXMLLoader; import java.io.IOException; import java.lang.invoke.MethodHandles; import java.time.Instant; -import java.util.EnumSet; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.Arrays; import java.util.LinkedList; import java.util.Set; -import javafx.collections.FXCollections; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Parent; @@ -27,10 +34,10 @@ import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; -import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.control.TextField; import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.FlowPane; import javafx.stage.Stage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,13 +53,14 @@ public class CreateOperationController { public TextField txtAddress; public TextField txtNote; public Button btnCreateOperation; - public ListView lvVehicles; public ListView lvActiveOperations; public Label lblChosenVehicles; - public LinkedList chosenVehicles = new LinkedList<>(); + public FlowPane fpVehicles; + + private LinkedList chosenVehicles = new LinkedList<>(); // TODO: Anders? - OperationService operationService = + private OperationService operationService = new OperationServiceImpl(new DBOperationDAO(new JDBCConnectionManager())); private final VehicleService vehicleService; private final SpringFXMLLoader fxmlLoader; @@ -65,65 +73,55 @@ public class CreateOperationController { @FXML public void initialize() { lblChosenVehicles.setText("keine ausgewählt"); - lvVehicles.setCellFactory( - param -> - new ListCell() { - @Override - protected void updateItem(Vehicle item, boolean empty) { - super.updateItem(item, empty); - - if (empty || item == null || item.name() == null) { - setText(null); - } else { - setText(item.name()); - } - } - }); - - lvVehicles.setOnMouseClicked( - event -> { - if (event.getClickCount() == 2) { - boolean remove = false; - if (lvVehicles.getSelectionModel().getSelectedItem() == null) { - return; - } - for (Vehicle vehicle : chosenVehicles) { - if (lvVehicles.getSelectionModel().getSelectedItem().equals(vehicle)) { - remove = true; - break; - } - } - if (!remove) { - chosenVehicles.add(lvVehicles.getSelectionModel().getSelectedItem()); - - } else { - chosenVehicles.remove(lvVehicles.getSelectionModel().getSelectedItem()); - } - StringBuilder result = new StringBuilder(); - for (int i = 0; i < chosenVehicles.size(); i++) { - if (i == chosenVehicles.size() - 1) { - result.append(chosenVehicles.get(i).name()); - } else { - result.append(chosenVehicles.get(i).name()).append(", "); - } - } - if (result.toString().equals("")) { - lblChosenVehicles.setText("keine ausgewählt"); - } else { - lblChosenVehicles.setText(result.toString()); - } - } - }); } public void updateList() { try { - this.lvVehicles.setItems( - FXCollections.observableArrayList( - vehicleService.list( - EnumSet.of( - Vehicle.Status.FREI_FUNK, Vehicle.Status.FREI_WACHE)))); - } catch (ServiceException e) { + fpVehicles.getChildren().clear(); + List vehicles = vehicleService.list(); + + // TODO Remove debug + vehicles = testData(); + + for (Vehicle vehicle : vehicles) { + VehiclePaneController controller = VehiclePaneController.createVehiclePane(); + + controller.setData(vehicle, true); + controller + .getRootElement() + .setOnMouseClicked( + event -> { + if (event.getClickCount() == 2) { + if (chosenVehicles.contains(vehicle)) { + chosenVehicles.remove(vehicle); + controller.setSelected(false); + } else { + chosenVehicles.add(vehicle); + controller.setSelected(true); + } + + StringBuilder result = new StringBuilder(); + for (int i = 0; i < chosenVehicles.size(); i++) { + if (i == chosenVehicles.size() - 1) { + result.append(chosenVehicles.get(i).name()); + } else { + result.append(chosenVehicles.get(i).name()) + .append(", "); + } + } + if (result.toString().equals("")) { + lblChosenVehicles.setText("keine ausgewählt"); + } else { + lblChosenVehicles.setText(result.toString()); + } + } + }); + + fpVehicles.getChildren().add(controller.getRootElement()); + } + } catch (ServiceException | IOException e) { + LOG.error("Error while updating list.", e); + Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Fehler"); alert.setHeaderText("Fehler!"); @@ -132,14 +130,30 @@ public class CreateOperationController { } } - /*private LinkedList mylist() { + private LinkedList testData() { + Employee empl = + Employee.builder() + .birthday(LocalDate.MIN) + .isDriver(true) + .isPilot(true) + .educationLevel(EducationLevel.NKV) + .name("Hans Test") + .build(); + Registration reg = + Registration.builder() + .employee(empl) + .start(Instant.now().minus(1, ChronoUnit.HOURS)) + .end(Instant.now().plus(1, ChronoUnit.HOURS)) + .build(); + Vehicle vehicle = Vehicle.builder() .name("Test-KTW") .constructionType(ConstructionType.HOCHDACH) .type(VehicleType.KTW) .status(Vehicle.Status.FREI_WACHE) - .hasNef(true) + .hasNef(false) + .registrations(Arrays.asList(reg)) .build(); Vehicle vehicle1 = @@ -149,13 +163,14 @@ public class CreateOperationController { .type(VehicleType.NEF) .status(Vehicle.Status.FREI_FUNK) .hasNef(true) + .registrations(Arrays.asList(reg)) .build(); LinkedList list = new LinkedList<>(); list.add(vehicle); list.add(vehicle1); // this.lvVehicles.setItems(FXCollections.observableArrayList(list)); return list; - }*/ + } @FXML protected void createOperationClicked() { diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index 086a5d1..18a1508 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -5,91 +5,114 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/vehiclePane.fxml b/src/main/resources/fxml/vehiclePane.fxml index 8b1d194..38be664 100644 --- a/src/main/resources/fxml/vehiclePane.fxml +++ b/src/main/resources/fxml/vehiclePane.fxml @@ -10,61 +10,56 @@ - + - - - - + + + + - - - - + + + + - + - + - + - + - + - - + + - + - - + + - + - - + + - + diff --git a/src/main/resources/styles/main.css b/src/main/resources/styles/main.css new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3-70-g09d2 From 3990268905e3223276160e2a32c74d4f05d0796e Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Mon, 14 May 2018 16:31:12 +0200 Subject: Reworking MainWindow UI. --- .../ui/vehiclepane/VehiclePaneController.java | 5 +- .../resources/fxml/CreateOperationController.fxml | 153 ++++++++------------- src/main/resources/fxml/vehiclePane.fxml | 2 +- src/main/resources/styles/main.css | 28 ++++ 4 files changed, 90 insertions(+), 98 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java index 29230f3..d0dcbae 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclepane/VehiclePaneController.java @@ -88,6 +88,9 @@ public class VehiclePaneController { } public void setSelected(boolean selected) { - // TODO + rootElement.getStyleClass().clear(); + + if (selected) rootElement.getStyleClass().add("shadowed-yellow"); + else rootElement.getStyleClass().add("shadowed-white"); } } diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index 18a1508..88fe26a 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -13,106 +13,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + fx:controller="at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.CreateOperationController" + stylesheets="@/styles/main.css"> + + + - + + - + - - + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/vehiclePane.fxml b/src/main/resources/fxml/vehiclePane.fxml index 38be664..79cfaf9 100644 --- a/src/main/resources/fxml/vehiclePane.fxml +++ b/src/main/resources/fxml/vehiclePane.fxml @@ -10,7 +10,7 @@ - + diff --git a/src/main/resources/styles/main.css b/src/main/resources/styles/main.css index e69de29..11a069e 100644 --- a/src/main/resources/styles/main.css +++ b/src/main/resources/styles/main.css @@ -0,0 +1,28 @@ +.shadowed-white { + -fx-background-color: white; + -fx-effect: dropshadow(gaussian, rgba(100,100,100,0.8), 5, 0, 0, 3); +} + +.shadowed-yellow { + -fx-background-color: #FFE699; + -fx-effect: dropshadow(gaussian, rgba(100,100,100,0.8), 5, 0, 0, 3); +} + +.text-big { + -fx-font-size: 18px; +} + +.text-medium { + -fx-font-size: 14px; +} + +.text-small { + -fx-font-size: 14px; +} + +.button { + -fx-background-radius: 0em; + -fx-background-color: darkgreen; + -fx-text-fill: white; + -fx-font-weight: bold; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From fa6ac1c592c22ac688123fabed062879881dc843 Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Fri, 18 May 2018 11:15:50 +0200 Subject: Updated Visuals in MainWindow. --- .../resources/fxml/CreateOperationController.fxml | 30 +++++++++++++++------- src/main/resources/styles/main.css | 4 +++ 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index 88fe26a..54e08b0 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -10,19 +10,31 @@ + + - + + + + + + + + - + - + - - + + - + - - + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/vehiclePane.fxml b/src/main/resources/fxml/vehiclePane.fxml index 79cfaf9..38be664 100644 --- a/src/main/resources/fxml/vehiclePane.fxml +++ b/src/main/resources/fxml/vehiclePane.fxml @@ -10,7 +10,7 @@ - + -- cgit v1.2.3-70-g09d2 From 689d8f9b2092473c7c10c8a39744c8a2c8765ce4 Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Mon, 14 May 2018 16:31:12 +0200 Subject: Reworking MainWindow UI. --- .../resources/fxml/CreateOperationController.fxml | 153 ++++++++------------- src/main/resources/fxml/vehiclePane.fxml | 2 +- 2 files changed, 58 insertions(+), 97 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index 18a1508..88fe26a 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -13,106 +13,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + fx:controller="at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.CreateOperationController" + stylesheets="@/styles/main.css"> + + + - + + - + - - + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/vehiclePane.fxml b/src/main/resources/fxml/vehiclePane.fxml index 38be664..79cfaf9 100644 --- a/src/main/resources/fxml/vehiclePane.fxml +++ b/src/main/resources/fxml/vehiclePane.fxml @@ -10,7 +10,7 @@ - + -- cgit v1.2.3-70-g09d2 From 07c485c63e94e7508bad2ec2c7b385f5a102f720 Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Mon, 14 May 2018 19:21:54 +0200 Subject: StatusMenu --- .../einsatzverwaltung/controller/StatusMenuController.java | 13 +++++++++++++ src/main/resources/fxml/statusMenu.fxml | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java create mode 100644 src/main/resources/fxml/statusMenu.fxml (limited to 'src/main/resources') diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java new file mode 100644 index 0000000..50f4359 --- /dev/null +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java @@ -0,0 +1,13 @@ +package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller; + +import java.net.URL; +import java.util.ResourceBundle; +import javafx.fxml.Initializable; + +public class StatusMenuController implements Initializable { + + @Override + public void initialize(URL location, ResourceBundle resources) { + + } +} diff --git a/src/main/resources/fxml/statusMenu.fxml b/src/main/resources/fxml/statusMenu.fxml new file mode 100644 index 0000000..57b152a --- /dev/null +++ b/src/main/resources/fxml/statusMenu.fxml @@ -0,0 +1,9 @@ + + + + + + -- cgit v1.2.3-70-g09d2 From 3f84016b6f9136f8d877e15ace1b214ea67c75b2 Mon Sep 17 00:00:00 2001 From: Andreas Weninger Date: Tue, 15 May 2018 12:10:59 +0200 Subject: Status menu FXML & Controller --- .../controller/StatusMenuController.java | 32 ++++++++++++++++++++++ .../groupphase/einsatzverwaltung/dto/Vehicle.java | 2 +- .../resources/fxml/CreateOperationController.fxml | 3 +- src/main/resources/fxml/statusMenu.fxml | 20 +++++++++++--- src/main/resources/styles/main.css | 17 ++++++++++++ 5 files changed, 68 insertions(+), 6 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java index 50f4359..d4e5b04 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/StatusMenuController.java @@ -1,13 +1,45 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.Status; import java.net.URL; import java.util.ResourceBundle; +import javafx.fxml.FXML; import javafx.fxml.Initializable; +import javafx.geometry.Insets; +import javafx.scene.control.Button; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.VBox; +import org.springframework.stereotype.Controller; +@Controller public class StatusMenuController implements Initializable { + @FXML + private VBox vboxMain; + @Override public void initialize(URL location, ResourceBundle resources) { + for (Status status : Status.values()) { + if (status == Status.ABGEMELDET) { + continue; + } + + Button btn = new Button(status.name()); + + btn.setPrefWidth(Double.MAX_VALUE); + btn.setPadding(new Insets(6)); + if (status == Status.FREI_FUNK || status == Status.FREI_WACHE) { + btn.getStyleClass().add("button-free-status"); + } else { + btn.getStyleClass().add("button-other-status"); + } + btn.getStyleClass().add("text-medium"); + + vboxMain.getChildren().add(vboxMain.getChildren().size() - 1, btn); + } + } + public void unregister(MouseEvent mouseEvent) { + //TODO } } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java index 84d9c92..e81db0b 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java @@ -24,11 +24,11 @@ public abstract class Vehicle { public enum Status { ABGEMELDET, FREI_WACHE, + FREI_FUNK, ZUM_BERUFUNGSORT, AM_BERUFUNGSORT, ZUM_ZIELORT, AM_ZIELORT, - FREI_FUNK, } public abstract long id(); diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index 88fe26a..cb8239d 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -45,7 +45,7 @@ text="Fahrzeuge:" styleClass="text-medium"/> + + + + -- cgit v1.2.3-70-g09d2 From 3921e1bb05b7fa449bc72f136b3ede62984614af Mon Sep 17 00:00:00 2001 From: Martin Weick Date: Thu, 24 May 2018 14:00:04 +0200 Subject: Add onOperationCodeChanged method + format in fxml --- .../resources/fxml/CreateOperationController.fxml | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/fxml/CreateOperationController.fxml b/src/main/resources/fxml/CreateOperationController.fxml index dbdb4ef..9b063e3 100644 --- a/src/main/resources/fxml/CreateOperationController.fxml +++ b/src/main/resources/fxml/CreateOperationController.fxml @@ -13,15 +13,19 @@ xmlns:fx="http://javafx.com/fxml/1" fx:controller="at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.CreateOperationController" stylesheets="@/styles/main.css"> - + -