Browse Source

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stammstationen....

testBranch
Johannes Oehm 10 years ago
parent
commit
48e2a466ab
3 changed files with 42 additions and 7 deletions
  1. +3
    -1
      src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java
  2. +39
    -5
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java
  3. +0
    -1
      src/main/resources/stationshistorie.fxml

+ 3
- 1
src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java View File

@@ -264,7 +264,7 @@ public class MainController {
protected Void call() throws Exception { protected Void call() throws Exception {
untersuchungList = DBHandler.getUntersuchungByFall(newValue); untersuchungList = DBHandler.getUntersuchungByFall(newValue);
diagnoseList = DBHandler.getDiagnosenByFall(newValue); diagnoseList = DBHandler.getDiagnosenByFall(newValue);
// stationsHistorieList = DBHandler.getStationsHistorieByStation("");
stationsHistorieList = DBHandler.getStationsHistorieByFall(newValue);
return null; return null;
} }


@@ -277,6 +277,8 @@ public class MainController {
} }
untersuchungenController.setUntersuchungen(FXCollections.observableArrayList(untersuchungList)); untersuchungenController.setUntersuchungen(FXCollections.observableArrayList(untersuchungList));
diagnoseController.setDiagnosen(FXCollections.observableArrayList(diagnoseList)); diagnoseController.setDiagnosen(FXCollections.observableArrayList(diagnoseList));
stationsHistorieController.setStationsHistorie(FXCollections.observableArrayList(stationsHistorieList));



tabPaneFall.setDisable(false); tabPaneFall.setDisable(false);
tabFallDiagnose.setDisable(false); tabFallDiagnose.setDisable(false);


+ 39
- 5
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java View File

@@ -1,15 +1,21 @@
package de.uniluebeck.mi.projmi6.controller; package de.uniluebeck.mi.projmi6.controller;


import de.uniluebeck.mi.projmi6.db.DBHandler;
import de.uniluebeck.mi.projmi6.model.Station; import de.uniluebeck.mi.projmi6.model.Station;
import de.uniluebeck.mi.projmi6.model.StationsHistorie; import de.uniluebeck.mi.projmi6.model.StationsHistorie;
import de.uniluebeck.mi.projmi6.view.DateTimePicker; import de.uniluebeck.mi.projmi6.view.DateTimePicker;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML; 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 java.time.LocalDate; import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;


/** /**
* Created by 631806 on 12.11.15. * Created by 631806 on 12.11.15.
@@ -33,7 +39,7 @@ public class StationsHistorieController {
private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime; private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime;


@FXML @FXML
private TableColumn<StationsHistorie,String>colStatHistAbteilung, colStatHistStation;
private TableColumn<StationsHistorie,String> colStatHistStation;


@FXML @FXML
private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum;
@@ -45,19 +51,44 @@ public class StationsHistorieController {
private ComboBox<Station> cmbStation; private ComboBox<Station> cmbStation;


@FXML @FXML
private ComboBox<?> cmbAbteilung;
private ComboBox<String> cmbAbteilung;


public StationsHistorieController(MainController mainController){ public StationsHistorieController(MainController mainController){
this.mainController = mainController; this.mainController = mainController;
} }




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

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



@FXML @FXML
private void initialize() { private void initialize() {
initColumns();

List<String> abteilungen = mainController.getStammdaten().getStationen().stream()
.map(stat->stat.getAbteilung()).distinct().collect(Collectors.toList());
cmbAbteilung.setItems(FXCollections.observableArrayList(abteilungen));


FilteredList<Station> stationenFiltered = new FilteredList<Station>(mainController.getStammdaten().getStationen());

stationenFiltered.predicateProperty().bind(Bindings.createObjectBinding(() -> {
return p -> p.getAbteilung().equals(cmbAbteilung.getValue());
},cmbAbteilung.valueProperty()));

cmbStation.setItems(mainController.getStammdaten().getStationen()); cmbStation.setItems(mainController.getStammdaten().getStationen());



tblStationsHistorie.itemsProperty().bind(stationsHistorie);
tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> { tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
setStationsHistorieSelected(newValue); setStationsHistorieSelected(newValue);

}); });
} }


@@ -91,7 +122,6 @@ public class StationsHistorieController {
this.stationsHistorie.set(stationsHistorie); this.stationsHistorie.set(stationsHistorie);
} }


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


public void setStationsHistorieSelected(StationsHistorie stationsHistorie){ public void setStationsHistorieSelected(StationsHistorie stationsHistorie){
@@ -105,7 +135,7 @@ public class StationsHistorieController {




private void initColumns(){ private void initColumns(){
//colStatHistAbteilung.setCellValueFactory();
// colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, String>());
colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum")); colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum"));
colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum")); colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum"));
//colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>()); //colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>());
@@ -114,6 +144,10 @@ public class StationsHistorieController {


private void copyStationsHistorieDataIntoFields(){ private void copyStationsHistorieDataIntoFields(){


if(stationsHistorieSelected==null){
return;
}

//TODO cmbStation.setValue //TODO cmbStation.setValue


dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum()); dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum());


+ 0
- 1
src/main/resources/stationshistorie.fxml View File

@@ -21,7 +21,6 @@
</ToolBar> </ToolBar>
<TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie"> <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie">
<columns> <columns>
<TableColumn prefWidth="75.0" text="Abteilung" fx:id="colStatHistAbteilung"/>
<TableColumn prefWidth="75.0" text="Station" fx:id="colStatHistStation"/> <TableColumn prefWidth="75.0" text="Station" fx:id="colStatHistStation"/>
<TableColumn prefWidth="75.0" text="Aufnahme" fx:id="colStatHistAufnahmeDatum"/> <TableColumn prefWidth="75.0" text="Aufnahme" fx:id="colStatHistAufnahmeDatum"/>
<TableColumn prefWidth="75.0" text="Entlassung" fx:id="colStatHistEntlassungsDatum"/> <TableColumn prefWidth="75.0" text="Entlassung" fx:id="colStatHistEntlassungsDatum"/>


Loading…
Cancel
Save