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