瀏覽代碼

Fehler beim INSERT von StationsHistorie behoben. Eintraege werden nun korrekt erstellt.

testBranch
Nils Dittberner 10 年之前
父節點
當前提交
f4d66dc88d
共有 1 個文件被更改,包括 27 次插入50 次删除
  1. +27
    -50
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java

+ 27
- 50
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java 查看文件

@@ -10,7 +10,6 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
@@ -26,36 +25,37 @@ import java.util.stream.Collectors;
*/
public class StationsHistorieController {

@FXML
public Button btnStatHistAbort;
SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW);
@FXML
GridPane fields;
@FXML
Button btnStatHistEdit;
/**
* The station history that is shown in the edit window, or null if a new station history should be created.
*/
private StationsHistorie stationsHistorieSelected = null;

private MainController mainController;

@FXML
private TableView<StationsHistorie>tblStationsHistorie;

@FXML
private Button btnStatHistCancel, btnStatHistSave;

@FXML
private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime;

@FXML
private TableColumn<StationsHistorie,String> colStatHistStation;

@FXML
private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum;

@FXML
private DateTimePicker dtTmAufnahme, dtTmEntlassung;

@FXML
private ComboBox<Station> cmbStation;

@FXML
private ComboBox<String> cmbAbteilung;
private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie =
new SimpleObjectProperty<>();


public StationsHistorieController(MainController mainController){
this.mainController = mainController;
@@ -66,11 +66,6 @@ public class StationsHistorieController {
this.state.set(State.EDIT);
}


public enum State {
CREATE, EDIT, VIEW
}

public State getState() {
return state.get();
}
@@ -79,22 +74,6 @@ public class StationsHistorieController {
return state;
}



SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW);


public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) {
this.stationsHistorie.set(stationsHistorie);
}

private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie =
new SimpleObjectProperty<>();


@FXML
GridPane fields;

@FXML
private void initialize() {
initColumns();
@@ -119,10 +98,6 @@ public class StationsHistorieController {
});
}

@FXML
public Button btnStatHistAbort;


private void initStationsFilter(){
final String any = "beliebig";

@@ -156,22 +131,17 @@ public class StationsHistorieController {
}

@FXML
Button btnStatHistEdit;



@FXML
private void clickedCancel(){
// this.state.set(State.VIEW);
private void clickedCancel() {
// this.state.set(State.VIEW);
}

@FXML
private void clickedSave(){
if(getState()==State.CREATE){
private void clickedSave() {
if (getState() == State.CREATE) {
StationsHistorie stationsHistorie = new StationsHistorie();
copyFieldDataIntoStationsHistorie(stationsHistorie);
try {
DBHandler.setStationsHistorie(stationsHistorie,false);
DBHandler.setStationsHistorie(stationsHistorie, false);
} catch (SQLException e) {
e.printStackTrace();
}
@@ -180,7 +150,7 @@ public class StationsHistorieController {
}

@FXML
private void clickedAbort(){
private void clickedAbort() {
state.set(State.VIEW);
copyStationsHistorieDataIntoFields();
}
@@ -195,12 +165,14 @@ public class StationsHistorieController {
return stationsHistorie.get();
}

public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) {
this.stationsHistorie.set(stationsHistorie);
}

public SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorieProperty() {
return stationsHistorie;
}



public void setStationsHistorieSelected(StationsHistorie stationsHistorie){
this.stationsHistorieSelected=stationsHistorie;
if(stationsHistorie==null){
@@ -211,7 +183,6 @@ public class StationsHistorieController {

}


private void initColumns(){
// colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, String>());
colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum"));
@@ -246,8 +217,10 @@ public class StationsHistorieController {
stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime());
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setStation(cmbStation.getValue());
stationsHistorie.setFallID(mainController.getFall().getFallID());
stationsHistorie.setFallID(mainController.getFallController().getFall().getFallID());
stationsHistorie.setStationKey(cmbStation.getValue().getStation());
stationsHistorie.setErsteller(mainController.getCurrentMitarbeiter().getMitarbID());
stationsHistorie.setBearbeiter(mainController.getCurrentMitarbeiter().getMitarbID());
}

private void clearFields(){
@@ -264,4 +237,8 @@ public class StationsHistorieController {
dtTmAufnahme.setDateTime(null);
dtTmEntlassung.setDateTime(null);
}

public enum State {
CREATE, EDIT, VIEW
}
}

Loading…
取消
儲存