diff --git a/src/main/java/ch/zhaw/gartenverwaltung/MyGardenController.java b/src/main/java/ch/zhaw/gartenverwaltung/MyGardenController.java index f69ec9d..d223a8e 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/MyGardenController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/MyGardenController.java @@ -19,6 +19,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; @@ -99,7 +100,6 @@ public class MyGardenController { * @throws IOException exception */ private HBox createHBoxForListView(Crop crop) throws HardinessZoneNotSetException, IOException { - //ToDo add better design Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get(); HBox hBox = new HBox(10); ImageView imageView = new ImageView(); @@ -112,8 +112,23 @@ public class MyGardenController { } hBox.setMinHeight(100); Label label = new Label(plant.name()); - label.setMaxWidth(2000); - HBox.setHgrow(label, Priority.ALWAYS); + label.setMinWidth(100); + + VBox vbox = new VBox(10); + HBox startDateHBox = new HBox(10); + Label startDateDescription = new Label("Start Date:"); + startDateDescription.setMinWidth(75); + Label startDate = new Label(crop.getStartDate().toString()); + startDateHBox.getChildren().addAll(startDateDescription, startDate); + HBox endDateHBox = new HBox(10); + Label endDateDescription = new Label("End Date:"); + endDateDescription.setMinWidth(75); + Label endDate = new Label(crop.getStartDate().plusDays(plant.timeToHarvest(0)).toString()); + endDateHBox.getChildren().addAll(endDateDescription, endDate); + vbox.getChildren().addAll(startDateHBox, endDateHBox); + + vbox.setMaxWidth(2000); + HBox.setHgrow(vbox, Priority.ALWAYS); Button details = new Button(); Button delete = new Button(); @@ -125,7 +140,7 @@ public class MyGardenController { details.setOnAction(getGoToCropDetailEvent(crop)); delete.setOnAction(getDeleteCropEvent(crop)); - hBox.getChildren().addAll(imageView, label, details, delete); + hBox.getChildren().addAll(imageView, label, vbox, details, delete); return hBox; }