Compare commits

..

No commits in common. "700aba10b71c9b3bd86dbd795946081e71445f84" and "e4793780fd5540fa23617962d300ba740801410d" have entirely different histories.

3 changed files with 5 additions and 54 deletions

View file

@ -106,17 +106,6 @@ public class AllNurseController {
this.textFieldPhoneNumber.clear(); this.textFieldPhoneNumber.clear();
} }
/**
* Internal method that stores the changes in the database.
*/
private void doUpdate(TableColumn.CellEditEvent<Nurse, String> event) {
try {
this.dao.update(event.getRowValue());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML @FXML
public void handleAdd(){ public void handleAdd(){
String surname=this.textFieldSurName.getText(); String surname=this.textFieldSurName.getText();
@ -148,39 +137,4 @@ public class AllNurseController {
readAllAndShowInTableView(); readAllAndShowInTableView();
} }
@FXML
public void handleOnEditSurname(TableColumn.CellEditEvent<Nurse, String> event) {
String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) {
showValidationError("Nachname");
event.getTableView().refresh();
return;
}
event.getRowValue().setSurName(newSurName);
this.doUpdate(event);
}
@FXML
public void handleOnEditFirstname(TableColumn.CellEditEvent<Nurse, String> event) {
String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) {
showValidationError("Vorname");
event.getTableView().refresh();
return;
}
event.getRowValue().setFirstName(newFirstName);
this.doUpdate(event);
}
@FXML
public void handleOnEditPhoneNumber(TableColumn.CellEditEvent<Nurse, String> event) {
String newPhoneNumber = event.getNewValue();
if (!isValidPhoneNumber(newPhoneNumber)) {
showValidationError("Telefonnummer");
event.getTableView().refresh();
return;
}
event.getRowValue().setPhoneNumber(newPhoneNumber);
this.doUpdate(event);
}
} }

View file

@ -154,7 +154,7 @@ public class AllPatientController {
public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) {
String newFirstName = event.getNewValue(); String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) { if (!isValidFirstName(newFirstName)) {
showValidationError("Vorname"); showValidationError("First Name");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -166,7 +166,7 @@ public class AllPatientController {
public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) {
String newSurName = event.getNewValue(); String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) { if (!isValidSurName(newSurName)) {
showValidationError("Nachname"); showValidationError("Sur Name");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -178,7 +178,7 @@ public class AllPatientController {
public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) {
String newDateString = event.getNewValue(); String newDateString = event.getNewValue();
if (!isValidDate(newDateString)) { if (!isValidDate(newDateString)) {
showValidationError("Geburtstag"); showValidationError("Date");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -190,7 +190,7 @@ public class AllPatientController {
public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) {
String newCareLevel = event.getNewValue(); String newCareLevel = event.getNewValue();
if (!isValidCareLevel(newCareLevel)) { if (!isValidCareLevel(newCareLevel)) {
showValidationError("Pflegegrad"); showValidationError("Care Level");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -202,7 +202,7 @@ public class AllPatientController {
public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event) {
String newRoomNumber = event.getNewValue(); String newRoomNumber = event.getNewValue();
if (!isValidRoomNumber(newRoomNumber)) { if (!isValidRoomNumber(newRoomNumber)) {
showValidationError("Raum"); showValidationError("Room Number");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }

View file

@ -22,19 +22,16 @@
<TableColumn <TableColumn
fx:id="columnSurName" fx:id="columnSurName"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditSurname"
text="Nachname" text="Nachname"
/> />
<TableColumn <TableColumn
fx:id="columnFirstName" fx:id="columnFirstName"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditFirstname"
text="Vorname" text="Vorname"
/> />
<TableColumn <TableColumn
fx:id="columnPhoneNumber" fx:id="columnPhoneNumber"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditPhoneNumber"
text="Telefonnummer" text="Telefonnummer"
/> />
</columns> </columns>