From 1d07d326720b376b2a153910ad852f7230ac50e5 Mon Sep 17 00:00:00 2001 From: Nils Dittberner Date: Thu, 19 Nov 2015 15:00:23 +0100 Subject: [PATCH] Fixed import problem. --- .../controller/PatientTablesController.java | 95 +++++----------------- 1 file changed, 22 insertions(+), 73 deletions(-) diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java index 02f501a..cc683d9 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java @@ -4,18 +4,12 @@ package de.uniluebeck.mi.projmi6.controller; * Created by Johannes on 12.11.15. */ -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; import de.uniluebeck.mi.projmi6.model.Station; import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; import javafx.beans.binding.Bindings; import javafx.beans.binding.ObjectBinding; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.ReadOnlyObjectProperty; -import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; @@ -31,10 +25,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; import java.io.IOException; -import java.rmi.server.ExportException; -import java.sql.SQLException; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.List; /** @@ -42,96 +33,78 @@ import java.util.List; */ public class PatientTablesController { + @FXML + Button btnStatRefresh; private MainController mainController; - @FXML private Label lblTablePatientEmpty; - @FXML private Label lblTableStationEmpty; - @FXML private Button btnPatCreate; - @FXML private Button btnPatEdit; - @FXML private TableView tblPatientOverview; - @FXML private TableColumn colPatPatId; - @FXML private TableColumn colPatGeburtsname; - @FXML private TableColumn colPatNachname; - @FXML private TableColumn colPatVorname; - @FXML private TableColumn colPatGebDatum; - @FXML private TableColumn colPatStrasse; - @FXML private TableColumn colPatPlz; - @FXML private TableColumn colPatOrt; - @FXML private TableColumn colPatCave; - - @FXML private ToggleButton btnEntlassenePatientenZeigen; - @FXML private ComboBox cmbStationenFilter; - @FXML private TableView tblStationOverview; - @FXML private TableColumn colStatPatId; - @FXML private TableColumn colStatFullName; - @FXML private TableColumn colStatGebDatum; - @FXML private TableColumn colStatAlter; - @FXML private TableColumn colStatAufnahmedatum; - @FXML private TableColumn colStatEntlassungsdatum; - @FXML private Tab stationOverviewTab; - - public TabPane getPatientOverviewTabPane() { - return patientOverviewTabPane; - } - @FXML private Tab patientOverviewTab; @FXML private TabPane patientOverviewTabPane; - + private ObservableList stationsUebersicht = FXCollections.observableArrayList(); + private FilteredList stationsUebersichtsItemFilteredList = new FilteredList(stationsUebersicht, + item -> item.getStationEntlassung() == null || !item.getStationEntlassung().isAfter(LocalDate.now())); + private Task loadStationsHistorieTask = null; + private Task loadPatientTask = null; + @FXML + private Button btnPatRefresh; + private ObjectBinding patientObjectBinding = null; public PatientTablesController(MainController mainController) { this.mainController = mainController; } + public TabPane getPatientOverviewTabPane() { + return patientOverviewTabPane; + } @FXML public void initialize() { @@ -153,13 +126,13 @@ public class PatientTablesController { patientObjectBinding = Bindings.createObjectBinding(() -> { - if(patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)) { + if (patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)) { return tblPatientOverview.getSelectionModel().getSelectedItem(); - }else if(tblStationOverview.getSelectionModel().getSelectedItem()==null){ - return null; - }else{ + } else if (tblStationOverview.getSelectionModel().getSelectedItem() == null) { + return null; + } else { int selectedPatId = tblStationOverview.getSelectionModel().getSelectedItem().getPatId(); - Patient selectedPatient = tblPatientOverview.getItems().stream().filter(p -> p.getPatID()==selectedPatId).findFirst().orElse(null); + Patient selectedPatient = tblPatientOverview.getItems().stream().filter(p -> p.getPatID() == selectedPatId).findFirst().orElse(null); return selectedPatient; } }, tblPatientOverview.getSelectionModel().selectedItemProperty(), @@ -173,12 +146,6 @@ public class PatientTablesController { updatePatientsFromDb(); } - - private ObservableList stationsUebersicht = FXCollections.observableArrayList(); - - private FilteredList stationsUebersichtsItemFilteredList = new FilteredList(stationsUebersicht, - item -> item.getStationEntlassung() == null || !item.getStationEntlassung().isAfter(LocalDate.now())); - private void initColumnsPatient() { colPatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIDProperty().asString()); colPatGeburtsname.setCellValueFactory(new PropertyValueFactory<>("geburtsname")); @@ -194,7 +161,6 @@ public class PatientTablesController { colPatCave.setCellValueFactory(new PropertyValueFactory<>("cave")); } - private void initColumnsStation() { colStatPatId.setCellValueFactory(new PropertyValueFactory("patId")); colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); @@ -221,7 +187,6 @@ public class PatientTablesController { showEditWindow(null); } - @FXML private void clickedEditPatient() { showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); @@ -254,7 +219,6 @@ public class PatientTablesController { stage.show(); } - public void updatePatientsFromDb() { if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { System.out.println("Patienten werden bereits geladen."); @@ -304,19 +268,13 @@ public class PatientTablesController { thread.start(); } - @FXML - Button btnStatRefresh; - - @FXML - private void clickedRefreshStation(){ + private void clickedRefreshStation() { updateStationsHistorieFromDb(); } - private Task loadStationsHistorieTask = null; - public void updateStationsHistorieFromDb() { - if (this.loadStationsHistorieTask !=null) { + if (this.loadStationsHistorieTask != null) { loadStationsHistorieTask.cancel(); } lblTableStationEmpty.setText("Liste wird geladen..."); @@ -339,7 +297,7 @@ public class PatientTablesController { @Override protected void succeeded() { super.succeeded(); - if(!isCancelled()) { + if (!isCancelled()) { lblTableStationEmpty.setText("Liste ist leer."); stationsUebersicht.setAll(this.getValue()); btnStatRefresh.setDisable(false); @@ -356,7 +314,7 @@ public class PatientTablesController { @Override protected void failed() { super.failed(); - if(!isCancelled()){ + if (!isCancelled()) { lblTableStationEmpty.setText("Laden fehlgeschlagen!"); getException().printStackTrace(); btnStatRefresh.setDisable(false); @@ -371,20 +329,11 @@ public class PatientTablesController { thread.start(); } - - - private Task loadPatientTask = null; - - @FXML - private Button btnPatRefresh; - @FXML private void clickedRefreshPatient() { updatePatientsFromDb(); } - private ObjectBinding patientObjectBinding = null; - public ObjectBinding selectedPatientProperty() { return patientObjectBinding; }