| @@ -14,9 +14,11 @@ import javafx.fxml.FXML; | |||
| import javafx.scene.control.*; | |||
| import javafx.scene.control.cell.PropertyValueFactory; | |||
| import javafx.scene.layout.GridPane; | |||
| import javafx.stage.Modality; | |||
| import java.sql.SQLException; | |||
| import java.time.LocalDate; | |||
| import java.time.LocalDateTime; | |||
| import java.util.Collections; | |||
| import java.util.List; | |||
| import java.util.stream.Collectors; | |||
| @@ -120,6 +122,9 @@ public class StationsHistorieController { | |||
| btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW) | |||
| .and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | |||
| btnStatHistEdit.managedProperty().bind(btnStatHistEdit.visibleProperty()); | |||
| btnStatHistDelete.visibleProperty().bind(btnStatHistEdit.visibleProperty()); | |||
| btnStatHistDelete.managedProperty().bind(btnStatHistDelete.visibleProperty()); | |||
| } | |||
| private void initStationsFilter(){ | |||
| @@ -190,6 +195,35 @@ public class StationsHistorieController { | |||
| 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() { | |||
| return stationsHistorie.get(); | |||
| } | |||
| @@ -101,7 +101,9 @@ public class UntersuchungenController { | |||
| setText(item.toString()); | |||
| if(item.getStorniert()){ | |||
| setTextFill(Color.GRAY); | |||
| setGraphic(new Text("<storniert> ")); | |||
| Text text = new Text("<storniert> "); | |||
| text.setFill(Color.RED); | |||
| setGraphic(text); | |||
| }else{ | |||
| setTextFill(Color.BLACK); | |||
| setGraphic(null); | |||
| @@ -63,6 +63,7 @@ | |||
| <Button mnemonicParsing="false" text="Bearbeiten" onAction="#clickedEdit" fx:id="btnStatHistEdit"/> | |||
| <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | |||
| <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"/> | |||
| </children> | |||
| </HBox> | |||
| @@ -72,10 +73,10 @@ | |||
| <Label styleClass="ersteller-label" text="Erstelldatum:" GridPane.rowIndex="1"/> | |||
| <Label styleClass="ersteller-label" text="Letzter Bearbeiter:" GridPane.rowIndex="2"/> | |||
| <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> | |||
| <columnConstraints> | |||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="50.0"/> | |||