| @@ -5,9 +5,7 @@ import de.uniluebeck.mi.projmi6.model.HL7LogEntry; | |||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.concurrent.Task; | import javafx.concurrent.Task; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Button; | |||||
| import javafx.scene.control.TableColumn; | |||||
| import javafx.scene.control.TableView; | |||||
| import javafx.scene.control.*; | |||||
| import javafx.scene.control.cell.PropertyValueFactory; | import javafx.scene.control.cell.PropertyValueFactory; | ||||
| import javafx.scene.text.Text; | import javafx.scene.text.Text; | ||||
| @@ -48,7 +46,30 @@ public class LogController { | |||||
| private void initColumns(){ | private void initColumns(){ | ||||
| colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("source")); | colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("source")); | ||||
| colLogTime.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, LocalDateTime>("timestamp")); | colLogTime.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, LocalDateTime>("timestamp")); | ||||
| colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("message")); | |||||
| colLogMessage.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("message")); | |||||
| colLogMessage.setCellFactory(column -> { | |||||
| return new TableCell<HL7LogEntry, String>(){ | |||||
| private TextArea textArea = new TextArea(); | |||||
| { | |||||
| textArea.setEditable(false); | |||||
| textArea.setPrefRowCount(5); | |||||
| } | |||||
| @Override | |||||
| protected void updateItem(String item, boolean empty) { | |||||
| super.updateItem(item, empty); | |||||
| this.setText(null); | |||||
| if(item == null || empty){ | |||||
| this.setGraphic(null); | |||||
| return; | |||||
| } | |||||
| textArea.setText(item); | |||||
| textArea.setWrapText(true); | |||||
| this.setGraphic(textArea); | |||||
| } | |||||
| }; | |||||
| }); | |||||
| } | } | ||||
| @@ -80,6 +101,7 @@ public class LogController { | |||||
| tblLog.setItems(FXCollections.observableArrayList(this.getValue())); | tblLog.setItems(FXCollections.observableArrayList(this.getValue())); | ||||
| mainController.decreaseParallelTaskCount(); | mainController.decreaseParallelTaskCount(); | ||||
| btnRefresh.setDisable(false); | btnRefresh.setDisable(false); | ||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -152,6 +152,36 @@ public class MainController { | |||||
| } | } | ||||
| private int fallIdToShow = -1; | |||||
| public void selectPatientAndFallId(Patient patient, int fallId){ | |||||
| if(patientTablesController.getSelectedPatient()==patient | |||||
| && !loadFallTask.isRunning()){ | |||||
| selectFallById(fallId); | |||||
| return; | |||||
| } | |||||
| fallIdToShow = fallId; | |||||
| patientTablesController.selectPatient(patient); | |||||
| } | |||||
| private void selectFallById(int id){ | |||||
| if(lvFall.getItems() == null){ | |||||
| return; | |||||
| } | |||||
| for(Fall fall: lvFall.getItems()){ | |||||
| if(fall.getFallID()== id ){ | |||||
| lvFall.getSelectionModel().select(fall); | |||||
| return; | |||||
| } | |||||
| } | |||||
| } | |||||
| @FXML | @FXML | ||||
| private Label lvFallPlaceholder; | private Label lvFallPlaceholder; | ||||
| @@ -187,6 +217,11 @@ public class MainController { | |||||
| lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | ||||
| lvFall.setItems(FXCollections.observableArrayList(getValue())); | lvFall.setItems(FXCollections.observableArrayList(getValue())); | ||||
| decreaseParallelTaskCount(); | decreaseParallelTaskCount(); | ||||
| if(fallIdToShow!=-1){ | |||||
| selectFallById(fallIdToShow); | |||||
| fallIdToShow = -1; | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -38,12 +38,10 @@ public class MessageController { | |||||
| @FXML | @FXML | ||||
| private void initialize(){ | private void initialize(){ | ||||
| messageIcon.messageCountProperty().bind(messages.sizeProperty()); | messageIcon.messageCountProperty().bind(messages.sizeProperty()); | ||||
| messages.add(new HL7Message(null, 0, LocalDateTime.now(), null, true)); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void onMessageIconClicked(){ | private void onMessageIconClicked(){ | ||||
| showMessageList(); | showMessageList(); | ||||
| } | } | ||||
| @@ -63,7 +61,7 @@ public class MessageController { | |||||
| Stage stage = new Stage(); | Stage stage = new Stage(); | ||||
| stage.setTitle(messages.size()+ " neue HL7-Nachrichten"); | |||||
| stage.setTitle("Neue HL7-Nachrichten"); | |||||
| stage.setScene(new Scene(root, 600, 400)); | stage.setScene(new Scene(root, 600, 400)); | ||||
| stage.getIcons().add(new Image("icon.png")); | stage.getIcons().add(new Image("icon.png")); | ||||
| @@ -71,8 +71,10 @@ public class MessageListController { | |||||
| alert.initModality(Modality.APPLICATION_MODAL); | alert.initModality(Modality.APPLICATION_MODAL); | ||||
| alert.showAndWait(); | alert.showAndWait(); | ||||
| }else{ | |||||
| mainController.selectPatientAndFallId(message.getPatient(), message.getFallId()); | |||||
| ((Stage)lvMessages.getScene().getWindow()).close(); | |||||
| } | } | ||||
| //TODO Go to patient | |||||
| } | } | ||||
| @@ -223,6 +223,11 @@ public class PatientTablesController { | |||||
| stage.show(); | stage.show(); | ||||
| } | } | ||||
| public void selectPatient(Patient patient){ | |||||
| patientOverviewTabPane.getSelectionModel().select(0); // Select first tab | |||||
| tblPatientOverview.getSelectionModel().select(patient); | |||||
| } | |||||
| public void updatePatientsFromDb() { | public void updatePatientsFromDb() { | ||||
| if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | ||||
| System.out.println("Patienten werden bereits geladen."); | System.out.println("Patienten werden bereits geladen."); | ||||
| @@ -1,23 +1,24 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <?import java.net.*?> | |||||
| <?import javafx.geometry.*?> | <?import javafx.geometry.*?> | ||||
| <?import java.lang.*?> | <?import java.lang.*?> | ||||
| <?import javafx.scene.control.*?> | <?import javafx.scene.control.*?> | ||||
| <?import javafx.scene.layout.*?> | <?import javafx.scene.layout.*?> | ||||
| <?import java.net.URL?> | <?import java.net.URL?> | ||||
| <VBox minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.uniluebeck.mi.projmi6.controller.LogController"> | <VBox minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.uniluebeck.mi.projmi6.controller.LogController"> | ||||
| <children> | <children> | ||||
| <ToolBar prefHeight="40.0" prefWidth="200.0"> | <ToolBar prefHeight="40.0" prefWidth="200.0"> | ||||
| <items> | <items> | ||||
| <Pane HBox.hgrow="ALWAYS" /> | <Pane HBox.hgrow="ALWAYS" /> | ||||
| <Button fx:id="btnRefresh" text="Liste aktualisieren" onAction="#clickedRefresh"/> | |||||
| <Button fx:id="btnRefresh" onAction="#clickedRefresh" text="Liste aktualisieren" /> | |||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <TableView fx:id="tblLog" VBox.vgrow="ALWAYS"> | <TableView fx:id="tblLog" VBox.vgrow="ALWAYS"> | ||||
| <columns> | <columns> | ||||
| <TableColumn fx:id="colLogIp" editable="false" prefWidth="75.0" text="Ursprungs-IP" /> | |||||
| <TableColumn fx:id="colLogTime" editable="false" prefWidth="75.0" text="Uhrzeit" /> | |||||
| <TableColumn fx:id="colLogIp" editable="false" maxWidth="200.0" minWidth="150.0" text="Ursprungs-IP" /> | |||||
| <TableColumn fx:id="colLogTime" editable="false" maxWidth="200.0" minWidth="150.0" text="Uhrzeit" /> | |||||
| <TableColumn fx:id="colLogMessage" editable="false" prefWidth="75.0" text="Nachricht" /> | <TableColumn fx:id="colLogMessage" editable="false" prefWidth="75.0" text="Nachricht" /> | ||||
| </columns> | </columns> | ||||
| <columnResizePolicy> | <columnResizePolicy> | ||||