small change garden plant description

This commit is contained in:
giavaphi 2022-12-11 16:23:05 +01:00
parent 2dd8cffda2
commit a519393fc7
1 changed files with 19 additions and 4 deletions

View File

@ -19,6 +19,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority; import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -99,7 +100,6 @@ public class MyGardenController {
* @throws IOException exception * @throws IOException exception
*/ */
private HBox createHBoxForListView(Crop crop) throws HardinessZoneNotSetException, IOException { private HBox createHBoxForListView(Crop crop) throws HardinessZoneNotSetException, IOException {
//ToDo add better design
Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get(); Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
HBox hBox = new HBox(10); HBox hBox = new HBox(10);
ImageView imageView = new ImageView(); ImageView imageView = new ImageView();
@ -112,8 +112,23 @@ public class MyGardenController {
} }
hBox.setMinHeight(100); hBox.setMinHeight(100);
Label label = new Label(plant.name()); Label label = new Label(plant.name());
label.setMaxWidth(2000); label.setMinWidth(100);
HBox.setHgrow(label, Priority.ALWAYS);
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 details = new Button();
Button delete = new Button(); Button delete = new Button();
@ -125,7 +140,7 @@ public class MyGardenController {
details.setOnAction(getGoToCropDetailEvent(crop)); details.setOnAction(getGoToCropDetailEvent(crop));
delete.setOnAction(getDeleteCropEvent(crop)); delete.setOnAction(getDeleteCropEvent(crop));
hBox.getChildren().addAll(imageView, label, details, delete); hBox.getChildren().addAll(imageView, label, vbox, details, delete);
return hBox; return hBox;
} }