|
|
@@ -1,12 +1,17 @@ |
|
|
package de.uniluebeck.mi.projmi6.controller; |
|
|
package de.uniluebeck.mi.projmi6.controller; |
|
|
|
|
|
|
|
|
|
|
|
import de.uniluebeck.mi.projmi6.db.DBHandler; |
|
|
import de.uniluebeck.mi.projmi6.model.HL7LogEntry; |
|
|
import de.uniluebeck.mi.projmi6.model.HL7LogEntry; |
|
|
|
|
|
import javafx.collections.FXCollections; |
|
|
|
|
|
import javafx.concurrent.Task; |
|
|
import javafx.fxml.FXML; |
|
|
import javafx.fxml.FXML; |
|
|
import javafx.scene.control.TableColumn; |
|
|
import javafx.scene.control.TableColumn; |
|
|
import javafx.scene.control.TableView; |
|
|
import javafx.scene.control.TableView; |
|
|
import javafx.scene.control.cell.PropertyValueFactory; |
|
|
import javafx.scene.control.cell.PropertyValueFactory; |
|
|
|
|
|
import javafx.scene.text.Text; |
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@@ -29,12 +34,13 @@ public class LogController { |
|
|
public LogController(MainController mainController) { |
|
|
public LogController(MainController mainController) { |
|
|
this.mainController = mainController; |
|
|
this.mainController = mainController; |
|
|
|
|
|
|
|
|
//TODO Set DB entrys |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@FXML |
|
|
@FXML |
|
|
private void initialize(){ |
|
|
private void initialize(){ |
|
|
initColumns(); |
|
|
initColumns(); |
|
|
|
|
|
refreshLogFromDb(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void initColumns(){ |
|
|
private void initColumns(){ |
|
|
@@ -43,7 +49,51 @@ public class LogController { |
|
|
colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("message")); |
|
|
colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("message")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Task<List<HL7LogEntry>> loadLogEntryTask = null; |
|
|
|
|
|
|
|
|
public void refreshLogFromDb(){ |
|
|
public void refreshLogFromDb(){ |
|
|
//TODO |
|
|
|
|
|
|
|
|
if (this.loadLogEntryTask != null && this.loadLogEntryTask.isRunning()) { |
|
|
|
|
|
System.out.println("Logs werden bereits geladen."); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// btnPatRefresh.setDisable(true); |
|
|
|
|
|
|
|
|
|
|
|
tblLog.setItems(null); |
|
|
|
|
|
|
|
|
|
|
|
tblLog.setPlaceholder(new Text("Liste wird geladen...")); |
|
|
|
|
|
|
|
|
|
|
|
loadLogEntryTask= new Task<List<HL7LogEntry>>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
protected List<HL7LogEntry> call() throws Exception { |
|
|
|
|
|
return FXCollections.<HL7LogEntry>observableArrayList(DBHandler.getLastHL7LogEntries()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
protected void succeeded() { |
|
|
|
|
|
super.succeeded(); |
|
|
|
|
|
tblLog.setPlaceholder(new Text("Liste ist leer.")); |
|
|
|
|
|
tblLog.setItems(FXCollections.observableArrayList(this.getValue())); |
|
|
|
|
|
mainController.decreaseParallelTaskCount(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
protected void failed() { |
|
|
|
|
|
super.failed(); |
|
|
|
|
|
tblLog.setPlaceholder(new Text("Laden fehlgeschlagen")); |
|
|
|
|
|
mainController.decreaseParallelTaskCount(); |
|
|
|
|
|
tblLog.setItems(null); |
|
|
|
|
|
getException().printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Thread thread = new Thread(loadLogEntryTask); |
|
|
|
|
|
thread.setDaemon(true); |
|
|
|
|
|
thread.start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |