diff --git a/src/main/java/de/uniluebeck/mi/projmi6/Main.java b/src/main/java/de/uniluebeck/mi/projmi6/Main.java index 6ec17d2..5558d03 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/Main.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/Main.java @@ -40,7 +40,7 @@ public class Main extends Application { * Cuz building the GUI from FXML is a bit costly, * it's done from its own thread. */ - private Task loadMainWindowTask = new Task(){ + private Task loadMainWindowTask = new Task() { @Override @@ -49,7 +49,7 @@ public class Main extends Application { MainController mainController = new MainController(); updateMessage("Lade OPS-Codes..."); mainController.getStammdaten().setOpsCodes(FXCollections.observableArrayList( - DBHandler.getAllOpsCodes() + DBHandler.getAllOpsCodes() )); updateMessage("Lade ICD-10-Codes..."); @@ -59,7 +59,7 @@ public class Main extends Application { updateMessage("Lade Krankenkassen..."); mainController.getStammdaten().setKassen(FXCollections.observableArrayList( - DBHandler.getAllKassen() + DBHandler.getAllKassen() )); updateMessage("Lade Mitarbeiter..."); @@ -79,7 +79,7 @@ public class Main extends Application { Parent root = fxmlLoader.load(); - server = new HL7Server(mainController); + server = new HL7Server(); server.registerApplication("ADT", "A01", new HL7Receiver<>(ADT_A01.class, mainController)); // ADT_A01 parsen server.registerApplication("BAR", "P05", new HL7Receiver<>(BAR_P05.class, mainController)); // BAR_P05 parsen server.start(); @@ -111,7 +111,7 @@ public class Main extends Application { } @Override - public void start(Stage primaryStage) { + public void start(Stage primaryStage) { System.out.println(getClass().getClassLoader().getResource("").toExternalForm()); primaryStage.getIcons().add(icon); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java index 29c9bbd..9d8d855 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java @@ -150,27 +150,26 @@ public class DiagnoseController { @FXML void clickedDiagSave(ActionEvent event) { - if(state.get() == State.CREATE){ + if (state.get() == State.CREATE) { //Create new diagnosis Diagnose diagnose = new Diagnose(); copyFieldDataIntoDiagnose(diagnose); try { DBHandler.setDiagnose(diagnose); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } - }else{ + } else { //Update diagnosis in db } mainController.refreshCaseData(); } - private void copyDiagnoseDataIntoFields(Diagnose diagnose){ + private void copyDiagnoseDataIntoFields(Diagnose diagnose) { diagDiagnoseArzt.setValue(diagnose.getArzt()); - diagFreitext.setText(diagnose.getFreiText()); diagDiagnoseArt.setValue(diagnose.getDiagArt()); diagDiagnose.setValue(diagnose.getIcd10code()); @@ -181,7 +180,7 @@ public class DiagnoseController { diagChangeTime.setText(diagnose.getBearbeitetDatumZeit().toString()); } - private void copyFieldDataIntoDiagnose(Diagnose diagnose){ + private void copyFieldDataIntoDiagnose(Diagnose diagnose) { diagnose.setIcd10code(diagDiagnose.getValue()); diagnose.setArzt(diagDiagnoseArzt.getValue()); diagnose.setFreiText(diagFreitext.getText()); @@ -192,7 +191,7 @@ public class DiagnoseController { diagnose.setBearbeiter(mainController.getCurrentMitarbeiter().getMitarbID()); } - private void clearFields(){ + private void clearFields() { diagDiagnoseArzt.setValue(mainController.getCurrentMitarbeiter()); diagDiagnose.setValue(null); diagFreitext.setText(""); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java index c6514f9..a463652 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java @@ -88,32 +88,31 @@ public class FallController { return state; } - public ObjectProperty> diagnosenProperty(){ - return fallHauptdiagnose.itemsProperty(); + public ObjectProperty> diagnosenProperty() { + return fallHauptdiagnose.itemsProperty(); } public ObservableList getDiagnosen() { return fallHauptdiagnose.getItems(); } - public void setDiagnosen(ObservableList list){ + public void setDiagnosen(ObservableList list) { fallHauptdiagnose.setItems(list); } @FXML - public void initialize(){ + public void initialize() { fallEinweisenderArzt.disableProperty().bind(fallSelbsteinweisung.selectedProperty()); fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); fallKasse.setItems(mainController.getStammdaten().getKassen()); - initButtons(); fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); fallProperty.addListener(((observable, oldValue, newValue) -> { - if(state.get() == State.VIEW){ + if (state.get() == State.VIEW) { copyFallDataIntoField(fallProperty.get()); } })); @@ -124,9 +123,9 @@ public class FallController { state.addListener((observable, oldValue, newValue) -> { - if(newValue==State.EDIT || newValue == State.CREATE){ + if (newValue == State.EDIT || newValue == State.CREATE) { mainController.lockForEdit(MainController.TabName.OVERVIEW); - }else{ + } else { mainController.unlockFromEdit(); } }); @@ -135,7 +134,7 @@ public class FallController { /** * Hide the buttons depending on controller state. */ - private void initButtons(){ + private void initButtons() { btnFallEnableEdit.managedProperty().bind( state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) ); @@ -162,7 +161,7 @@ public class FallController { } @FXML - private void clickedSendHl7(){ + private void clickedSendHl7() { /* Natascha */ //TODO send funny message Patient patient = mainController.getPatientTablesController().getSelectedPatient(); @@ -176,7 +175,7 @@ public class FallController { } } - public void editFall(){ + public void editFall() { this.state.set(State.EDIT); } @@ -244,11 +243,11 @@ public class FallController { fallVersichertennummer.setText(patient.getVersichertennummer()); } - private void clearFields(){ - if(state.get() == State.CREATE) { + private void clearFields() { + if (state.get() == State.CREATE) { dtTmAufnahme.setToCurrentDateTime(); dtTmEntlassung.setToCurrentDateTime(); - }else{ + } else { dtTmAufnahme.setDateTime(null); dtTmEntlassung.setDateTime(null); } @@ -272,14 +271,14 @@ public class FallController { fallFallart.setValue(null); } - private void copyFieldDataIntoFall(Fall fall){ + private void copyFieldDataIntoFall(Fall fall) { fall.setPatient(mainController.getPatientTablesController().getSelectedPatient()); fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); - if(fallSelbsteinweisung.isSelected()) { + if (fallSelbsteinweisung.isSelected()) { fall.setSelbsteinweisung(true); fall.setEinweisenderArzt(null); - }else{ + } else { fall.setEinweisenderArzt(fallEinweisenderArzt.getText()); fall.setSelbsteinweisung(false); } @@ -292,12 +291,11 @@ public class FallController { } - //fall.setVorstellDatum(); //TODO } - private void copyFallDataIntoField(Fall fall){ - if(fall==null){ + private void copyFallDataIntoField(Fall fall) { + if (fall == null) { System.out.println("copyFallDataIntoFiled - Fall ist null"); clearFields(); return; @@ -308,9 +306,9 @@ public class FallController { fallPatID.setText(fallProperty.get().getPatient() + ""); //(fall.getPatient().getVorname()+" "+fall.getPatient().getNachname()); //TODO - fallCreateTime.setText(fall.getErstellDatumZeit() !=null ? fall.getErstellDatumZeit().toString():""); + fallCreateTime.setText(fall.getErstellDatumZeit() != null ? fall.getErstellDatumZeit().toString() : ""); fallCreator.setText(Integer.toString(fall.getErsteller())); - fallEditTime.setText(fall.getBearbeitetDatumZeit()!=null? fall.getBearbeitetDatumZeit().toString():""); + fallEditTime.setText(fall.getBearbeitetDatumZeit() != null ? fall.getBearbeitetDatumZeit().toString() : ""); fallEditor.setText(Integer.toString(fall.getBearbeiter())); fallEinweisenderArzt.setText(fall.getEinweisenderArzt()); @@ -324,7 +322,7 @@ public class FallController { fallFallart.setValue(fall.getFallArt()); } - private void copyHauptdiagnoseToComboBox(Fall fall){ + private void copyHauptdiagnoseToComboBox(Fall fall) { if (fallHauptdiagnose.getItems() == null || fall == null) { fallHauptdiagnose.setValue(null); @@ -333,11 +331,11 @@ public class FallController { System.out.println("Suche Diagnose..."); for (Diagnose diagnose : fallHauptdiagnose.getItems()) { - System.out.println(diagnose.getDiagID()+"="+fall.getHauptdiagnoseId()); + System.out.println(diagnose.getDiagID() + "=" + fall.getHauptdiagnoseId()); if (diagnose.getDiagID() == fall.getHauptdiagnoseId()) { - fallHauptdiagnose.getSelectionModel().select(diagnose); + fallHauptdiagnose.getSelectionModel().select(diagnose); System.out.println("Diagnose wiedergefunden!!"); - return; + return; } } } @@ -347,5 +345,4 @@ public class FallController { } - } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java index b3177a2..962f325 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java @@ -23,7 +23,7 @@ public class LogController { TableView tblLog; @FXML - TableColumn colLogIp, colLogMessage; + TableColumn colLogIp, colLogMessage; @FXML TableColumn colLogTime; @@ -34,28 +34,28 @@ public class LogController { @FXML Button btnRefresh; - - + private Task> loadLogEntryTask = null; public LogController(MainController mainController) { this.mainController = mainController; } @FXML - private void initialize(){ + private void initialize() { initColumns(); refreshLogFromDb(); } - private void initColumns(){ + private void initColumns() { colLogDirection.setCellValueFactory(new PropertyValueFactory("direction")); colLogIp.setCellValueFactory(new PropertyValueFactory("source")); colLogTime.setCellValueFactory(new PropertyValueFactory("timestamp")); colLogMessage.setCellValueFactory(new PropertyValueFactory("message")); colLogMessage.setCellFactory(column -> { - return new TableCell(){ + return new TableCell() { private TextArea textArea = new TextArea(); + { textArea.setEditable(false); textArea.setPrefRowCount(5); @@ -65,7 +65,7 @@ public class LogController { protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); this.setText(null); - if(item == null || empty){ + if (item == null || empty) { this.setGraphic(null); return; } @@ -77,10 +77,7 @@ public class LogController { }); } - - private Task> loadLogEntryTask = null; - - public void refreshLogFromDb(){ + public void refreshLogFromDb() { if (this.loadLogEntryTask != null && this.loadLogEntryTask.isRunning()) { return; } @@ -92,11 +89,11 @@ public class LogController { tblLog.setPlaceholder(new Text("Liste wird geladen...")); - loadLogEntryTask= new Task>() { + loadLogEntryTask = new Task>() { @Override protected List call() throws Exception { - return FXCollections.observableArrayList(DBHandler.getLastHL7LogEntries()); + return FXCollections.observableArrayList(DBHandler.getLastHL7LogEntries()); } @Override @@ -126,11 +123,9 @@ public class LogController { @FXML - private void clickedRefresh(){ + private void clickedRefresh() { refreshLogFromDb(); } - - } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java index 4628da4..f135a59 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java @@ -2,11 +2,7 @@ package de.uniluebeck.mi.projmi6.controller; import de.uniluebeck.mi.projmi6.db.DBHandler; import de.uniluebeck.mi.projmi6.model.*; -import de.uniluebeck.mi.projmi6.view.MessageIcon; -import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectProperty; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Task; @@ -16,11 +12,7 @@ import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.util.Callback; -import javax.swing.*; -import java.util.ArrayList; import java.util.List; -import java.util.Set; -import java.util.concurrent.ThreadFactory; public class MainController { @@ -78,14 +70,19 @@ public class MainController { return stationsHistorieController; } else if (clazz.equals(LogController.class)) { return logController; - }else if(clazz.equals(MessageController.class)){ - return messageController; + } else if (clazz.equals(MessageController.class)) { + return messageController; } else { System.err.println("Keine Controller-Klasse des Typs " + clazz + " gefunden!!!"); return null; } }; + private int fallIdToShow = -1; + @FXML + private Label lvFallPlaceholder; + private Task> loadFallTask = null; + private Task loadCaseData = null; public MainController() { fallController = new FallController(this); @@ -98,7 +95,6 @@ public class MainController { messageController = new MessageController(this); } - public Stammdaten getStammdaten() { return stammdaten; } @@ -107,7 +103,6 @@ public class MainController { return controllerFactory; } - public FallController getFallController() { return fallController; } @@ -128,12 +123,12 @@ public class MainController { return untersuchungenController; } - public MessageController getMessageController(){ + public MessageController getMessageController() { return messageController; } - public LogController getLogController(){ - return logController; + public LogController getLogController() { + return logController; } public void increaseParallelTaskCount() { @@ -151,12 +146,9 @@ public class MainController { } } - - private int fallIdToShow = -1; - - public void selectPatientAndFallId(Patient patient, int fallId){ - if(patientTablesController.getSelectedPatient()==patient - && !loadFallTask.isRunning()){ + public void selectPatientAndFallId(Patient patient, int fallId) { + if (patientTablesController.getSelectedPatient() == patient + && !loadFallTask.isRunning()) { selectFallById(fallId); return; } @@ -165,13 +157,13 @@ public class MainController { patientTablesController.selectPatient(patient); } - private void selectFallById(int id){ - if(lvFall.getItems() == null){ + private void selectFallById(int id) { + if (lvFall.getItems() == null) { return; } - for(Fall fall: lvFall.getItems()){ - if(fall.getFallID()== id ){ + for (Fall fall : lvFall.getItems()) { + if (fall.getFallID() == id) { lvFall.getSelectionModel().select(fall); return; } @@ -180,15 +172,6 @@ public class MainController { } - - - @FXML - private Label lvFallPlaceholder; - - - private Task> loadFallTask = null; - - public void refreshCasesFromDb(Patient patient) { lvFall.setItems(null); //clear list @@ -218,7 +201,7 @@ public class MainController { lvFall.setItems(FXCollections.observableArrayList(getValue())); decreaseParallelTaskCount(); - if(fallIdToShow!=-1){ + if (fallIdToShow != -1) { selectFallById(fallIdToShow); fallIdToShow = -1; } @@ -246,7 +229,6 @@ public class MainController { thread.start(); } - @FXML private void initialize() { //Init user data. @@ -299,12 +281,7 @@ public class MainController { } - private Task loadCaseData = null; - - - - - private void refreshCaseData(Fall fall){ + private void refreshCaseData(Fall fall) { if (loadCaseData != null && loadCaseData.isRunning()) { loadCaseData.cancel(); } @@ -382,7 +359,7 @@ public class MainController { } - public void refreshCaseData(){ + public void refreshCaseData() { refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); } @@ -400,19 +377,14 @@ public class MainController { } - public Fall getFall(){ + public Fall getFall() { return lvFall.getSelectionModel().getSelectedItem(); } - public ReadOnlyObjectProperty fallProperty(){ - return lvFall.getSelectionModel().selectedItemProperty(); + public ReadOnlyObjectProperty fallProperty() { + return lvFall.getSelectionModel().selectedItemProperty(); } - -public enum TabName { - OVERVIEW, DIAGNOSE, UNTERSUCHUNG, STATIONSHISTORIE; -} - public void lockForEdit(TabName exclude) { tabFallDiagnose.setDisable(true); tabFallUntersuchungen.setDisable(true); @@ -455,11 +427,15 @@ public enum TabName { } public Mitarbeiter getCurrentMitarbeiter() { - return cmbUserChoose==null?null:cmbUserChoose.getValue(); + return cmbUserChoose == null ? null : cmbUserChoose.getValue(); } public ReadOnlyObjectProperty currentMitarbeiterProperty() { return cmbUserChoose.valueProperty(); } + public enum TabName { + OVERVIEW, DIAGNOSE, UNTERSUCHUNG, STATIONSHISTORIE + } + } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java index 1ca1021..3a3b873 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java @@ -1,12 +1,9 @@ package de.uniluebeck.mi.projmi6.controller; -import de.uniluebeck.mi.projmi6.model.Fall; import de.uniluebeck.mi.projmi6.model.HL7Message; -import de.uniluebeck.mi.projmi6.model.Patient; import de.uniluebeck.mi.projmi6.view.MessageIcon; import javafx.beans.property.SimpleListProperty; import javafx.collections.FXCollections; -import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; @@ -16,36 +13,32 @@ import javafx.stage.Modality; import javafx.stage.Stage; import java.io.IOException; -import java.time.LocalDateTime; /** * Created by Johannes on 21/11/2015. */ public class MessageController { final MainController mainController; - + private final SimpleListProperty messages = new SimpleListProperty(FXCollections.observableArrayList()); @FXML private MessageIcon messageIcon; - private final SimpleListProperty messages = new SimpleListProperty(FXCollections.observableArrayList()); - - - public MessageController(MainController mainController){ + public MessageController(MainController mainController) { this.mainController = mainController; } @FXML - private void initialize(){ + private void initialize() { messageIcon.messageCountProperty().bind(messages.sizeProperty()); } @FXML - private void onMessageIconClicked(){ + private void onMessageIconClicked() { showMessageList(); } - private void showMessageList(){ + private void showMessageList() { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getClassLoader().getResource("message_list.fxml")); MessageListController messageListController = new MessageListController(messages, mainController); @@ -71,7 +64,7 @@ public class MessageController { } - public void addMessage(HL7Message message){ + public void addMessage(HL7Message message) { messages.add(message); mainController.getLogController().refreshLogFromDb(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java index d67fa7f..14e1fd3 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java @@ -3,9 +3,9 @@ package de.uniluebeck.mi.projmi6.controller; /** * Created by Johannes on 21/11/2015. */ + import de.uniluebeck.mi.projmi6.model.HL7Message; import javafx.beans.property.SimpleListProperty; -import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Button; @@ -17,38 +17,35 @@ public class MessageListController { private final SimpleListProperty messages; private final MainController mainController; + @FXML + private ListView lvMessages; + @FXML + private Button btnShow; + @FXML + private Button btnRemove; - public MessageListController(SimpleListProperty messages, MainController mainController){ + public MessageListController(SimpleListProperty messages, MainController mainController) { this.messages = messages; this.mainController = mainController; } @FXML - private void initialize(){ + private void initialize() { lvMessages.setItems(messages); btnShow.disableProperty().bind(lvMessages.getSelectionModel().selectedItemProperty().isNull()); btnRemove.disableProperty().bind(lvMessages.getSelectionModel().selectedItemProperty().isNull()); messages.sizeProperty().addListener((observable, oldValue, newValue) -> { - if(messages.getSize()<=0){ - ((Stage)lvMessages.getScene().getWindow()).close(); + if (messages.getSize() <= 0) { + ((Stage) lvMessages.getScene().getWindow()).close(); } }); } @FXML - private ListView lvMessages; - - @FXML - private Button btnShow; - - @FXML - private Button btnRemove; - - @FXML void clickedRemove() { HL7Message message = lvMessages.getSelectionModel().getSelectedItem(); - if(message==null){ + if (message == null) { return; } messages.remove(message); @@ -57,12 +54,12 @@ public class MessageListController { @FXML void clickedShow() { HL7Message message = lvMessages.getSelectionModel().getSelectedItem(); - if(message==null){ + if (message == null) { return; } messages.remove(message); - if(message.isFailed()){ + if (message.isFailed()) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Nachricht konnte nicht verarbeitet werden"); alert.setHeaderText("Die Nachricht konnte nicht verarbeitet werden"); @@ -71,9 +68,9 @@ public class MessageListController { alert.initModality(Modality.APPLICATION_MODAL); alert.showAndWait(); - }else{ + } else { mainController.selectPatientAndFallId(message.getPatient(), message.getFallId()); - ((Stage)lvMessages.getScene().getWindow()).close(); + ((Stage) lvMessages.getScene().getWindow()).close(); } } 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 fbb9ea2..163efc2 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java @@ -136,8 +136,7 @@ public class PatientTablesController { return null; } else { int selectedPatId = tblStationOverview.getSelectionModel().getSelectedItem().getPatId(); - Patient selectedPatient = tblPatientOverview.getItems().stream().filter(p -> p.getPatID() == selectedPatId).findFirst().orElse(null); - return selectedPatient; + return tblPatientOverview.getItems().stream().filter(p -> p.getPatID() == selectedPatId).findFirst().orElse(null); } }, tblPatientOverview.getSelectionModel().selectedItemProperty(), tblStationOverview.getSelectionModel().selectedItemProperty(), @@ -223,7 +222,7 @@ public class PatientTablesController { stage.show(); } - public void selectPatient(Patient patient){ + public void selectPatient(Patient patient) { patientOverviewTabPane.getSelectionModel().select(0); // Select first tab tblPatientOverview.getSelectionModel().select(patient); } @@ -246,7 +245,7 @@ public class PatientTablesController { @Override protected List call() throws Exception { - return FXCollections.observableArrayList(DBHandler.getAllPatients()); + return FXCollections.observableArrayList(DBHandler.getAllPatients()); } @Override @@ -294,11 +293,11 @@ public class PatientTablesController { mainController.increaseParallelTaskCount(); - Task> loadStatHist = new Task>() { + this.loadStationsHistorieTask = new Task>() { @Override protected List call() throws Exception { - return FXCollections.observableArrayList( + return FXCollections.observableArrayList( DBHandler.getStationsUebersichtsItems(cmbStationenFilter.getValue().getStation())); } @@ -330,7 +329,6 @@ public class PatientTablesController { } } }; - this.loadStationsHistorieTask = loadStatHist; Thread thread = new Thread(loadStationsHistorieTask); thread.setDaemon(true); @@ -351,5 +349,4 @@ public class PatientTablesController { } - } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/SettingsController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/SettingsController.java index 11201cd..1814441 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/SettingsController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/SettingsController.java @@ -20,19 +20,17 @@ import java.util.regex.Pattern; public class SettingsController { /** - * A pointer to the applications main controller + * Regex for the {@link #validateIpString(String)} method. */ - private MainController mainController; - + private static final Pattern PATTERN = Pattern.compile( + "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); /** - * Constructor - The object is generated in the MainController. - * @param mainController The MainController that generates this object. + * A pointer to the applications main controller */ - public SettingsController (MainController mainController){ - this.mainController = mainController; - - } - + private MainController mainController; /** * The button that for saving the data in the text fields. */ @@ -48,14 +46,34 @@ public class SettingsController { /** + * Constructor - The object is generated in the MainController. + * + * @param mainController The MainController that generates this object. + */ + public SettingsController(MainController mainController) { + this.mainController = mainController; + + } + + /** + * Checks if the given string is a ip address string. + * + * @param ip The string to be validated. + * @return true if ip is a valid ip address, otherwise false + */ + public static boolean validateIpString(final String ip) { + return PATTERN.matcher(ip).matches(); + } + + /** * initialize()-method for the FXMLLoader. */ @FXML - private void initialize(){ + private void initialize() { opsServerIp.setText(Main.OPS_IP); opsServerPort.setText(Integer.toString(Main.OPS_PORT)); opsServerSave.setOnAction(event -> { - if(validateData(opsServerIp.getText(), opsServerPort.getText())){ + if (validateData(opsServerIp.getText(), opsServerPort.getText())) { Main.OPS_IP = opsServerIp.getText(); Main.OPS_PORT = Integer.parseInt(opsServerPort.getText()); @@ -71,7 +89,8 @@ public class SettingsController { /** * Validation error dialog. - * @param title The dialogs header text. + * + * @param title The dialogs header text. * @param message The dialogs content text. */ private void showMessage(String title, String message) { @@ -83,28 +102,27 @@ public class SettingsController { alert.showAndWait(); } - /** * Checks if the OPS-servers IP address and portnumber are valid, * shows error messages if not. * * @param serverIp The servers ip address as string - * @param portStr The port number as string + * @param portStr The port number as string * @return true if serverIp is a valid ip and portStr a valid port number */ - private boolean validateData(String serverIp, String portStr){ + private boolean validateData(String serverIp, String portStr) { int port = -1; - try{ + try { port = Integer.parseInt(portStr); - }catch (Exception e){ + } catch (Exception e) { showMessage("Portnummer ist nicht valide!", "Die Portnummer muss eine Zahl zwischen 1024 und 65535 sein!"); - return false; + return false; } - if(!(port >= 1024 && port <= 65535)){ + if (!(port >= 1024 && port <= 65535)) { showMessage("Portnummer ist nicht valide!", "Die Portnummer muss eine Zahl zwischen 1024 und 65535 sein!"); return false; } - if(!validateIpString(serverIp)){ + if (!validateIpString(serverIp)) { showMessage("IP-Adresse nicht valide!", "Die IP-Adresse ist nicht g\u00fcltig!"); return false; } @@ -112,24 +130,5 @@ public class SettingsController { return true; } - /** - * Regex for the {@link #validateIpString(String)} method. - */ - private static final Pattern PATTERN = Pattern.compile( - "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + - "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + - "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + - "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); - - /** - * Checks if the given string is a ip address string. - * - * @param ip The string to be validated. - * @return true if ip is a valid ip address, otherwise false - */ - public static boolean validateIpString(final String ip) { - return PATTERN.matcher(ip).matches(); - } - } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java index ff1abcf..3435f32 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java @@ -26,14 +26,14 @@ import java.util.stream.Collectors; /** * The controller class for the hospital ward history. - * + *

* Created by Johannes on 12.11.15. */ public class StationsHistorieController { + private final SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); @FXML private Button btnStatHistAbort; - private final SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); @FXML private GridPane fields; @FXML @@ -46,15 +46,15 @@ public class StationsHistorieController { private StationsHistorie stationsHistorieSelected = null; private MainController mainController; @FXML - private TableViewtblStationsHistorie; + private TableView tblStationsHistorie; @FXML private Button btnStatHistCancel, btnStatHistSave; @FXML private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime; @FXML - private TableColumn colStatHistStation; + private TableColumn colStatHistStation; @FXML - private TableColumn colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; + private TableColumn colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; @FXML private DateTimePicker dtTmAufnahme, dtTmEntlassung; @FXML @@ -112,9 +112,9 @@ public class StationsHistorieController { }); } - private void initButtons(){ + private void initButtons() { // btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); - // btnStatHistCancel.managedProperty().bind(btnStatHistCancel.visibleProperty()); + // btnStatHistCancel.managedProperty().bind(btnStatHistCancel.visibleProperty()); btnStatHistSave.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); btnStatHistSave.managedProperty().bind(btnStatHistSave.visibleProperty()); @@ -123,18 +123,18 @@ public class StationsHistorieController { btnStatHistAbort.managedProperty().bind(btnStatHistAbort.visibleProperty()); btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW) - .and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); + .and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); btnStatHistEdit.managedProperty().bind(btnStatHistEdit.visibleProperty()); btnStatHistDelete.visibleProperty().bind(btnStatHistEdit.visibleProperty()); btnStatHistDelete.managedProperty().bind(btnStatHistDelete.visibleProperty()); } - private void initStationsFilter(){ + private void initStationsFilter() { final String any = "beliebig"; List abteilungen = mainController.getStammdaten().getStationen().stream() - .map(stat->stat.getAbteilung()).distinct().collect(Collectors.toList()); + .map(stat -> stat.getAbteilung()).distinct().collect(Collectors.toList()); Collections.sort(abteilungen); cmbAbteilung.setItems(FXCollections.observableArrayList(abteilungen)); cmbAbteilung.getItems().add(0, any); @@ -149,12 +149,11 @@ public class StationsHistorieController { FilteredList stationenFiltered = new FilteredList(mainController.getStammdaten().getStationen()); stationenFiltered.predicateProperty().bind(Bindings.createObjectBinding(() -> { - if(cmbAbteilung.getValue()==null || cmbAbteilung.getValue().equals(any)){ - return p->true; + if (cmbAbteilung.getValue() == null || cmbAbteilung.getValue().equals(any)) { + return p -> true; } return p -> p.getAbteilung().equals(cmbAbteilung.getValue()); - },cmbAbteilung.valueProperty())); - + }, cmbAbteilung.valueProperty())); cmbStation.setItems(stationenFiltered); @@ -173,7 +172,7 @@ public class StationsHistorieController { if (getState() == State.CREATE) { StationsHistorie stationsHistorie = new StationsHistorie(); copyFieldDataIntoStationsHistorie(stationsHistorie); - if(!validateData(stationsHistorie)){ + if (!validateData(stationsHistorie)) { return; } try { @@ -184,7 +183,7 @@ public class StationsHistorieController { mainController.refreshCaseData(); } else { copyFieldDataIntoStationsHistorie(stationsHistorieSelected); - if(!validateData(stationsHistorieSelected)){ + if (!validateData(stationsHistorieSelected)) { return; } try { @@ -247,32 +246,32 @@ public class StationsHistorieController { return stationsHistorie; } - public void setStationsHistorieSelected(StationsHistorie stationsHistorie){ - this.stationsHistorieSelected=stationsHistorie; - if(stationsHistorie==null){ + public void setStationsHistorieSelected(StationsHistorie stationsHistorie) { + this.stationsHistorieSelected = stationsHistorie; + if (stationsHistorie == null) { clearFields(); - }else { + } else { copyStationsHistorieDataIntoFields(); } } - private void initColumns(){ - colStatHistStation.setCellValueFactory(new PropertyValueFactory("stationKey")); - colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory("aufnahmeDatum")); - colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory("entlassungsDatum")); + private void initColumns() { + colStatHistStation.setCellValueFactory(new PropertyValueFactory("stationKey")); + colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory("aufnahmeDatum")); + colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory("entlassungsDatum")); } - private void copyStationsHistorieDataIntoFields(){ + private void copyStationsHistorieDataIntoFields() { - if(stationsHistorieSelected==null){ + if (stationsHistorieSelected == null) { clearFields(); return; } //Setze Station im Dropdownfeld for (Station station : cmbStation.getItems()) { - if(station.getStation().equals(stationsHistorieSelected.getStationKey())){ + if (station.getStation().equals(stationsHistorieSelected.getStationKey())) { cmbStation.getSelectionModel().select(station); cmbAbteilung.getSelectionModel().select(station.getAbteilung()); break; @@ -280,13 +279,11 @@ public class StationsHistorieController { } - - dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum()); dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum()); statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller())); - if(stationsHistorieSelected.getErstellDatumZeit()!=null){ + if (stationsHistorieSelected.getErstellDatumZeit() != null) { statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString()); } statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter())); @@ -295,14 +292,14 @@ public class StationsHistorieController { } } - private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ + private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie) { stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); stationsHistorie.setStation(cmbStation.getValue()); stationsHistorie.setFallID(mainController.getFallController().getFall().getFallID()); - if(cmbStation.getValue()!= null){ + if (cmbStation.getValue() != null) { stationsHistorie.setStationKey(cmbStation.getValue().getStation()); - }else{ + } else { stationsHistorie.setStationKey(null); } stationsHistorie.setErsteller(mainController.getCurrentMitarbeiter().getMitarbID()); @@ -320,17 +317,17 @@ public class StationsHistorieController { } - private boolean validateData(StationsHistorie stationsHistorie){ - if(stationsHistorie.getStationKey()==null){ + private boolean validateData(StationsHistorie stationsHistorie) { + if (stationsHistorie.getStationKey() == null) { showMessage("Keine Station ausgew\00e4hlt!", "Bitte Station und nicht nur Abteilung ausw\00e4hlen!"); return false; } - if(stationsHistorie.getAufnahmeDatum()==null){ + if (stationsHistorie.getAufnahmeDatum() == null) { showMessage("Aufnahmedatum fehlt!", "Bitte den Beginn des Stationsaufenthalts angeben!"); - return false; + return false; } - if(stationsHistorie.getEntlassungsDatum() != null && - stationsHistorie.getAufnahmeDatum().isAfter(stationsHistorie.getEntlassungsDatum())){ + if (stationsHistorie.getEntlassungsDatum() != null && + stationsHistorie.getAufnahmeDatum().isAfter(stationsHistorie.getEntlassungsDatum())) { showMessage("Aufnahmedatum liegt hinter Entlassungsdatum!", "Bitte die eingegebenen Daten nocheinmal kontrollieren!"); return false; } @@ -339,7 +336,7 @@ public class StationsHistorieController { return true; } - private void clearFields(){ + private void clearFields() { statHistCreateTime.setText(""); statHistCreator.setText(""); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java index b574896..f26f9e8 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java @@ -13,7 +13,6 @@ import de.uniluebeck.mi.projmi6.view.SelectKeyComboBoxListener; import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.ObservableList; -import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.layout.GridPane; @@ -28,65 +27,33 @@ import java.sql.SQLException; */ public class UntersuchungenController { - /** - * The states the controller might be. - */ - public enum State { - CREATE, EDIT, VIEW - } - - private final SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); - - - /** - * A getter for the {@link #stateProperty()}. - * @return The controllers current state - */ - public State getState() { - return state.get(); - } - - /** - * A property for the state of the controller/UI. - * @return - */ - public ReadOnlyObjectProperty stateProperty() { - return state; - } - + private final SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); /** * The list of examinations that is shown in the views that belong to the controller. */ private SimpleObjectProperty> untersuchungen = new SimpleObjectProperty<>(); - /** * A pointer to the main controller. */ private MainController mainController; - @FXML private Button btnUntsCancel, btnUntsCreate, btnUntsSave, btnUntsAbort; - @FXML private DateTimePicker dtTmUntersuchungszeitpunkt; - @FXML - private Label untsChanger, untsCreator, untsChangeTime, untsCreateTime; - + private Label untsChanger, untsCreator, untsChangeTime, untsCreateTime; @FXML private ListView untsList; - @FXML private ComboBox untsOpsCode; - @FXML private GridPane fields; - @FXML private ComboBox untsArzt; /** * Constructor for the mainController. + * * @param mainController The MainController that created this instance. */ public UntersuchungenController(MainController mainController) { @@ -94,16 +61,35 @@ public class UntersuchungenController { } /** + * A getter for the {@link #stateProperty()}. + * + * @return The controllers current state + */ + public State getState() { + return state.get(); + } + + /** + * A property for the state of the controller/UI. + * + * @return + */ + public ReadOnlyObjectProperty stateProperty() { + return state; + } + + /** * A getter for the {@link #untersuchungenProperty()}. Might be null. + * * @return The list of examinations that are shown in this view. */ public ObservableList getUntersuchungen() { return untersuchungen.get(); } - /** * A setter for the {@link #untersuchungenProperty()}. Might be null. + * * @param untersuchungen The ObservableList to set. */ public void setUntersuchungen(ObservableList untersuchungen) { @@ -120,18 +106,17 @@ public class UntersuchungenController { /** * Initializes the comboboxes with values. */ - private void initComboBoxes(){ + private void initComboBoxes() { untsOpsCode.itemsProperty().bind(mainController.getStammdaten().opsCodesProperty()); new SelectKeyComboBoxListener(untsOpsCode); untsArzt.itemsProperty().bind(mainController.getStammdaten().mitarbeiterProperty()); } - /** * Binds the buttons visibility to the controllers current state. */ - private void initButtons(){ + private void initButtons() { btnUntsCreate.disableProperty().bind(mainController.fallProperty().isNull()); btnUntsCancel.managedProperty().bind(state.isEqualTo(State.VIEW) @@ -148,29 +133,29 @@ public class UntersuchungenController { /** * Set up data, disable property and listener. */ - private void initList(){ + private void initList() { untsList.itemsProperty().bind(untersuchungen); untsList.getSelectionModel().selectedItemProperty().addListener( (observable, oldVal, newVal) -> copyUntersuchungDataIntoFields()); untsList.disableProperty().bind(state.isNotEqualTo(State.VIEW)); untsList.setCellFactory(lv -> { - return new ListCell(){ + return new ListCell() { @Override protected void updateItem(Untersuchung item, boolean empty) { super.updateItem(item, empty); - if(item==null||empty){ + if (item == null || empty) { setText(null); setGraphic(null); return; } setText(item.toString()); - if(item.getStorniert()){ + if (item.getStorniert()) { setTextFill(Color.GRAY); Text text = new Text(" "); text.setFill(Color.RED); setGraphic(text); - }else{ + } else { setTextFill(Color.BLACK); setGraphic(null); } @@ -183,7 +168,7 @@ public class UntersuchungenController { * FXMLLoaders init method. */ @FXML - void initialize(){ + void initialize() { //Clear fields on startup copyUntersuchungDataIntoFields(); @@ -194,9 +179,9 @@ public class UntersuchungenController { fields.disableProperty().bind(state.isEqualTo(State.VIEW)); state.addListener((observable, oldValue, newValue) -> { - if(newValue==State.VIEW){ + if (newValue == State.VIEW) { mainController.unlockFromEdit(); - }else{ + } else { mainController.lockForEdit(MainController.TabName.UNTERSUCHUNG); } }); @@ -218,23 +203,23 @@ public class UntersuchungenController { @FXML private void clickedUntsCancel() { Untersuchung untersuchung = untsList.getSelectionModel().getSelectedItem(); - if(untersuchung==null) { + if (untersuchung == null) { return; } untersuchung.setStorniert(true); try { DBHandler.setUntersuchung(untersuchung, mainController.getCurrentMitarbeiter().getMitarbID(), true); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } - mainController.refreshCaseData(); + mainController.refreshCaseData(); } /** * Handler for the abort button. Aborts editing/creating. */ @FXML - private void clickedUntsAbort(){ + private void clickedUntsAbort() { state.set(State.VIEW); copyUntersuchungDataIntoFields(); } @@ -253,20 +238,19 @@ public class UntersuchungenController { } catch (SQLException e) { e.printStackTrace(); } - } else if(state.get()==State.EDIT){ + } else if (state.get() == State.EDIT) { Untersuchung untersuchung = untsList.getSelectionModel().getSelectedItem(); copyFieldDataIntoUntersuchung(untersuchung); //... } } - /** * Copy the currently selected Untersuchung object into the fields on the right. */ - private void copyUntersuchungDataIntoFields(){ + private void copyUntersuchungDataIntoFields() { Untersuchung untersuchung = untsList.getSelectionModel().getSelectedItem(); - if(untersuchung==null){ + if (untersuchung == null) { clearFields(); return; } @@ -283,18 +267,19 @@ public class UntersuchungenController { /** * Copies the values from the TextFields and ComboBoxes into the given Untersuchung object. + * * @param untersuchung The object the data will be copied into. */ - private void copyFieldDataIntoUntersuchung(Untersuchung untersuchung){ - untersuchung.setOpscode(untsOpsCode.getValue()); - untersuchung.setDurchfuehrenderArzt(untsArzt.getValue()); - untersuchung.setUntersuchungsdatum(dtTmUntersuchungszeitpunkt.getDateTime()); + private void copyFieldDataIntoUntersuchung(Untersuchung untersuchung) { + untersuchung.setOpscode(untsOpsCode.getValue()); + untersuchung.setDurchfuehrenderArzt(untsArzt.getValue()); + untersuchung.setUntersuchungsdatum(dtTmUntersuchungszeitpunkt.getDateTime()); } /** * Clears the TextFields. */ - private void clearFields(){ + private void clearFields() { untsCreateTime.setText(""); untsCreator.setText(""); untsChangeTime.setText(""); @@ -306,6 +291,12 @@ public class UntersuchungenController { } + /** + * The states the controller might be. + */ + public enum State { + CREATE, EDIT, VIEW + } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java b/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java index 6c63a8e..9499c5c 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java @@ -140,13 +140,7 @@ public class HL7Sender { response = initiator.sendAndReceive(adt); Thread.sleep(5000); } - } catch (HL7Exception e) { - e.printStackTrace(); - } catch (LLPException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { + } catch (HL7Exception | LLPException | IOException | InterruptedException e) { e.printStackTrace(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Server.java b/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Server.java index 78ece3b..cae3f1c 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Server.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Server.java @@ -4,7 +4,6 @@ import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.app.HL7Service; import ca.uhn.hl7v2.protocol.ReceivingApplication; -import de.uniluebeck.mi.projmi6.controller.MainController; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; @@ -16,15 +15,14 @@ import java.util.concurrent.TimeUnit; public class HL7Server { private static final int PORT = 1111; - private final HapiContext context; private final HL7Service server; private final ThreadPoolExecutor executor; - public HL7Server(MainController mainctrl) throws InterruptedException { + public HL7Server() { executor = new ThreadPoolExecutor(10, 100, 30, TimeUnit.SECONDS, new ArrayBlockingQueue(100)); executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - context = new DefaultHapiContext(); + HapiContext context = new DefaultHapiContext(); context.setExecutorService(executor); server = context.newServer(PORT, false); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/DiagArt.java b/src/main/java/de/uniluebeck/mi/projmi6/model/DiagArt.java index b84a7fc..e60273d 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/DiagArt.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/DiagArt.java @@ -5,10 +5,10 @@ package de.uniluebeck.mi.projmi6.model; */ public enum DiagArt { - VERDACHT(1,"Verdacht"), - EINWEISUNG(2,"Einweisung"), + VERDACHT(1, "Verdacht"), + EINWEISUNG(2, "Einweisung"), OPDIAG(3, "OP-Diag"), - ENTLASSUNG(4,"Entlassung"); + ENTLASSUNG(4, "Entlassung"); private final int id; private final String diagArt; @@ -18,7 +18,7 @@ public enum DiagArt { this.diagArt = diagArt; } - public static DiagArt parseInt(final int id){ + public static DiagArt parseInt(final int id) { switch (id) { case 1: return VERDACHT; diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Diagnose.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Diagnose.java index 23ae380..bb6ea07 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Diagnose.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Diagnose.java @@ -42,19 +42,19 @@ public class Diagnose extends Version { return freiText.get(); } + public void setFreiText(String freiText) { + this.freiText.set(freiText); + } + @Override public String toString() { - return icd10code+""; + return icd10code + ""; } public SimpleStringProperty freiTextProperty() { return freiText; } - public void setFreiText(String freiText) { - this.freiText.set(freiText); - } - public DiagArt getDiagArt() { return diagArt; } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Fachrichtung.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Fachrichtung.java index 62ad2c1..604648e 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Fachrichtung.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Fachrichtung.java @@ -2,7 +2,6 @@ package de.uniluebeck.mi.projmi6.model; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; -import sun.java2d.pipe.SpanShapeRenderer; /** * Created by 630030 on 12.11.15. @@ -19,59 +18,59 @@ public class Fachrichtung { return abteilung.get(); } - public SimpleStringProperty abteilungProperty() { - return abteilung; - } - public void setAbteilung(String abteilung) { this.abteilung.set(abteilung); } - public int getAbteilungstyp() { - return abteilungstyp.get(); + public SimpleStringProperty abteilungProperty() { + return abteilung; } - public SimpleIntegerProperty abteilungstypProperty() { - return abteilungstyp; + public int getAbteilungstyp() { + return abteilungstyp.get(); } public void setAbteilungstyp(int abteilungstyp) { this.abteilungstyp.set(abteilungstyp); } - public String getBezeichnung() { - return bezeichnung.get(); + public SimpleIntegerProperty abteilungstypProperty() { + return abteilungstyp; } - public SimpleStringProperty bezeichnungProperty() { - return bezeichnung; + public String getBezeichnung() { + return bezeichnung.get(); } public void setBezeichnung(String bezeichnung) { this.bezeichnung.set(bezeichnung); } - public String getBezeichnungLang() { - return bezeichnungLang.get(); + public SimpleStringProperty bezeichnungProperty() { + return bezeichnung; } - public SimpleStringProperty bezeichnungLangProperty() { - return bezeichnungLang; + public String getBezeichnungLang() { + return bezeichnungLang.get(); } public void setBezeichnungLang(String bezeichnungLang) { this.bezeichnungLang.set(bezeichnungLang); } - public String getBezeichnungLang2() { - return bezeichnungLang2.get(); + public SimpleStringProperty bezeichnungLangProperty() { + return bezeichnungLang; } - public SimpleStringProperty bezeichnungLang2Property() { - return bezeichnungLang2; + public String getBezeichnungLang2() { + return bezeichnungLang2.get(); } public void setBezeichnungLang2(String bezeichnungLang2) { this.bezeichnungLang2.set(bezeichnungLang2); } + + public SimpleStringProperty bezeichnungLang2Property() { + return bezeichnungLang2; + } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java index a8af539..b14ab77 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Fall.java @@ -28,28 +28,27 @@ public class Fall extends Version { private SimpleObjectProperty entlassungsDatum = new SimpleObjectProperty<>(this, "entlassungsDatum"); private SimpleIntegerProperty fallID = new SimpleIntegerProperty(this, "fallid"); + public LocalDateTime getVorstellDatum() { + return vorstellDatum.get(); + } + public void setVorstellDatum(LocalDateTime vorstellDatum) { this.vorstellDatum.set(vorstellDatum); } - - - public LocalDateTime getVorstellDatum() { - return vorstellDatum.get(); - } - public int getHauptdiagnoseId() { return hauptdiagnoseId.get(); } + public void setHauptdiagnoseId(int hauptdiagnoseId) { + this.hauptdiagnoseId.set(hauptdiagnoseId); + } + public SimpleIntegerProperty hauptdiagnoseIdProperty() { return hauptdiagnoseId; } - public void setHauptdiagnoseId(int hauptdiagnoseId) { - this.hauptdiagnoseId.set(hauptdiagnoseId); - } public SimpleObjectProperty vorstellDatumProperty() { return vorstellDatum; } @@ -124,9 +123,9 @@ public class Fall extends Version { @Override public String toString() { - if(getAufnahmeDatum()!=null){ + if (getAufnahmeDatum() != null) { return getAufnahmeDatum().toLocalDate().toString(); - }else{ + } else { return Integer.toString(getFallID()); } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/FallArt.java b/src/main/java/de/uniluebeck/mi/projmi6/model/FallArt.java index 72ea2c5..f8a12d2 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/FallArt.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/FallArt.java @@ -16,7 +16,7 @@ public enum FallArt { this.fallArt = fallArt; } - public static FallArt parseString (final String id){ + public static FallArt parseString(final String id) { switch (id) { case "amb": return AMBULANT; diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java b/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java index 92a6cff..531bd32 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/HL7Message.java @@ -26,16 +26,16 @@ public class HL7Message { return dateTime; } - @Override - public String toString() { - return dateTime+ " - "+(failed?"": - (patient!=null? patient.getNachname()+", "+patient.getVorname():"")); - } - public void setDateTime(LocalDateTime dateTime) { this.dateTime = dateTime; } + @Override + public String toString() { + return dateTime + " - " + (failed ? "" : + (patient != null ? patient.getNachname() + ", " + patient.getVorname() : "")); + } + public String getMessageContent() { return messageContent; } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java index e6cf41e..dc5246d 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java @@ -12,7 +12,7 @@ public class Icd10Code { private final int version; - public Icd10Code(String icd10Code, String text, int version){ + public Icd10Code(String icd10Code, String text, int version) { this.code = icd10Code; this.text = text; this.version = version; @@ -32,17 +32,14 @@ public class Icd10Code { @Override public String toString() { - return code+" - "+ text; + return code + " - " + text; } public boolean isLastElementANumber() { String lastElement = code.substring(code.length() - 1); char[] lastEl = lastElement.toCharArray(); - if (Character.isDigit(lastEl[0])) { - return true; - } - return false; + return Character.isDigit(lastEl[0]); } } \ No newline at end of file diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Kasse.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Kasse.java index 8846f56..0048541 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Kasse.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Kasse.java @@ -1,4 +1,5 @@ package de.uniluebeck.mi.projmi6.model; + import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; @@ -12,12 +13,12 @@ public class Kasse extends Version { private SimpleStringProperty name = new SimpleStringProperty(this, "name"); private SimpleBooleanProperty privat = new SimpleBooleanProperty(this, "privat"); - public Kasse(){ + public Kasse() { } - public Kasse(int id, String name, String adresse, boolean privat){ + public Kasse(int id, String name, String adresse, boolean privat) { kassenID.set(id); this.name.set(name); this.adresse.set(adresse); @@ -28,52 +29,52 @@ public class Kasse extends Version { return adresse.get(); } - public SimpleStringProperty adresseProperty() { - return adresse; - } - public void setAdresse(String adresse) { this.adresse.set(adresse); } - public int getKassenID() { - return kassenID.get(); + public SimpleStringProperty adresseProperty() { + return adresse; } - public SimpleIntegerProperty kassenIDProperty() { - return kassenID; + public int getKassenID() { + return kassenID.get(); } public void setKassenID(int kassenID) { this.kassenID.set(kassenID); } - public String getName() { - return name.get(); + public SimpleIntegerProperty kassenIDProperty() { + return kassenID; } - public SimpleStringProperty nameProperty() { - return name; + public String getName() { + return name.get(); } public void setName(String name) { this.name.set(name); } - public boolean getPrivat() { - return privat.get(); + public SimpleStringProperty nameProperty() { + return name; } - public SimpleBooleanProperty privatProperty() { - return privat; + public boolean getPrivat() { + return privat.get(); } public void setPrivat(boolean privat) { this.privat.set(privat); } + public SimpleBooleanProperty privatProperty() { + return privat; + } + @Override public String toString() { - return getName() + " (" +(getPrivat()?"privat":"gesetzlich")+")" ; + return getName() + " (" + (getPrivat() ? "privat" : "gesetzlich") + ")"; } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/OpsCode.java b/src/main/java/de/uniluebeck/mi/projmi6/model/OpsCode.java index b9e90db..ea1d74f 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/OpsCode.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/OpsCode.java @@ -11,7 +11,7 @@ public class OpsCode { private final int version; - public OpsCode(String opsCode, String text, int version){ + public OpsCode(String opsCode, String text, int version) { this.opsCode = opsCode; this.text = text; this.version = version; diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Patient.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Patient.java index 2656c84..8675939 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Patient.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Patient.java @@ -151,14 +151,14 @@ public class Patient extends Version { return kassenID.get(); } - public SimpleIntegerProperty kassenIDProperty() { - return kassenID; - } - public void setKassenID(int kassenID) { this.kassenID.set(kassenID); } + public SimpleIntegerProperty kassenIDProperty() { + return kassenID; + } + public LocalDate getGeburtsdatum() { return geburtsdatum.get(); } @@ -235,7 +235,7 @@ public class Patient extends Version { } public static Geschlecht parseStringFromHL7(final String geschlecht) { - geschlecht.toLowerCase(); + geschlecht.toLowerCase(); if (geschlecht.startsWith("m")) { return MALE; } else if (geschlecht.startsWith("f")) { diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java index ce38686..45b7038 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java @@ -13,22 +13,19 @@ public class Stammdaten { private SimpleObjectProperty> mitarbeiter = new SimpleObjectProperty<>(); private SimpleObjectProperty> kassen = new SimpleObjectProperty<>(); private SimpleObjectProperty> stationen = new SimpleObjectProperty<>(); + private SimpleObjectProperty> patienten = new SimpleObjectProperty<>(); public ObservableList getPatienten() { return patienten.get(); } - public SimpleObjectProperty> patientenProperty() { - return patienten; - } - public void setPatienten(ObservableList patienten) { this.patienten.set(patienten); } - private SimpleObjectProperty> patienten = new SimpleObjectProperty<>(); - - + public SimpleObjectProperty> patientenProperty() { + return patienten; + } public ObservableList getOpsCodes() { return opsCodes.get(); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/StationsUebersichtsItem.java b/src/main/java/de/uniluebeck/mi/projmi6/model/StationsUebersichtsItem.java index af3d5e2..9cd0752 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/StationsUebersichtsItem.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/StationsUebersichtsItem.java @@ -12,7 +12,7 @@ import java.time.LocalDate; public class StationsUebersichtsItem { private SimpleIntegerProperty patId = new SimpleIntegerProperty(this, "patId"); private SimpleStringProperty patName = new SimpleStringProperty(this, "patName"); - private SimpleObjectProperty patBirthdate = new SimpleObjectProperty<>(this,"patBirthdate"); + private SimpleObjectProperty patBirthdate = new SimpleObjectProperty<>(this, "patBirthdate"); private SimpleIntegerProperty patAge = new SimpleIntegerProperty(this, "patAge"); private SimpleObjectProperty stationAufnahme = new SimpleObjectProperty<>(this, "stationAufnahme"); private SimpleObjectProperty stationEntlassung = new SimpleObjectProperty<>(this, "stationEntlassung"); @@ -23,74 +23,74 @@ public class StationsUebersichtsItem { return patId.get(); } - public SimpleIntegerProperty patIdProperty() { - return patId; - } - public void setPatId(int patId) { this.patId.set(patId); } - public String getPatName() { - return patName.get(); + public SimpleIntegerProperty patIdProperty() { + return patId; } - public SimpleStringProperty patNameProperty() { - return patName; + public String getPatName() { + return patName.get(); } public void setPatName(String patName) { this.patName.set(patName); } - public LocalDate getPatBirthdate() { - return patBirthdate.get(); + public SimpleStringProperty patNameProperty() { + return patName; } - public SimpleObjectProperty patBirthdateProperty() { - return patBirthdate; + public LocalDate getPatBirthdate() { + return patBirthdate.get(); } public void setPatBirthdate(LocalDate patBirthdate) { this.patBirthdate.set(patBirthdate); } - public int getPatAge() { - return patAge.get(); + public SimpleObjectProperty patBirthdateProperty() { + return patBirthdate; } - public SimpleIntegerProperty patAgeProperty() { - return patAge; + public int getPatAge() { + return patAge.get(); } public void setPatAge(int patAge) { this.patAge.set(patAge); } - public LocalDate getStationAufnahme() { - return stationAufnahme.get(); + public SimpleIntegerProperty patAgeProperty() { + return patAge; } - public SimpleObjectProperty stationAufnahmeProperty() { - return stationAufnahme; + public LocalDate getStationAufnahme() { + return stationAufnahme.get(); } public void setStationAufnahme(LocalDate stationAufnahme) { this.stationAufnahme.set(stationAufnahme); } - public LocalDate getStationEntlassung() { - return stationEntlassung.get(); + public SimpleObjectProperty stationAufnahmeProperty() { + return stationAufnahme; } - public SimpleObjectProperty stationEntlassungProperty() { - return stationEntlassung; + public LocalDate getStationEntlassung() { + return stationEntlassung.get(); } public void setStationEntlassung(LocalDate stationEntlassung) { this.stationEntlassung.set(stationEntlassung); } + public SimpleObjectProperty stationEntlassungProperty() { + return stationEntlassung; + } + public int getFallId() { return fallId; } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Untersuchung.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Untersuchung.java index 3238150..7951f0d 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Untersuchung.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Untersuchung.java @@ -3,7 +3,6 @@ package de.uniluebeck.mi.projmi6.model; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; import java.time.LocalDateTime; @@ -46,40 +45,40 @@ public class Untersuchung extends Version { return storniert.get(); } - public SimpleBooleanProperty storniertProperty() { - return storniert; - } - public void setStorniert(boolean storniert) { this.storniert.set(storniert); } + public SimpleBooleanProperty storniertProperty() { + return storniert; + } + public LocalDateTime getUntersuchungsdatum() { return untersuchungsdatum.get(); } + public void setUntersuchungsdatum(LocalDateTime untersuchungsdatum) { + this.untersuchungsdatum.set(untersuchungsdatum); + } + public SimpleObjectProperty untersuchungsdatumProperty() { return untersuchungsdatum; } @Override public String toString() { - return getUntersuchungsdatum()+": "+getOpscode().getText(); - } - - public void setUntersuchungsdatum(LocalDateTime untersuchungsdatum) { - this.untersuchungsdatum.set(untersuchungsdatum); + return getUntersuchungsdatum() + ": " + getOpscode().getText(); } public int getUntersID() { return untersID.get(); } - public SimpleIntegerProperty untersIDProperty() { - return untersID; - } - public void setUntersID(int untersID) { this.untersID.set(untersID); } + + public SimpleIntegerProperty untersIDProperty() { + return untersID; + } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java index 46ebb81..c1fc152 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java @@ -2,23 +2,21 @@ package de.uniluebeck.mi.projmi6.view; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; -import javafx.beans.property.IntegerPropertyBase; -import javafx.collections.FXCollections; import javafx.geometry.Insets; import javafx.geometry.Pos; -import javafx.scene.Node; -import javafx.scene.control.*; +import javafx.scene.control.Button; +import javafx.scene.control.DatePicker; +import javafx.scene.control.Label; import javafx.scene.effect.DropShadow; import javafx.scene.effect.Effect; -import javafx.scene.layout.*; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Priority; import javafx.scene.paint.Color; -import javafx.scene.paint.Paint; import java.time.LocalDate; -import java.time.LocalTime; -import java.util.Arrays; -import java.util.stream.IntStream; import java.time.LocalDateTime; +import java.time.LocalTime; + /** * A picker for date and time, composed from a DatePicker and two ComboBoxes. It also has an optional Button to set * date and time to the current system time. @@ -37,12 +35,12 @@ public class DateTimePicker extends HBox { /** * Empty constructor for the FXMLLoader. */ - public DateTimePicker(){ + public DateTimePicker() { this.setAlignment(Pos.CENTER_LEFT); - hourText.setOnKeyReleased(event ->{ - if(hourText.getCaretPosition()>=2){ + hourText.setOnKeyReleased(event -> { + if (hourText.getCaretPosition() >= 2) { int hour = Integer.parseInt(hourText.getText()); - if(hour>=0 && hour <= 24){ + if (hour >= 0 && hour <= 24) { minuteText.requestFocus(); } } @@ -57,34 +55,34 @@ public class DateTimePicker extends HBox { minuteText.setPromptText("MM"); HBox.setHgrow(minuteText, Priority.ALWAYS); - hourText.effectProperty().bind(Bindings.createObjectBinding(()->{ + hourText.effectProperty().bind(Bindings.createObjectBinding(() -> { String text = hourText.getText(); - if(text.isEmpty()){ + if (text.isEmpty()) { return null; } int value = Integer.parseInt(text); - if(value>=0&&value<24){ + if (value >= 0 && value < 24) { return null; } return invalidValue; }, hourText.textProperty())); - minuteText.effectProperty().bind(Bindings.createObjectBinding(()->{ + minuteText.effectProperty().bind(Bindings.createObjectBinding(() -> { String text = minuteText.getText(); - if(text.isEmpty()){ + if (text.isEmpty()) { return null; } int value = Integer.parseInt(text); - if(value>=0&&value<59){ + if (value >= 0 && value < 59) { return null; } return invalidValue; }, minuteText.textProperty())); Label colon = new Label(":"); - HBox timePicker = new HBox(hourText, colon,minuteText); + HBox timePicker = new HBox(hourText, colon, minuteText); timePicker.maxHeightProperty().bind(datePicker.heightProperty()); timePicker.getStyleClass().add("time-picker"); timePicker.setMinWidth(55); @@ -98,84 +96,85 @@ public class DateTimePicker extends HBox { btnNow.getStyleClass().add("now-button"); //Add the subcomponents to the view. - this.getChildren().addAll(datePicker,timePicker,btnNow); + this.getChildren().addAll(datePicker, timePicker, btnNow); this.setSpacing(5); } - - - - /** - * Setter for the DateTime that is set in the view. - * @param localDateTime The date to be set in the view. - */ - public void setDateTime(LocalDateTime localDateTime){ - if(localDateTime==null){ - hourText.setText(""); - minuteText.setText(""); - datePicker.setValue(null); - }else{ - datePicker.setValue(LocalDate.from(localDateTime)); - hourText.setText(Integer.toString(localDateTime.getHour())); - - int minute = localDateTime.getMinute(); - minuteText.setText((minute<9?"0":"")+Integer.toString(minute)); - } - } - /** * Sets the date set in the view to the current systems time. */ - public void setToCurrentDateTime(){ + public void setToCurrentDateTime() { setDateTime(LocalDateTime.now()); } - /** * Getter for date and time that is currently set in the view. + * * @return A LocalDateTime object or null, if one or more fields are not set. */ - public LocalDateTime getDateTime(){ - if(datePicker.getValue()==null ){ - return null; + public LocalDateTime getDateTime() { + if (datePicker.getValue() == null) { + return null; } - try{ - int hour = Integer.parseInt( hourText.getText()); + try { + int hour = Integer.parseInt(hourText.getText()); int minute = Integer.parseInt(minuteText.getText()); - if(hour>=24|| hour<0||minute<0||minute>=60){ + if (hour >= 24 || hour < 0 || minute < 0 || minute >= 60) { return null; } return LocalDateTime.of(datePicker.getValue(), LocalTime.of(hour, minute)); - }catch (Exception e){ - return null; + } catch (Exception e) { + return null; } } /** - * A property for hiding the "Set date and time to now"-Button. - * @return A BooleanProperty, true if the button is visible. + * Setter for the DateTime that is set in the view. + * + * @param localDateTime The date to be set in the view. */ - public BooleanProperty nowButtonVisiblePropety(){ - return btnNow.visibleProperty(); + public void setDateTime(LocalDateTime localDateTime) { + if (localDateTime == null) { + hourText.setText(""); + minuteText.setText(""); + datePicker.setValue(null); + } else { + datePicker.setValue(LocalDate.from(localDateTime)); + hourText.setText(Integer.toString(localDateTime.getHour())); + + int minute = localDateTime.getMinute(); + minuteText.setText((minute < 9 ? "0" : "") + Integer.toString(minute)); + } } /** - * Setter for the {@link DateTimePicker#nowButtonVisiblePropety}. - * @param visible When set to true, the button will be shown. + * A property for hiding the "Set date and time to now"-Button. + * + * @return A BooleanProperty, true if the button is visible. */ - public void setNowButtonVisible(boolean visible){ - btnNow.setVisible(visible); + public BooleanProperty nowButtonVisiblePropety() { + return btnNow.visibleProperty(); } /** * Getter for the {@link DateTimePicker#nowButtonVisiblePropety}. + * * @return true if the now-Button is visible, false otherwise. */ - public boolean isNowButtonVisible(){ + public boolean isNowButtonVisible() { return btnNow.isVisible(); } + /** + * Setter for the {@link DateTimePicker#nowButtonVisiblePropety}. + * + * @param visible When set to true, the button will be shown. + */ + public void setNowButtonVisible(boolean visible) { + btnNow.setVisible(visible); + } + } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java b/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java index 6ff16f9..3b5e4f6 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/MessageIcon.java @@ -2,7 +2,6 @@ package de.uniluebeck.mi.projmi6.view; import javafx.animation.FadeTransition; import javafx.animation.Timeline; -import javafx.animation.Transition; import javafx.beans.binding.Bindings; import javafx.beans.property.SimpleIntegerProperty; import javafx.geometry.Pos; @@ -19,7 +18,7 @@ import javafx.util.Duration; /** * A simple Button with a letter icon that manages an IntegerProperty. Blinks if the integer is greater than zero. - * + *

* Created by Johannes on 21/11/2015. * * @author Johannes @@ -29,7 +28,7 @@ public class MessageIcon extends Button { /** * The letter image. */ - private final ImageView imageView = new ImageView(new Image("message.png"));; + private final ImageView imageView = new ImageView(new Image("message.png")); /** * The message number label in the center of the button. @@ -51,7 +50,7 @@ public class MessageIcon extends Button { /** * Public parameterless constructor, required for the FXMLLoader. */ - public MessageIcon(){ + public MessageIcon() { initImage(); initLabel(); initTransition(); @@ -66,18 +65,18 @@ public class MessageIcon extends Button { /** * Inits the label with the message count. */ - private void initLabel(){ + private void initLabel() { messageCountLabel.textProperty().bind(messageCount.asString()); messageCountLabel.setFont(Font.font("", FontWeight.BOLD, 20)); StackPane.setAlignment(messageCountLabel, Pos.CENTER); messageCountLabel.textFillProperty().bind(Bindings.createObjectBinding( - () -> (messageCount.get() > 0? Color.DARKRED: Color.BLACK), messageCount)); + () -> (messageCount.get() > 0 ? Color.DARKRED : Color.BLACK), messageCount)); } /** * Inits the letter image with shadow etc. */ - private void initImage(){ + private void initImage() { imageView.setFitHeight(30); imageView.setFitWidth(30); /* imageView.opacityProperty().bind(Bindings.createDoubleBinding( @@ -87,7 +86,7 @@ public class MessageIcon extends Button { ds1.setOffsetX(0.0f); ds1.setColor(Color.valueOf("#e38217")); imageView.effectProperty().bind(Bindings.createObjectBinding( - ()->messageCount.get() > 0 ? ds1:null, messageCount + () -> messageCount.get() > 0 ? ds1 : null, messageCount )); } @@ -95,16 +94,16 @@ public class MessageIcon extends Button { /** * Set up blinking effect. */ - private void initTransition(){ + private void initTransition() { transition = new FadeTransition(Duration.millis(500), imageView); transition.setFromValue(0.2); transition.setToValue(1.0); transition.setCycleCount(Timeline.INDEFINITE); transition.setAutoReverse(true); messageCount.addListener((observable, oldValue, newValue) -> { - if(messageCount.get()>0){ + if (messageCount.get() > 0) { transition.play(); - }else{ + } else { transition.stop(); } @@ -113,6 +112,7 @@ public class MessageIcon extends Button { /** * Getter for the {@link #messageCountProperty()} + * * @return The messageCountProperty's value. */ public int getMessageCount() { @@ -120,21 +120,22 @@ public class MessageIcon extends Button { } /** - * The count of messages that this view will indicate. - * @return A property for the count of messages. - */ - public SimpleIntegerProperty messageCountProperty() { - return messageCount; - } - - /** * Setter for the {@link #messageCountProperty()} + * * @param messageCount The value to be set in the message count property. */ public void setMessageCount(int messageCount) { this.messageCount.set(messageCount); } + /** + * The count of messages that this view will indicate. + * + * @return A property for the count of messages. + */ + public SimpleIntegerProperty messageCountProperty() { + return messageCount; + } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/NumberTextField.java b/src/main/java/de/uniluebeck/mi/projmi6/view/NumberTextField.java index d1cf3e0..7fff271 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/NumberTextField.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/NumberTextField.java @@ -5,29 +5,28 @@ import javafx.scene.control.TextField; /** * Based on http://blog.axxg.de/javafx-textfield-beschraenken/ - * + *

* TextField that only allows two digit characters. * Using the {@link javafx.scene.control.TextFormatter} would be better. - * + *

* Created by Johannes on 14/11/2015. */ public class NumberTextField extends TextField { - @Override public void replaceText(int start, int end, String text) { - int charactersRemoved = end -start; + int charactersRemoved = end - start; int charactersAdded = text.length(); - if ((text.matches("[0-9]")||text.length()==0) && getText().length()-charactersRemoved+charactersAdded <=2) { + if ((text.matches("[0-9]") || text.length() == 0) && getText().length() - charactersRemoved + charactersAdded <= 2) { super.replaceText(start, end, text); } } @Override public void replaceSelection(String text) { - int newTextLength = getText().length()-getSelectedText().length()+text.length(); - if (newTextLength<=2 && (text.matches("[0-9]")||text.length()==0)) { + int newTextLength = getText().length() - getSelectedText().length() + text.length(); + if (newTextLength <= 2 && (text.matches("[0-9]") || text.length() == 0)) { super.replaceSelection(text); } } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/SelectKeyComboBoxListener.java b/src/main/java/de/uniluebeck/mi/projmi6/view/SelectKeyComboBoxListener.java index d9f2306..1f4a920 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/SelectKeyComboBoxListener.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/SelectKeyComboBoxListener.java @@ -13,7 +13,7 @@ import javafx.scene.input.MouseEvent; /** * Created by nils on 19.11.2015. - *

+ *

* Geklaut von hier */ public class SelectKeyComboBoxListener implements EventHandler { diff --git a/src/main/resources/diagnose.fxml b/src/main/resources/diagnose.fxml index cd869ac..3b714bd 100644 --- a/src/main/resources/diagnose.fxml +++ b/src/main/resources/diagnose.fxml @@ -1,88 +1,96 @@ - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/main/resources/patient_tables.fxml b/src/main/resources/patient_tables.fxml index 3b0c343..e7dff3c 100644 --- a/src/main/resources/patient_tables.fxml +++ b/src/main/resources/patient_tables.fxml @@ -1,13 +1,10 @@ - - - - - + @@ -15,37 +12,41 @@ -