diff options
Diffstat (limited to 'src')
3 files changed, 52 insertions, 64 deletions
| diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchivOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchivOperationController.java index 4019c71..e97b8ad 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchivOperationController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/userInterface/ArchivOperationController.java @@ -1,15 +1,7 @@  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.Operation.Status;  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.exception.ServiceException; -import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; -import java.util.EnumSet;  import javafx.fxml.FXML; -import javafx.scene.control.Alert; -import javafx.scene.control.Alert.AlertType;  import javafx.scene.control.Button;  import javafx.scene.layout.FlowPane;  import org.springframework.stereotype.Controller; @@ -20,40 +12,36 @@ public class ArchivOperationController {      public FlowPane archiveOperationFlowPane;      public CreateOperationController createOperationController; -    public ArchivOperationController(){ +    public ArchivOperationController() {} -    } - - -    public void setServices(OperationService operationService, CreateOperationController createOperationController){ +    public void setServices( +            OperationService operationService, +            CreateOperationController createOperationController) {          this.operationService = operationService;          this.createOperationController = createOperationController;      }      @FXML -    public void initialize(){ -            /*Button b1 = new Button(); -            b1.setPrefHeight(200); -            b1.setPrefWidth(650/2); -            archiveOperationFlowPane.getChildren().add(b1);*/ -    } - -    public void setVisible(boolean b){ -        archiveOperationFlowPane.setVisible(b); +    public void initialize() { +        for (int i = 0; i < 2; i++) { +            Button b = new Button(); +            b.setPrefHeight(200); +            b.setPrefWidth(650 / 2); +            archiveOperationFlowPane.getChildren().add(b); +        }      } -      public void fillList() { -        //TODO Test -        //try { -            // FOR EACH MAKE BUTTON -            for (int i = 0; i < 2; i++) { -                Button b = new Button(); -                b.setPrefHeight(200); -                b.setPrefWidth(650 / 2); -                archiveOperationFlowPane.getChildren().add(b); -            } -            //operationService.list(EnumSet.of(Status.CANCELLED, Status.COMPLETED)); +        // TODO Test +        // try { +        // FOR EACH MAKE BUTTON +        /*for (int i = 0; i < 2; i++) { +            Button b = new Button(); +            b.setPrefHeight(200); +            b.setPrefWidth(650 / 2); +            archiveOperationFlowPane.getChildren().add(b); +        }*/ +        // operationService.list(EnumSet.of(Status.CANCELLED, Status.COMPLETED));          /*} catch (ServiceException e) {              Alert alert = new Alert(AlertType.ERROR);              alert.setTitle("Fehler"); @@ -62,10 +50,4 @@ public class ArchivOperationController {              alert.showAndWait();          }*/      } - -    public void closeWindow(){ -        //TODO TEST -        archiveOperationFlowPane.setVisible(false); -        this.createOperationController.setVisible(true); -    }  } 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 796857b..f17878a 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 @@ -23,6 +23,7 @@ import java.util.List;  import java.util.Set;  import javafx.event.ActionEvent;  import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader;  import javafx.scene.Parent;  import javafx.scene.Scene;  import javafx.scene.control.Alert; @@ -56,7 +57,6 @@ public class CreateOperationController {      public Label lblChosenVehicles;      public FlowPane fpVehicles;      public AnchorPane apInvisible; -    @FXML ArchivOperationController archivOperationController;      private LinkedList<Vehicle> chosenVehicles = new LinkedList<>(); @@ -244,29 +244,29 @@ public class CreateOperationController {          openNewWindow("createCar.fxml");      } -    @FXML -    private void openArchivWindow(){ -        archivOperationController.setServices(operationService, this); -        apInvisible.setVisible(true); -        archivOperationController.setVisible(true); -        archivOperationController.fillList(); +    public void onArchivLinkClicked() { +        openNewArchivWindow("ArchivOperation.fxml");      } -    /* -        private void openDetailsWindow(Operation operation) { - -        operationDetailsController.setControllers(this, operationService); - -        apInvisible.setVisible(true); - -        operationDetailsController.initOperation(operation); - -        operationDetailsController.fillActiveList(); - +    private void openNewArchivWindow(String fxmlFileName) { +        // TODO: TEST +        Stage stage = new Stage(); +        try { +            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/" + fxmlFileName)); +            Parent node = fxmlLoader.load(); +            ArchivOperationController archivOperationController = fxmlLoader.getController(); +            archivOperationController.setServices(operationService, this); +            archivOperationController.fillList(); +            stage.setScene(new Scene(node)); +        } catch (IOException e) { +            LOG.error("Could not open new window: {}", e); +        } +        stage.setTitle("Einsatz erstellen"); +        stage.centerOnScreen(); +        stage.showAndWait(); // important to call wait so that updateList is executed afterwards +        updateList();      } -     */ -      private void openNewWindow(String fxmlFileName) {          Stage stage = new Stage(); diff --git a/src/main/resources/fxml/ArchivOperation.fxml b/src/main/resources/fxml/ArchivOperation.fxml index 6f3d883..db7d319 100644 --- a/src/main/resources/fxml/ArchivOperation.fxml +++ b/src/main/resources/fxml/ArchivOperation.fxml @@ -4,8 +4,14 @@  <?import javafx.scene.layout.FlowPane?> -<FlowPane fx:id="archiveOperationFlowPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="650.0" prefWidth="800.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.einsatzverwaltung.userInterface.ArchivOperationController"> -   <children> -      <AnchorPane prefHeight="650.0" prefWidth="800.0" /> -   </children> -</FlowPane> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" +  prefHeight="650.0" prefWidth="1200.0" style="-fx-background-color: BLACK;" +  fx:controller="at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.userInterface.ArchivOperationController" +  xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1"> +  <children> +    <FlowPane fx:id="archiveOperationFlowPane" prefHeight="650.0" prefWidth="800.0" +      AnchorPane.leftAnchor="200.0"/> +    <AnchorPane prefHeight="650.0" prefWidth="800.0" +      style="-fx-background-color: rgba(239,235,232,1);" AnchorPane.leftAnchor="200.0"/> +  </children> +</AnchorPane> | 
