Compare commits
No commits in common. "5cf57bc05cdccf61f9884fd7f8eca3bd975099f9" and "40a9a793cdd138b49413a55060a8ac91b3cb4ce1" have entirely different histories.
5cf57bc05c
...
40a9a793cd
11 changed files with 13 additions and 245 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="nursingHome.db" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
||||
<data-source source="LOCAL" name="Database" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/patient/database/PatientDao.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/treatment/database/TreatmentDao.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/treatment/database/NurseDao.java" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="SQLite" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
|
@ -23,32 +23,19 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private Tab treatmentTab;
|
||||
@FXML
|
||||
private TabPane nurseTabPane;
|
||||
@FXML
|
||||
private AnchorPane nursePage;
|
||||
@FXML
|
||||
private Tab nurseTab;
|
||||
@FXML
|
||||
private AnchorPane lockedNursePage;
|
||||
@FXML
|
||||
private Tab lockedNurseTab;
|
||||
@FXML
|
||||
private AnchorPane activeNursePage;
|
||||
@FXML
|
||||
private Tab activeNurseTab;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
loadPatientPage();
|
||||
mainTabPane.getSelectionModel().select(patientTab);
|
||||
nurseTabPane.getSelectionModel().select(activeNurseTab);
|
||||
|
||||
patientTab.setOnSelectionChanged(event -> loadPatientPage());
|
||||
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
|
||||
nurseTab.setOnSelectionChanged(event -> loadNursePage());
|
||||
|
||||
activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage());
|
||||
lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage());
|
||||
}
|
||||
|
||||
private void loadPatientPage() {
|
||||
|
@ -83,38 +70,14 @@ public class MainWindowController {
|
|||
|
||||
private void loadNursePage() {
|
||||
try {
|
||||
nurseTabPane.getSelectionModel().select(activeNurseTab);
|
||||
loadActiveNursePage();
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadActiveNursePage() {
|
||||
try {
|
||||
BorderPane activeNursePane = FXMLLoader.load(
|
||||
BorderPane nursePane = FXMLLoader.load(
|
||||
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/nurse/AllNurseView.fxml"))
|
||||
);
|
||||
activeNursePage.getChildren().setAll(activeNursePane);
|
||||
AnchorPane.setTopAnchor(activeNursePane, 0d);
|
||||
AnchorPane.setBottomAnchor(activeNursePane, 0d);
|
||||
AnchorPane.setLeftAnchor(activeNursePane, 0d);
|
||||
AnchorPane.setRightAnchor(activeNursePane, 0d);
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadLockedNursePage() {
|
||||
try {
|
||||
BorderPane lockedNursePane = FXMLLoader.load(
|
||||
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/nurse/LockedNurseView.fxml"))
|
||||
);
|
||||
lockedNursePage.getChildren().setAll(lockedNursePane);
|
||||
AnchorPane.setTopAnchor(lockedNursePane, 0d);
|
||||
AnchorPane.setBottomAnchor(lockedNursePane, 0d);
|
||||
AnchorPane.setLeftAnchor(lockedNursePane, 0d);
|
||||
AnchorPane.setRightAnchor(lockedNursePane, 0d);
|
||||
nursePage.getChildren().setAll(nursePane);
|
||||
AnchorPane.setTopAnchor(nursePane, 0d);
|
||||
AnchorPane.setBottomAnchor(nursePane, 0d);
|
||||
AnchorPane.setLeftAnchor(nursePane, 0d);
|
||||
AnchorPane.setRightAnchor(nursePane, 0d);
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ public class AllNurseController {
|
|||
@FXML
|
||||
public Button buttonAdd;
|
||||
@FXML
|
||||
public Button buttonLock;
|
||||
@FXML
|
||||
private TableView<Nurse> tableView;
|
||||
@FXML
|
||||
private TableColumn<Nurse, Long> columnId;
|
||||
|
@ -97,18 +95,6 @@ public class AllNurseController {
|
|||
readAllAndShowInTableView();
|
||||
clearTextfields();
|
||||
}
|
||||
@FXML
|
||||
public void handleLock(){
|
||||
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null){
|
||||
try {
|
||||
DaoFactory.getInstance().createNurseDAO().delete(selectedItem.getId());
|
||||
this.tableView.getItems().remove(selectedItem);
|
||||
}catch (SQLException exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearTextfields() {
|
||||
this.textFieldFirstName.clear();
|
||||
|
@ -116,5 +102,4 @@ public class AllNurseController {
|
|||
this.textFieldPhoneNumber.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
package de.hitec.nhplus.nurse;
|
||||
|
||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||
import de.hitec.nhplus.nurse.database.NurseDao;
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class LockedNurseController {
|
||||
@FXML
|
||||
public Button buttonDelete;
|
||||
@FXML
|
||||
private Button buttonUnlock;
|
||||
@FXML
|
||||
public TableView<Nurse> tableView;
|
||||
@FXML
|
||||
public TableColumn<Nurse, Long> columnId;
|
||||
@FXML
|
||||
public TableColumn<Nurse, String> columnFirstName;
|
||||
@FXML
|
||||
public TableColumn<Nurse, String> columnSurName;
|
||||
@FXML
|
||||
public TableColumn<Nurse, String> columnDeleteDate;
|
||||
|
||||
private final ObservableList<Nurse> nurses = FXCollections.observableArrayList();
|
||||
private NurseDao dao;
|
||||
|
||||
public void initialize(){
|
||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
|
||||
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
||||
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
this.columnSurName.setCellValueFactory(new PropertyValueFactory<>("surName"));
|
||||
this.columnSurName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
this.columnDeleteDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
||||
this.columnDeleteDate.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
// this.tableView.setItems(this.nurses);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void handleDelete(){
|
||||
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null){
|
||||
try {
|
||||
DaoFactory.getInstance().createNurseDAO().delete(selectedItem.getId());
|
||||
this.tableView.getItems().remove(selectedItem);
|
||||
}catch (SQLException exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@FXML
|
||||
public void changeLockStatus(){
|
||||
Nurse selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||
if ( !selectedItem.getisLocked()){
|
||||
selectedItem.setLocked(true);
|
||||
} else if (selectedItem.getisLocked()) {
|
||||
selectedItem.setLocked(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package de.hitec.nhplus.nurse;
|
||||
|
||||
import de.hitec.nhplus.main.Person;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
|
@ -10,8 +9,6 @@ import java.util.StringJoiner;
|
|||
public class Nurse extends Person {
|
||||
private SimpleIntegerProperty id;
|
||||
private final SimpleStringProperty phoneNumber;
|
||||
private boolean isLocked;
|
||||
|
||||
|
||||
public Nurse(
|
||||
String firstName,
|
||||
|
@ -20,7 +17,6 @@ public class Nurse extends Person {
|
|||
) {
|
||||
super(firstName, surName);
|
||||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
this.isLocked = false;
|
||||
}
|
||||
|
||||
public Nurse(
|
||||
|
@ -32,7 +28,6 @@ public class Nurse extends Person {
|
|||
super(firstName, surName);
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
this.isLocked = false;
|
||||
}
|
||||
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
|
@ -54,15 +49,6 @@ public class Nurse extends Person {
|
|||
public SimpleStringProperty phoneNumberProperty() {
|
||||
return phoneNumber;
|
||||
}
|
||||
public boolean getisLocked() {
|
||||
return isLocked;
|
||||
}
|
||||
public void setLocked(boolean locked) {
|
||||
isLocked = locked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -86,6 +86,4 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
statement.setInt(1, id);
|
||||
return statement;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,13 +17,6 @@
|
|||
<AnchorPane fx:id="treatmentPage"/>
|
||||
</Tab>
|
||||
<Tab fx:id="nurseTab" text="Pfleger">
|
||||
<TabPane fx:id="nurseTabPane">
|
||||
<Tab fx:id="activeNurseTab" text="Pfleger">
|
||||
<AnchorPane fx:id="activeNursePage"/>
|
||||
</Tab>
|
||||
<Tab fx:id="lockedNurseTab" text="Gesperrt">
|
||||
<AnchorPane fx:id="lockedNursePage"/>
|
||||
</Tab>
|
||||
</TabPane>
|
||||
<AnchorPane fx:id="nursePage"/>
|
||||
</Tab>
|
||||
</TabPane>
|
||||
|
|
|
@ -77,11 +77,10 @@
|
|||
text="Hinzufügen"
|
||||
/>
|
||||
<Button
|
||||
fx:id="buttonLock"
|
||||
fx:id="buttonDelete"
|
||||
mnemonicParsing="false"
|
||||
onAction="#handleLock"
|
||||
prefWidth="90.0"
|
||||
text="Sperren"
|
||||
text="Löschen"
|
||||
/>
|
||||
</HBox>
|
||||
</right>
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<BorderPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="de.hitec.nhplus.nurse.LockedNurseController"
|
||||
>
|
||||
<padding>
|
||||
<Insets top="8" left="8" right="8" bottom="8"/>
|
||||
</padding>
|
||||
<center>
|
||||
<TableView fx:id="tableView" layoutX="31.0" layoutY="40">
|
||||
<columns>
|
||||
<TableColumn
|
||||
fx:id="columnId"
|
||||
minWidth="40.0"
|
||||
text="ID"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnSurName"
|
||||
minWidth="140.0"
|
||||
text="Nachname"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnFirstName"
|
||||
minWidth="140.0"
|
||||
text="Vorname"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnDeleteDate"
|
||||
minWidth="140.0"
|
||||
text="Löschen ab"
|
||||
/>
|
||||
|
||||
</columns>
|
||||
<columnResizePolicy>
|
||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
|
||||
</columnResizePolicy>
|
||||
</TableView>
|
||||
</center>
|
||||
<bottom>
|
||||
<BorderPane>
|
||||
<BorderPane.margin>
|
||||
<Insets top="8.0"/>
|
||||
</BorderPane.margin>
|
||||
<center>
|
||||
<HBox spacing="8.0">
|
||||
<padding>
|
||||
<Insets right="8.0"/>
|
||||
</padding>
|
||||
</HBox>
|
||||
</center>
|
||||
<right>
|
||||
<HBox>
|
||||
<spacing>8.0</spacing>
|
||||
|
||||
<Button
|
||||
fx:id="buttonDelete"
|
||||
mnemonicParsing="false"
|
||||
onAction="#handleDelete"
|
||||
prefWidth="90.0"
|
||||
text="Löschen"
|
||||
/>
|
||||
<Button
|
||||
fx:id="buttonUnlock"
|
||||
mnemonicParsing="false"
|
||||
onAction="#changeLockStatus"
|
||||
prefWidth="90.0"
|
||||
text="Entsperren"
|
||||
/>
|
||||
</HBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</bottom>
|
||||
</BorderPane>
|
Loading…
Reference in a new issue