fixed childview
This commit is contained in:
parent
a7b192f256
commit
a03a294260
@ -26,4 +26,9 @@ public class Allergy {
|
||||
public String getHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
@ -26,4 +26,9 @@ public class AllergySeverity {
|
||||
public String getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getAllergy().getName() + " (" + getSeverity() + ")";
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
package com.bib.essensbestellungsverwaltung;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
@ -35,6 +37,7 @@ public class ChildViewController implements Initializable {
|
||||
//public TextField allergies;
|
||||
@FXML
|
||||
public ListView allergiesList;
|
||||
ObservableList olAllergiesList;
|
||||
@FXML
|
||||
public ComboBox selectAllergy;
|
||||
@FXML
|
||||
@ -71,17 +74,21 @@ public class ChildViewController implements Initializable {
|
||||
if(childData) {
|
||||
|
||||
|
||||
Address adress = new Address(streetString, numberString, plzString, cityString);
|
||||
Address adress = AccountMgr.currentUser.getAddress();
|
||||
|
||||
List<Allergy> childAllergyList = allergiesList.getItems();
|
||||
var olChildAllergyList = allergiesList.getItems();
|
||||
List<AllergySeverity> childAllergyList = new ArrayList<>();
|
||||
for (var o : olChildAllergyList) {
|
||||
childAllergyList.add((AllergySeverity) o);
|
||||
}
|
||||
ArrayList<AllergySeverity> allergySeverityArrayList = new ArrayList<>();
|
||||
|
||||
/*for (Allergy a : childAllergyList) {
|
||||
/*for (AllergySeverity a : childAllergyList) {
|
||||
AllergySeverity aS = new AllergySeverity(a, )
|
||||
}*/ //Allergy Severity doesn't work in my case so the List will be left empty for now
|
||||
} */ //Allergy Severity doesn't work in my case so the List will be left empty for now
|
||||
|
||||
|
||||
Child child = new Child(childLastname, childName, adress, allergySeverityArrayList);
|
||||
Child child = new Child(childLastname, childName, adress, childAllergyList);
|
||||
|
||||
System.out.println(AccountMgr.createChild(child));
|
||||
|
||||
@ -121,9 +128,11 @@ public class ChildViewController implements Initializable {
|
||||
|
||||
|
||||
|
||||
String addedAllergy = selectAllergy.getValue().toString();
|
||||
String addedSeverity = selectAllergySeverity.getValue().toString().split(":")[0];
|
||||
allergiesList.getItems().add(addedAllergy + ":" + addedSeverity);
|
||||
Allergy addedAllergy = (Allergy)selectAllergy.getValue();
|
||||
long addedSeverityId = Long.parseLong(selectAllergySeverity.getValue().toString().split(":")[0]);
|
||||
String addedSeverity = selectAllergySeverity.getValue().toString().split(":")[1];
|
||||
olAllergiesList.add(new AllergySeverity(addedAllergy,addedSeverityId,addedSeverity));
|
||||
allergiesList.setItems(olAllergiesList);
|
||||
|
||||
|
||||
selectAllergy.setValue("Allergie Wählen");
|
||||
@ -133,8 +142,15 @@ public class ChildViewController implements Initializable {
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
selectAllergy.getItems().addAll(allergyComboBox());
|
||||
ObservableList<Allergy> olAll = FXCollections.observableArrayList(allergyComboBox());
|
||||
selectAllergy.setItems(olAll);
|
||||
//selectAllergy.getItems().addAll(allergyComboBox());
|
||||
olAllergiesList = FXCollections.observableArrayList();
|
||||
|
||||
selectAllergySeverity.getItems().addAll("1:Harmlos","2:Warnung","3:Kritisch");
|
||||
ObservableList olSev = FXCollections.observableArrayList();
|
||||
olSev.add("1:Harmlos");
|
||||
olSev.add("2:Warnung");
|
||||
olSev.add("3:Kritisch");
|
||||
selectAllergySeverity.setItems(olSev);
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@
|
||||
<Insets bottom="15.0" top="15.0" />
|
||||
</VBox.margin>
|
||||
</Text>
|
||||
<ListView prefHeight="101.0" prefWidth="227.0" />
|
||||
<ListView fx:id="allergiesList" prefHeight="101.0" prefWidth="227.0" />
|
||||
<HBox prefHeight="26.0" prefWidth="256.0">
|
||||
<children>
|
||||
<ComboBox fx:id="selectAllergy" prefWidth="150.0" promptText="Allergie wählen" />
|
||||
|
Loading…
Reference in New Issue
Block a user