| @@ -14,9 +14,11 @@ import javafx.fxml.FXML; | |||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| import javafx.scene.control.cell.PropertyValueFactory; | import javafx.scene.control.cell.PropertyValueFactory; | ||||
| import javafx.scene.layout.GridPane; | import javafx.scene.layout.GridPane; | ||||
| import javafx.stage.Modality; | |||||
| import java.sql.SQLException; | import java.sql.SQLException; | ||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||
| import java.time.LocalDateTime; | |||||
| import java.util.Collections; | import java.util.Collections; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -120,6 +122,9 @@ public class StationsHistorieController { | |||||
| btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW) | btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW) | ||||
| .and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | .and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | ||||
| btnStatHistEdit.managedProperty().bind(btnStatHistEdit.visibleProperty()); | btnStatHistEdit.managedProperty().bind(btnStatHistEdit.visibleProperty()); | ||||
| btnStatHistDelete.visibleProperty().bind(btnStatHistEdit.visibleProperty()); | |||||
| btnStatHistDelete.managedProperty().bind(btnStatHistDelete.visibleProperty()); | |||||
| } | } | ||||
| private void initStationsFilter(){ | private void initStationsFilter(){ | ||||
| @@ -190,6 +195,35 @@ public class StationsHistorieController { | |||||
| setStationsHistorieSelected(null); | setStationsHistorieSelected(null); | ||||
| } | } | ||||
| @FXML | |||||
| private void clickedDelete(){ | |||||
| StationsHistorie selectedItem = tblStationsHistorie.getSelectionModel().getSelectedItem(); | |||||
| if(!LocalDateTime.now().isBefore(selectedItem.getAufnahmeDatum())){ | |||||
| Alert alert = new Alert(Alert.AlertType.WARNING); | |||||
| alert.setTitle("Information Dialog"); | |||||
| alert.setHeaderText(null); | |||||
| alert.setContentText("I have a great message for you!"); | |||||
| alert.initOwner(btnStatHistCancel.getScene().getWindow()); | |||||
| alert.initModality(Modality.APPLICATION_MODAL); | |||||
| alert.showAndWait(); | |||||
| return; | |||||
| } | |||||
| try{ | |||||
| DBHandler.delStationsHistorie(selectedItem); | |||||
| }catch (Exception e){ | |||||
| e.printStackTrace(); | |||||
| } | |||||
| mainController.refreshCaseData(); | |||||
| } | |||||
| @FXML | |||||
| Button btnStatHistDelete; | |||||
| public ObservableList<StationsHistorie> getStationsHistorie() { | public ObservableList<StationsHistorie> getStationsHistorie() { | ||||
| return stationsHistorie.get(); | return stationsHistorie.get(); | ||||
| } | } | ||||
| @@ -101,7 +101,9 @@ public class UntersuchungenController { | |||||
| setText(item.toString()); | setText(item.toString()); | ||||
| if(item.getStorniert()){ | if(item.getStorniert()){ | ||||
| setTextFill(Color.GRAY); | setTextFill(Color.GRAY); | ||||
| setGraphic(new Text("<storniert> ")); | |||||
| Text text = new Text("<storniert> "); | |||||
| text.setFill(Color.RED); | |||||
| setGraphic(text); | |||||
| }else{ | }else{ | ||||
| setTextFill(Color.BLACK); | setTextFill(Color.BLACK); | ||||
| setGraphic(null); | setGraphic(null); | ||||
| @@ -63,6 +63,7 @@ | |||||
| <Button mnemonicParsing="false" text="Bearbeiten" onAction="#clickedEdit" fx:id="btnStatHistEdit"/> | <Button mnemonicParsing="false" text="Bearbeiten" onAction="#clickedEdit" fx:id="btnStatHistEdit"/> | ||||
| <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | ||||
| <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | ||||
| <Button mnemonicParsing="false" text="Entfernen" onAction="#clickedDelete" fx:id="btnStatHistDelete"/> | |||||
| <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | ||||
| </children> | </children> | ||||
| </HBox> | </HBox> | ||||
| @@ -72,10 +73,10 @@ | |||||
| <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1"/> | <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1"/> | ||||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="2"/> | <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="2"/> | ||||
| <Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="3"/> | <Label styleClass="ersteller-label" text="Letzte Änderung:" GridPane.rowIndex="3"/> | ||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="0" fx:id="statHistCreator" text="a"/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="statHistCreateTime" text="b"/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="statHistEditor" text="c"/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="3" fx:id="statHistEditTime" text="d"/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="0" fx:id="statHistCreator" text=""/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="statHistCreateTime" text=""/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="statHistEditor" text=""/> | |||||
| <Label styleClass="ersteller-value" GridPane.columnIndex="1" GridPane.rowIndex="3" fx:id="statHistEditTime" text=""/> | |||||
| </children> | </children> | ||||
| <columnConstraints> | <columnConstraints> | ||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0"/> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0"/> | ||||