update plant information plant fxml file
This commit is contained in:
parent
2963872237
commit
ee67c83b22
|
@ -41,7 +41,6 @@ public class PlantsController {
|
||||||
private Plant selectedPlant = null;
|
private Plant selectedPlant = null;
|
||||||
private final HardinessZone DEFAULT_HARDINESS_ZONE = HardinessZone.ZONE_8A;
|
private final HardinessZone DEFAULT_HARDINESS_ZONE = HardinessZone.ZONE_8A;
|
||||||
|
|
||||||
// TODO: move to model
|
|
||||||
private final ListProperty<Plant> plantListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
private final ListProperty<Plant> plantListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -269,7 +268,7 @@ public class PlantsController {
|
||||||
list_plants.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
list_plants.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
selectedPlant = newValue;
|
selectedPlant = newValue;
|
||||||
description_plant.setText(selectedPlant.description());
|
description_plant.setText(getPlantDescription());
|
||||||
selectSowDay_button.setDisable(false);
|
selectSowDay_button.setDisable(false);
|
||||||
Image img1;
|
Image img1;
|
||||||
if (selectedPlant.image() != null) {
|
if (selectedPlant.image() != null) {
|
||||||
|
@ -288,6 +287,20 @@ public class PlantsController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates {@link String} of the plant information.
|
||||||
|
* @return return {@link Plant} description
|
||||||
|
*/
|
||||||
|
private String getPlantDescription() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Name: ").append(selectedPlant.name())
|
||||||
|
.append("\nDescription:\n").append(selectedPlant.description())
|
||||||
|
.append("\nLight Level: ").append(selectedPlant.light())
|
||||||
|
.append("\nSoil: ").append(selectedPlant.soil())
|
||||||
|
.append("\nSpacing: ").append(selectedPlant.spacing());
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clears the ListView of entries
|
* clears the ListView of entries
|
||||||
|
|
Loading…
Reference in New Issue