|
|
|
@@ -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(); |
|
|
|
} |
|
|
|
|