Browse Source

Arbeiten am StationsHistorienController

testBranch
Johannes 10 years ago
parent
commit
1d635c06d6
3 changed files with 70 additions and 11 deletions
  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 View File

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


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


+ 66
- 10
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java View File

@@ -5,13 +5,16 @@ 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.binding.Bindings;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.FilteredList;
import javafx.event.ActionEvent;
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 javafx.scene.layout.GridPane;


import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
@@ -57,6 +60,28 @@ public class StationsHistorieController {
this.mainController = mainController; 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) { public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) {
this.stationsHistorie.set(stationsHistorie); this.stationsHistorie.set(stationsHistorie);
@@ -66,6 +91,8 @@ public class StationsHistorieController {
new SimpleObjectProperty<>(); new SimpleObjectProperty<>();




@FXML
GridPane fields;


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




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

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

});



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


@FXML
public Button btnStatHistAbort;



private void initStationsFilter(){ private void initStationsFilter(){
final String any = "beliebig"; final String any = "beliebig";
@@ -91,6 +127,14 @@ public class StationsHistorieController {
cmbAbteilung.getItems().add(0, any); cmbAbteilung.getItems().add(0, any);
cmbAbteilung.getSelectionModel().select(0); 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()); FilteredList<Station> stationenFiltered = new FilteredList<Station>(mainController.getStammdaten().getStationen());


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




cmbStation.setItems(stationenFiltered); cmbStation.setItems(stationenFiltered);
} }


@FXML
Button btnStatHistEdit;





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


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


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


@FXML @FXML
private void clickedCreateAufenthalt(){ private void clickedCreateAufenthalt(){

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


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


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




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


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


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


statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller())); 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())); 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){ private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){

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


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

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


Loading…
Cancel
Save