Compare commits
No commits in common. "e4c48d568e763383d88443ad2f6363fb8184d74c" and "f4b51c0749472147b2c0caa4a4508c59320d9135" have entirely different histories.
e4c48d568e
...
f4b51c0749
6 changed files with 77 additions and 131 deletions
|
@ -28,7 +28,7 @@ public class AllNurseController {
|
|||
private NurseDao dao;
|
||||
|
||||
public void initialize() {
|
||||
this.readAllAndShowInTableView();
|
||||
this.readAllAndSHowInTableView();
|
||||
|
||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("nid"));
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class AllNurseController {
|
|||
this.tableView.setItems(this.nurses);
|
||||
}
|
||||
|
||||
private void readAllAndShowInTableView(){
|
||||
private void readAllAndSHowInTableView(){
|
||||
this.nurses.clear();
|
||||
this.dao = DaoFactory.getDaoFactory().createNurseDAO();
|
||||
try {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package de.hitec.nhplus.nurse;
|
||||
|
||||
import de.hitec.nhplus.main.Person;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleLongProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
public class Nurse extends Person {
|
||||
private SimpleIntegerProperty id;
|
||||
private SimpleLongProperty nid;
|
||||
private final SimpleStringProperty phoneNumber;
|
||||
|
||||
public Nurse(
|
||||
|
@ -18,13 +18,13 @@ public class Nurse extends Person {
|
|||
}
|
||||
|
||||
public Nurse(
|
||||
int id,
|
||||
long nid,
|
||||
String firstName,
|
||||
String surname,
|
||||
String phoneNumber
|
||||
) {
|
||||
super(firstName, surname);
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.nid = new SimpleLongProperty(nid);
|
||||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ public class Nurse extends Person {
|
|||
this.phoneNumber.set(phoneNumber);
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id.get();
|
||||
public long getNid() {
|
||||
return nid.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty idProperty() {
|
||||
return id;
|
||||
public SimpleLongProperty nidProperty() {
|
||||
return nid;
|
||||
}
|
||||
|
||||
public String getPhoneNumber() {
|
||||
|
@ -47,15 +47,4 @@ public class Nurse extends Person {
|
|||
public SimpleStringProperty phoneNumberProperty() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()
|
||||
.append("Nurse").append(System.lineSeparator())
|
||||
.append("Firstname: ").append(this.getFirstName()).append(System.lineSeparator())
|
||||
.append("Surname: ").append(this.getSurname()).append(System.lineSeparator())
|
||||
.append("PhoneNumber: ").append(this.getPhoneNumber()).append(System.lineSeparator())
|
||||
.toString();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected PreparedStatement getReadByIDStatement(int id) {
|
||||
protected PreparedStatement getReadByIDStatement(int nid) {
|
||||
PreparedStatement preparedStatement = null;
|
||||
try {
|
||||
final String SQL = "SELECT * FROM nurse WHERE id = ?";
|
||||
final String SQL = "SELECT * FROM nurse WHERE nid = ?";
|
||||
preparedStatement = this.connection.prepareStatement(SQL);
|
||||
preparedStatement.setInt(1, id);
|
||||
preparedStatement.setInt(1, nid);
|
||||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
@Override
|
||||
protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException {
|
||||
return new Nurse(
|
||||
result.getInt(1),
|
||||
result.getLong(1),
|
||||
result.getString(2),
|
||||
result.getString(3),
|
||||
result.getString(4)
|
||||
|
@ -88,12 +88,12 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
"firstname = ?, " +
|
||||
"surname = ?, " +
|
||||
"phoneNumber = ?, " +
|
||||
"WHERE id = ?";
|
||||
"WHERE nid = ?";
|
||||
preparedStatement = this.connection.prepareStatement(SQL);
|
||||
preparedStatement.setString(1, nurse.getFirstName());
|
||||
preparedStatement.setString(2, nurse.getSurname());
|
||||
preparedStatement.setString(3, nurse.getPhoneNumber());
|
||||
preparedStatement.setLong(4, nurse.getId());
|
||||
preparedStatement.setLong(4, nurse.getNid());
|
||||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
@ -101,12 +101,12 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected PreparedStatement getDeleteStatement(int id) {
|
||||
protected PreparedStatement getDeleteStatement(int nid) {
|
||||
PreparedStatement preparedStatement = null;
|
||||
try {
|
||||
final String SQL = "DELETE FROM nurse WHERE id = ?";
|
||||
final String SQL = "DELETE FROM nurse WHERE nid = ?";
|
||||
preparedStatement = this.connection.prepareStatement(SQL);
|
||||
preparedStatement.setInt(1, id);
|
||||
preparedStatement.setInt(1, nid);
|
||||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -3,86 +3,42 @@
|
|||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<BorderPane
|
||||
xmlns="http://javafx.com/javafx/11.0.1"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="de.hitec.nhplus.nurse.AllNurseController"
|
||||
>
|
||||
<padding>
|
||||
<Insets top="8" left="8" right="8" bottom="8"/>
|
||||
</padding>
|
||||
<center>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<BorderPane 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.nurse.AllNurseController">
|
||||
<children>
|
||||
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0">
|
||||
<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="columnPhoneNumber"
|
||||
minWidth="140.0"
|
||||
text="Telefonnummer"
|
||||
/>
|
||||
<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>
|
||||
</center>
|
||||
<bottom>
|
||||
<BorderPane>
|
||||
<BorderPane.margin>
|
||||
<Insets top="8.0"/>
|
||||
</BorderPane.margin>
|
||||
<center>
|
||||
<HBox spacing="8.0">
|
||||
<HBox layoutX="420.0" layoutY="450.0" spacing="10.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">
|
||||
<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 right="8.0"/>
|
||||
<Insets top="10.0"/>
|
||||
</padding>
|
||||
<TextField
|
||||
fx:id="textFieldSurname"
|
||||
prefWidth="200.0"
|
||||
promptText="Nachname"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldFirstname"
|
||||
prefWidth="200.0"
|
||||
promptText="Vorname"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldPhoneNumber"
|
||||
prefWidth="200.0"
|
||||
promptText="Telefonnummer"
|
||||
/>
|
||||
</HBox>
|
||||
</center>
|
||||
<right>
|
||||
<HBox spacing="8.0">
|
||||
<Button
|
||||
fx:id="buttonAdd"
|
||||
mnemonicParsing="false"
|
||||
prefWidth="90.0"
|
||||
text="Hinzufügen"
|
||||
/>
|
||||
<Button
|
||||
fx:id="buttonDelete"
|
||||
mnemonicParsing="false"
|
||||
prefWidth="90.0"
|
||||
text="Löschen"
|
||||
/>
|
||||
</HBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
|
|
|
@ -78,42 +78,42 @@
|
|||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||
</rowConstraints>
|
||||
<!-- Row 0-->
|
||||
<TextField
|
||||
GridPane.rowIndex="0"
|
||||
GridPane.columnIndex="0"
|
||||
prefWidth="200.0"
|
||||
fx:id="textFieldFirstName"
|
||||
minWidth="200.0"
|
||||
prefHeight="26.0"
|
||||
prefWidth="200.0"
|
||||
promptText="Vorname"
|
||||
/>
|
||||
<TextField
|
||||
GridPane.rowIndex="0"
|
||||
GridPane.columnIndex="1"
|
||||
prefWidth="200.0"
|
||||
fx:id="textFieldSurname"
|
||||
minWidth="200.0"
|
||||
prefHeight="26.0"
|
||||
prefWidth="200.0"
|
||||
promptText="Nachname"
|
||||
/>
|
||||
<TextField
|
||||
GridPane.rowIndex="0"
|
||||
GridPane.columnIndex="2"
|
||||
prefWidth="200.0"
|
||||
fx:id="textFieldDateOfBirth"
|
||||
promptText="Geburtstag"
|
||||
/>
|
||||
<!-- Row 1-->
|
||||
<TextField
|
||||
GridPane.rowIndex="1"
|
||||
GridPane.columnIndex="0"
|
||||
prefWidth="200.0"
|
||||
fx:id="textFieldCareLevel"
|
||||
promptText="Pflegegrad"
|
||||
/>
|
||||
<TextField
|
||||
GridPane.rowIndex="1"
|
||||
GridPane.columnIndex="1"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldDateOfBirth"
|
||||
minWidth="160.0"
|
||||
prefWidth="160.0"
|
||||
promptText="Geburtstag"
|
||||
GridPane.columnIndex="2"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldCareLevel"
|
||||
prefHeight="26.0"
|
||||
prefWidth="200.0"
|
||||
promptText="Pflegegrad"
|
||||
GridPane.rowIndex="1"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldRoomNumber"
|
||||
prefHeight="26.0"
|
||||
prefWidth="200.0"
|
||||
promptText="Raum"
|
||||
GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="1"
|
||||
/>
|
||||
</GridPane>
|
||||
</center>
|
||||
|
|
|
@ -65,8 +65,9 @@
|
|||
<HBox spacing="8.0">
|
||||
<ComboBox
|
||||
fx:id="comboBoxPatientSelection"
|
||||
prefWidth="200.0"
|
||||
minWidth="160.0"
|
||||
onAction="#handleComboBox"
|
||||
prefWidth="200.0"
|
||||
/>
|
||||
<Button
|
||||
mnemonicParsing="false"
|
||||
|
|
Loading…
Reference in a new issue