浏览代码

Arbeiten am StationsHistorienController

testBranch
Johannes 10 年前
父节点
当前提交
1d635c06d6
共有 3 个文件被更改,包括 70 次插入11 次删除
  1. +1
    -0
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java
  2. +66
    -10
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java
  3. +3
    -1
      src/main/resources/stationshistorie.fxml

+ 1
- 0
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java 查看文件

@@ -5,6 +5,7 @@ package de.uniluebeck.mi.projmi6.controller;
*/

import ca.uhn.hl7v2.model.v251.segment.LOC;
import com.sun.deploy.config.Platform;
import com.sun.org.apache.bcel.internal.generic.LoadClass;
import de.uniluebeck.mi.projmi6.db.DBHandler;
import de.uniluebeck.mi.projmi6.model.Patient;


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

@@ -5,13 +5,16 @@ import de.uniluebeck.mi.projmi6.model.Station;
import de.uniluebeck.mi.projmi6.model.StationsHistorie;
import de.uniluebeck.mi.projmi6.view.DateTimePicker;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ReadOnlyObjectProperty;
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;
import javafx.scene.layout.GridPane;

import java.time.LocalDate;
import java.util.List;
@@ -57,6 +60,28 @@ public class StationsHistorieController {
this.mainController = mainController;
}

@FXML
private void clickedEdit() {
this.state.set(State.EDIT);
}


public enum State {
CREATE, EDIT, VIEW
}

public State getState() {
return state.get();
}

public ReadOnlyObjectProperty<State> stateProperty() {
return state;
}



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


public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) {
this.stationsHistorie.set(stationsHistorie);
@@ -66,6 +91,8 @@ public class StationsHistorieController {
new SimpleObjectProperty<>();


@FXML
GridPane fields;

@FXML
private void initialize() {
@@ -74,6 +101,12 @@ public class StationsHistorieController {
initStationsFilter();


fields.disableProperty().bind(stateProperty().isEqualTo(State.VIEW));

state.addListener((observable, oldValue, newValue) -> {

});


tblStationsHistorie.itemsProperty().bind(stationsHistorie);
tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
@@ -81,6 +114,9 @@ public class StationsHistorieController {
});
}

@FXML
public Button btnStatHistAbort;


private void initStationsFilter(){
final String any = "beliebig";
@@ -91,6 +127,14 @@ public class StationsHistorieController {
cmbAbteilung.getItems().add(0, any);
cmbAbteilung.getSelectionModel().select(0);

btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull()));
btnStatHistSave.visibleProperty().bind(state.isEqualTo(State.VIEW).not());
btnStatHistAbort.visibleProperty().bind(state.isEqualTo(State.VIEW).not());
btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW));

tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
setStationsHistorieSelected(newValue);
});

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

@@ -101,24 +145,36 @@ public class StationsHistorieController {
return p -> p.getAbteilung().equals(cmbAbteilung.getValue());
},cmbAbteilung.valueProperty()));



cmbStation.setItems(stationenFiltered);
}

@FXML
Button btnStatHistEdit;



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

@FXML
private void clickedSave(){
//TODO
}

@FXML
private void clickedAbort(){
state.set(State.VIEW);
copyStationsHistorieDataIntoFields();
}

@FXML
private void clickedCreateAufenthalt(){

this.state.set(State.CREATE);
setStationsHistorieSelected(null);
}

public ObservableList<StationsHistorie> getStationsHistorie() {
@@ -129,13 +185,10 @@ public class StationsHistorieController {
return stationsHistorie;
}

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


public void setStationsHistorieSelected(StationsHistorie stationsHistorie){
this.stationsHistorieSelected=stationsHistorie;
if(stationsHistorie==null){
clearFields();
}else {
@@ -156,6 +209,7 @@ public class StationsHistorieController {
private void copyStationsHistorieDataIntoFields(){

if(stationsHistorieSelected==null){
clearFields();
return;
}

@@ -165,14 +219,16 @@ public class StationsHistorieController {
dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum());

statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller()));
statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString());
if(stationsHistorieSelected.getErstellDatumZeit()!=null){
statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString());
}
statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter()));
statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString());
if(stationsHistorieSelected.getBearbeitetDatumZeit()!=null){
statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString());
}
}

private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){

//stationsHistorie.s(colStatHistAbteilun);
stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime());
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setStation(cmbStation.getValue());


+ 3
- 1
src/main/resources/stationshistorie.fxml 查看文件

@@ -33,7 +33,7 @@
</VBox>
<VBox>
<children>
<GridPane VBox.vgrow="ALWAYS">
<GridPane VBox.vgrow="ALWAYS" fx:id="fields">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
@@ -60,6 +60,8 @@
</GridPane>
<HBox alignment="CENTER_RIGHT">
<children>
<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 disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/>
</children>


正在加载...
取消
保存