瀏覽代碼

LogController Arbeit

Diagnose erstellen
testBranch
Johannes 10 年之前
父節點
當前提交
b6cbef6b92
共有 4 個檔案被更改,包括 60 行新增7 行删除
  1. +7
    -3
      src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java
  2. +52
    -2
      src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java
  3. +1
    -1
      src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java
  4. +0
    -1
      src/main/resources/diagnose.fxml

+ 7
- 3
src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java 查看文件

@@ -24,7 +24,6 @@ public class DiagnoseController {
this.mainController = mainController;
}


public ObservableList<Diagnose> getDiagnosen() {
return diagnosen.get();
}
@@ -123,7 +122,6 @@ public class DiagnoseController {
@FXML
private GridPane fields;


@FXML
private ComboBox<Mitarbeiter> diagDiagnoseArzt;

@@ -171,7 +169,13 @@ public class DiagnoseController {
void clickedDiagSave(ActionEvent event) {
if(state.get() == State.CREATE){
//Create new diagnosis
//DBHandler.set
Diagnose diagnose = new Diagnose();
copyFieldDataIntoDiagnose(diagnose);
try {
DBHandler.setDiagnose(diagnose);
}catch (Exception e){
e.printStackTrace();
}
}else{
//Update diagnosis in db



+ 52
- 2
src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java 查看文件

@@ -1,12 +1,17 @@
package de.uniluebeck.mi.projmi6.controller;

import de.uniluebeck.mi.projmi6.db.DBHandler;
import de.uniluebeck.mi.projmi6.model.HL7LogEntry;
import javafx.collections.FXCollections;
import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.text.Text;

import java.time.LocalDateTime;
import java.util.List;


/**
@@ -29,12 +34,13 @@ public class LogController {
public LogController(MainController mainController) {
this.mainController = mainController;

//TODO Set DB entrys
}

@FXML
private void initialize(){
initColumns();
refreshLogFromDb();

}

private void initColumns(){
@@ -43,7 +49,51 @@ public class LogController {
colLogIp.setCellValueFactory(new PropertyValueFactory<HL7LogEntry, String>("message"));
}


private Task<List<HL7LogEntry>> loadLogEntryTask = null;

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



}

+ 1
- 1
src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java 查看文件

@@ -8,7 +8,7 @@ import java.sql.SQLException;
* MySQL Connection Factory.
*/
public class MySqlConnectionFactory {
public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01";
public static final String URL = "jdbc:mysql://localhost:3306/pmiw15g06_v01";
public static final String USER = "pmiw15g06";
public static final String PASS = "AX3yQSYJSH43PrSz";
public static final String DRIVER = "com.mysql.jdbc.Driver";


+ 0
- 1
src/main/resources/diagnose.fxml 查看文件

@@ -46,7 +46,6 @@
</GridPane>
<HBox alignment="TOP_RIGHT" spacing="5.0" VBox.vgrow="ALWAYS">
<children>
<Button fx:id="btnDiagCancel" mnemonicParsing="false" onAction="#clickedDiagCancel" text="Storno" />
<Button fx:id="btnDiagAbort" mnemonicParsing="false" onAction="#clickedAbort" text="Abbrechen" />
<Button fx:id="btnDiagEdit" mnemonicParsing="false" onAction="#clickedEdit" text="Bearbeiten" />
<Button fx:id="btnDiagSave" mnemonicParsing="false" onAction="#clickedDiagSave" text="Speichern" />


Loading…
取消
儲存