diff options
Diffstat (limited to 'src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung')
8 files changed, 86 insertions, 93 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateCarController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateCarController.java index e88e640..ce795da 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateCarController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateCarController.java @@ -49,7 +49,7 @@ public class CreateCarController {      }      @FXML -    public void initialize() { +    private void initialize() {          cmb_Ctyp.setItems(                  FXCollections.observableArrayList(                          Stream.of( @@ -75,12 +75,12 @@ public class CreateCarController {      }      @FXML -    public void onCancelClicked() { +    private void onCancelClicked() {          ((Stage) btn_cancel.getScene().getWindow()).close();      }      @FXML -    public void createCar(ActionEvent actionEvent) { +    private void createCar(ActionEvent actionEvent) {          if (!update) {              Vehicle vehicle = diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateNewEmployeeController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateNewEmployeeController.java index 99614d0..15282cc 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateNewEmployeeController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateNewEmployeeController.java @@ -54,7 +54,7 @@ public class CreateNewEmployeeController {      }      @FXML -    public void initialize() { +    private void initialize() {          inputQualification.setItems(                  FXCollections.observableArrayList(                          Stream.of( @@ -79,14 +79,14 @@ public class CreateNewEmployeeController {      }      @FXML -    public void onCancelClicked() { +    private void onCancelClicked() {          if (consumerCancelClicked != null) {              consumerCancelClicked.run();          }      }      @FXML -    public void onCreateClicked() { +    private void onCreateClicked() {          employee =                  employee.toBuilder() diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/FilterEmployeesController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/FilterEmployeesController.java index 0d2f894..6d6214d 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/FilterEmployeesController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/FilterEmployeesController.java @@ -22,14 +22,14 @@ public class FilterEmployeesController {      private Node rootElement;      @FXML -    public void onAddEmployeeClicked() { +    private void onAddEmployeeClicked() {          if (consumerAddEmployeeClicked != null) {              consumerAddEmployeeClicked.run();          }      }      @FXML -    public void onFilterTextChanged() { +    private void onFilterTextChanged() {          if (consumerFilterTextChanged != null) {              consumerFilterTextChanged.accept(inputFilterString.getText());          } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ListEmployeesController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ListEmployeesController.java index 038b14c..25f1263 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ListEmployeesController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ListEmployeesController.java @@ -32,7 +32,7 @@ public class ListEmployeesController {      }      @FXML -    public void initialize() { +    private void initialize() {          openFilter();      } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java index 7e533de..ac6470e 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java @@ -33,7 +33,6 @@ import javafx.scene.control.TextField;  import javafx.stage.Stage;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired;  import org.springframework.stereotype.Controller;  @Controller @@ -41,43 +40,37 @@ public class RegistrationWindowController {      private static final Logger LOG = LoggerFactory.getLogger(RegistrationWindowController.class); -    private EmployeeService employeeService; +    private final EmployeeService employeeService; -    private VehicleService vehicleService; +    private final VehicleService vehicleService; -    private RegistrationService registrationService; +    private final RegistrationService registrationService; -    @Autowired -    public void setEmployeeService(EmployeeService employeeService) { +    public RegistrationWindowController( +            EmployeeService employeeService, +            VehicleService vehicleService, +            RegistrationService registrationService) {          this.employeeService = employeeService; -    } - -    @Autowired -    public void setVehicleService(VehicleService vehicleService) {          this.vehicleService = vehicleService; -    } - -    @Autowired -    public void setRegistrationService(RegistrationService registrationService) {          this.registrationService = registrationService;      } -    @FXML public ChoiceBox<Integer> cbStart; -    @FXML public ChoiceBox<Integer> cbEnd; -    @FXML public Label lVehicles; -    @FXML public Label lEmployees; -    @FXML public TextField tfVehicleSearch; -    @FXML public TextField tfEmployeeSearch; -    @FXML public TableView<Vehicle> tvVehicles; -    @FXML public TableView<Employee> tvEmployees; -    @FXML public TableColumn<Vehicle, String> tcVehicles; -    @FXML public TableColumn<Employee, String> tcEmployees; +    @FXML private ChoiceBox<Integer> cbStart; +    @FXML private ChoiceBox<Integer> cbEnd; +    @FXML private Label lVehicles; +    @FXML private Label lEmployees; +    @FXML private TextField tfVehicleSearch; +    @FXML private TextField tfEmployeeSearch; +    @FXML private TableView<Vehicle> tvVehicles; +    @FXML private TableView<Employee> tvEmployees; +    @FXML private TableColumn<Vehicle, String> tcVehicles; +    @FXML private TableColumn<Employee, String> tcEmployees;      private Vehicle chosenVehicle;      private List<Employee> chosenEmployees = new LinkedList<>();      @FXML -    public void initialize() { +    private void initialize() {          // will have to be replaced for FlowPane          try {              Set<Vehicle> vehicles = vehicleService.list(EnumSet.of(Status.ABGEMELDET)); diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchiveOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchiveOperationController.java index 7b69402..53e7067 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchiveOperationController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchiveOperationController.java @@ -12,6 +12,7 @@ import java.util.EnumSet;  import java.util.LinkedList;  import java.util.Objects;  import java.util.stream.Collectors; +import javafx.fxml.FXML;  import javafx.scene.control.Alert;  import javafx.scene.control.Alert.AlertType;  import javafx.scene.control.Button; @@ -23,26 +24,24 @@ import org.springframework.stereotype.Controller;  @Controller  public class ArchiveOperationController { - -    public AnchorPane apDetails; -    public Label lblCodeHeader; -    public Hyperlink hypBack; -    public Label lblOpCode; -    public Label lblVehicles; -    public Label lblDate; -    public Label lblAddress; -    public FlowPane fpVehicles; -    private OperationService operationService; -    public FlowPane archiveOperationFlowPane; +    @FXML private AnchorPane apDetails; +    @FXML private Label lblCodeHeader; +    @FXML private Hyperlink hypBack; +    @FXML private Label lblOpCode; +    @FXML private Label lblVehicles; +    @FXML private Label lblDate; +    @FXML private Label lblAddress; +    @FXML private FlowPane fpVehicles; +    private final OperationService operationService; +    @FXML private FlowPane archiveOperationFlowPane;      private LinkedList<Operation> list = new LinkedList<>(); -    public ArchiveOperationController() {} - -    void setServices(OperationService operationService) { +    public ArchiveOperationController(OperationService operationService) {          this.operationService = operationService;      } -    void fillList() { +    @FXML +    private void initialize() {          try {              list.addAll(operationService.list(EnumSet.of(Status.CANCELLED, Status.COMPLETED)));          } catch (ServiceException e) { @@ -122,6 +121,7 @@ public class ArchiveOperationController {      }      public void backClicked() { +        fpVehicles.getChildren().clear();          setDetailsVisible(false);      }  } 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 e1d01cb..60a085c 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 @@ -24,7 +24,7 @@ import java.util.Set;  import javafx.collections.FXCollections;  import javafx.event.ActionEvent;  import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; +import javafx.scene.Node;  import javafx.scene.Parent;  import javafx.scene.Scene;  import javafx.scene.control.Alert; @@ -42,7 +42,6 @@ import javafx.scene.layout.FlowPane;  import javafx.stage.Stage;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired;  import org.springframework.stereotype.Controller;  @Controller @@ -51,30 +50,34 @@ public class CreateOperationController {      private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());      public AnchorPane apCreateOperation; -    public TextField txtCode; -    public TextField txtAddress; -    public TextField txtNote; -    public Button btnCreateOperation; -    public ListView<Vehicle> lvVehicles; -    public ListView<Operation> lvActiveOperations; -    public Label lblChosenVehicles; -    public AnchorPane apInvisible; +    @FXML private TextField txtCode; +    @FXML private TextField txtAddress; +    @FXML private TextField txtNote; +    @FXML private Button btnCreateOperation; +    @FXML private ListView<Vehicle> lvVehicles; +    @FXML private ListView<Operation> lvActiveOperations; +    @FXML private Label lblChosenVehicles; +    @FXML private AnchorPane apInvisible;      @FXML private OperationDetailsController operationDetailsController; -    public FlowPane fpVehicles; +    @FXML private FlowPane fpVehicles;      private LinkedList<Vehicle> chosenVehicles = new LinkedList<>(); -    @Autowired private OperationService operationService; +    private final OperationService operationService;      private final VehicleService vehicleService;      private final SpringFXMLLoader fxmlLoader; -    public CreateOperationController(VehicleService vehicleService, SpringFXMLLoader fxmlLoader) { +    public CreateOperationController( +            OperationService operationService, +            VehicleService vehicleService, +            SpringFXMLLoader fxmlLoader) { +        this.operationService = operationService;          this.vehicleService = vehicleService;          this.fxmlLoader = fxmlLoader;      }      @FXML -    public void initialize() { +    private void initialize() {          lblChosenVehicles.setText("keine ausgewählt");          lvActiveOperations.setCellFactory(                  param -> @@ -291,13 +294,13 @@ public class CreateOperationController {      private void openNewArchivWindow() {          Stage stage = new Stage();          try { -            FXMLLoader fxmlLoader = -                    new FXMLLoader(getClass().getResource("/fxml/ArchiveOperation.fxml")); -            Parent node = fxmlLoader.load(); -            ArchiveOperationController archiveOperationController = fxmlLoader.getController(); -            archiveOperationController.setServices(operationService); -            archiveOperationController.fillList(); -            stage.setScene(new Scene(node)); +            stage.setScene( +                    new Scene( +                            (Parent) +                                    fxmlLoader.load( +                                            getClass() +                                                    .getResourceAsStream( +                                                            "/fxml/ArchiveOperation.fxml"))));          } catch (IOException e) {              LOG.error("Could not open new window: {}", e);          } @@ -334,8 +337,7 @@ public class CreateOperationController {      }      private void openDetailsWindow(Operation operation) { -        operationDetailsController.setControllers(this, operationService, vehicleService); -        apInvisible.setVisible(true);          operationDetailsController.initOperation(operation); +        apInvisible.setVisible(true);      }  } diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/OperationDetailsController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/OperationDetailsController.java index b844117..9c9eb28 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/OperationDetailsController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/OperationDetailsController.java @@ -25,21 +25,28 @@ import org.springframework.stereotype.Controller;  public class OperationDetailsController {      public Operation operation; -    private OperationService operationService; -    private VehicleService vehicleService; -    private CreateOperationController createOperationController; -    public ListView<Vehicle> lvVehicles; -    public ListView<Operation> lvActiveOperations; -    public Label lblChosenVehicles; -    public Button btnCloseOperation; -    public Button btnCancelOperation; -    public Label lblCode, lblAdditionalInfo, lblAddress; -    public AnchorPane operationDetailsAP; +    private final OperationService operationService; +    private final VehicleService vehicleService; +    private final CreateOperationController createOperationController; +    @FXML private ListView<Vehicle> lvVehicles; +    @FXML private ListView<Operation> lvActiveOperations; +    @FXML private Label lblChosenVehicles; +    @FXML private Button btnCloseOperation; +    @FXML private Button btnCancelOperation; +    @FXML private Label lblCode, lblAdditionalInfo, lblAddress; +    @FXML private AnchorPane operationDetailsAP; -    public OperationDetailsController() {} +    public OperationDetailsController( +            OperationService operationService, +            VehicleService vehicleService, +            CreateOperationController createOperationController) { +        this.operationService = operationService; +        this.vehicleService = vehicleService; +        this.createOperationController = createOperationController; +    }      @FXML -    public void initialize() { +    private void initialize() {          lvVehicles.setCellFactory(                  param ->                          new ListCell<>() { @@ -79,15 +86,6 @@ public class OperationDetailsController {                  });      } -    void setControllers( -            CreateOperationController createOperationController, -            OperationService operationService, -            VehicleService vehicleService) { -        this.operationService = operationService; -        this.createOperationController = createOperationController; -        this.vehicleService = vehicleService; -    } -      void initOperation(Operation operation) {          fillActiveList();          this.operation = operation;  | 
