Compare commits
1 commit
2bd06fab41
...
c303e45af3
Author | SHA1 | Date | |
---|---|---|---|
c303e45af3 |
9 changed files with 66 additions and 157 deletions
Binary file not shown.
|
@ -1,59 +0,0 @@
|
||||||
package de.hitec.nhplus.controller;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
|
||||||
import de.hitec.nhplus.datastorage.NurseDao;
|
|
||||||
import de.hitec.nhplus.model.Nurse;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class AllNurseController {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TableView<Nurse> tableView;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<Nurse, Long> columnId;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<Nurse, String> columnFirstName;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<Nurse, String> columnSurname;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<Nurse, String> columnPhoneNumber;
|
|
||||||
|
|
||||||
private final ObservableList<Nurse> nurses = FXCollections.observableArrayList();
|
|
||||||
private NurseDao dao;
|
|
||||||
|
|
||||||
public void initialize() {
|
|
||||||
this.readAllAndSHowInTableView();
|
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("nid"));
|
|
||||||
|
|
||||||
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
|
||||||
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
|
||||||
|
|
||||||
this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname"));
|
|
||||||
this.columnSurname.setCellFactory(TextFieldTableCell.forTableColumn());
|
|
||||||
|
|
||||||
|
|
||||||
this.columnPhoneNumber.setCellValueFactory(new PropertyValueFactory<>("phoneNumber"));
|
|
||||||
this.columnPhoneNumber.setCellFactory(TextFieldTableCell.forTableColumn());
|
|
||||||
|
|
||||||
this.tableView.setItems(this.nurses);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readAllAndSHowInTableView(){
|
|
||||||
this.nurses.clear();
|
|
||||||
this.dao = DaoFactory.getDaoFactory().createNurseDAO();
|
|
||||||
try {
|
|
||||||
this.nurses.addAll(this.dao.readAll());
|
|
||||||
}catch (SQLException exception){
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -36,14 +36,4 @@ public class MainWindowController {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
|
||||||
private void handleShowAllNurses(ActionEvent event){
|
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/AllNurseView.fxml"));
|
|
||||||
try {
|
|
||||||
mainBorderPane.setCenter(loader.load());
|
|
||||||
}catch (IOException exception){
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class NurseDao extends DaoImp<Nurse> {
|
||||||
protected PreparedStatement getCreateStatement(Nurse nurse) {
|
protected PreparedStatement getCreateStatement(Nurse nurse) {
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
try {
|
try {
|
||||||
final String SQL = "INSERT INTO nurse (firstname, surname, phoneNumber)" +
|
final String SQL = "INSERT INTO patient (firstname, surname, phoneNumber)" +
|
||||||
"VALUES (?, ?, ?)";
|
"VALUES (?, ?, ?)";
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
preparedStatement.setString(1, nurse.getFirstName());
|
preparedStatement.setString(1, nurse.getFirstName());
|
||||||
|
|
|
@ -23,12 +23,6 @@ public class Fixtures
|
||||||
treatmentFixture.dropTable(connection);
|
treatmentFixture.dropTable(connection);
|
||||||
treatmentFixture.setupTable(connection);
|
treatmentFixture.setupTable(connection);
|
||||||
treatmentFixture.load();
|
treatmentFixture.load();
|
||||||
|
|
||||||
NurseFixture nurseFixture = new NurseFixture();
|
|
||||||
nurseFixture.dropTable(connection);
|
|
||||||
nurseFixture.setupTable(connection);
|
|
||||||
nurseFixture.load();
|
|
||||||
|
|
||||||
} catch (Exception exception){
|
} catch (Exception exception){
|
||||||
System.out.println(exception.getMessage());
|
System.out.println(exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class NurseFixture implements Fixture<Nurse> {
|
||||||
@Override
|
@Override
|
||||||
public void setupTable(Connection connection) {
|
public void setupTable(Connection connection) {
|
||||||
final String SQL = "CREATE TABLE IF NOT EXISTS nurse (" +
|
final String SQL = "CREATE TABLE IF NOT EXISTS nurse (" +
|
||||||
"tid INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
"nid BIGINT PRIMARY KEY AUTOINCREMENT, " +
|
||||||
"firstname TEXT NOT NULL, " +
|
"firstname TEXT NOT NULL, " +
|
||||||
"surname TEXT NOT NULL, " +
|
"surname TEXT NOT NULL, " +
|
||||||
"phoneNumber TEXT NOT NULL" +
|
"phoneNumber TEXT NOT NULL" +
|
||||||
|
|
43
src/main/resources/de/hitec/nhplus/AllCaregiverView.fxml
Normal file
43
src/main/resources/de/hitec/nhplus/AllCaregiverView.fxml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
|
|
||||||
|
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<children>
|
||||||
|
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
|
||||||
|
<columns>
|
||||||
|
<TableColumn fx:id="colID" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID" />
|
||||||
|
<TableColumn fx:id="colSurname" maxWidth="7500.0" minWidth="20.0" prefWidth="100.0" text="Nachname" />
|
||||||
|
<TableColumn fx:id="colFirstName" maxWidth="7500.0" prefWidth="75.0" text="Vorname" />
|
||||||
|
<TableColumn fx:id="colTelephone" maxWidth="7500.0" prefWidth="75.0" text="Telefon" />
|
||||||
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||||
|
</columnResizePolicy>
|
||||||
|
</TableView>
|
||||||
|
<HBox layoutX="420.0" layoutY="450.0" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
|
||||||
|
<children>
|
||||||
|
<TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname" />
|
||||||
|
<TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname" />
|
||||||
|
<TextField fx:id="txfTelephone" prefWidth="160.0" promptText="Telefonnummer" />
|
||||||
|
<Button fx:id="btnAdd" mnemonicParsing="false" prefWidth="90.0" text="Hinzufügen" />
|
||||||
|
<Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
|
||||||
|
<children>
|
||||||
|
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Pfleger/innen" textAlignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="36.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
<padding>
|
||||||
|
<Insets top="10.0" />
|
||||||
|
</padding>
|
||||||
|
</AnchorPane>
|
|
@ -1,47 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.AllNurseController">
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0" AnchorPane.bottomAnchor="70.0"
|
|
||||||
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="columnId" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID"/>
|
|
||||||
<TableColumn fx:id="columnSurname" maxWidth="7500.0" minWidth="20.0" prefWidth="100.0" text="Nachname"/>
|
|
||||||
<TableColumn fx:id="columnFirstName" maxWidth="7500.0" prefWidth="75.0" text="Vorname"/>
|
|
||||||
<TableColumn fx:id="columnPhoneNumber" maxWidth="7500.0" prefWidth="75.0" text="Telefonnummer"/>
|
|
||||||
</columns>
|
|
||||||
<columnResizePolicy>
|
|
||||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
|
|
||||||
</columnResizePolicy>
|
|
||||||
</TableView>
|
|
||||||
<HBox layoutX="420.0" layoutY="450.0" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0"
|
|
||||||
AnchorPane.rightAnchor="15.0">
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname"/>
|
|
||||||
<TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname"/>
|
|
||||||
<TextField fx:id="txfPhoneNumber" prefWidth="160.0" promptText="Telefonnummer"/>
|
|
||||||
<Button fx:id="btnAdd" mnemonicParsing="false" prefWidth="90.0" text="Hinzufügen"/>
|
|
||||||
<Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen"/>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0"
|
|
||||||
AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Pfleger/innen"
|
|
||||||
textAlignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets top="10.0"/>
|
|
||||||
</padding>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,37 +1,25 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.*?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<BorderPane fx:id="mainBorderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
|
|
||||||
prefHeight="688.0" prefWidth="926.0" xmlns="http://javafx.com/javafx/10.0.2-internal"
|
<BorderPane fx:id="mainBorderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="688.0" prefWidth="926.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.MainWindowController">
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.MainWindowController">
|
<left>
|
||||||
<left>
|
<VBox id="vBox" alignment="CENTER" spacing="50.0" styleClass="vBox" stylesheets="@Application.css" BorderPane.alignment="CENTER">
|
||||||
<VBox id="vBox" alignment="CENTER" spacing="50.0" styleClass="vBox" stylesheets="@Application.css"
|
<children>
|
||||||
BorderPane.alignment="CENTER">
|
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllPatient" prefWidth="105.0" text="Patienten/innen">
|
||||||
<children>
|
<VBox.margin>
|
||||||
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false"
|
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
|
||||||
onAction="#handleShowAllPatient" prefWidth="105.0" text="Patienten/innen">
|
</VBox.margin>
|
||||||
<VBox.margin>
|
<opaqueInsets>
|
||||||
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0"/>
|
<Insets />
|
||||||
</VBox.margin>
|
</opaqueInsets></Button>
|
||||||
<opaqueInsets>
|
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllTreatments" prefWidth="105.0" text="Behandlungen">
|
||||||
<Insets/>
|
<VBox.margin>
|
||||||
</opaqueInsets>
|
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
|
||||||
</Button>
|
</VBox.margin></Button>
|
||||||
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false"
|
</children>
|
||||||
onAction="#handleShowAllTreatments" prefWidth="105.0" text="Behandlungen">
|
</VBox>
|
||||||
<VBox.margin>
|
</left>
|
||||||
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</Button>
|
|
||||||
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false"
|
|
||||||
onAction="#handleShowAllNurses" prefWidth="105.0" text="Pfleger/innen">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0"/>
|
|
||||||
</VBox.margin>
|
|
||||||
</Button>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</left>
|
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
|
Loading…
Reference in a new issue