refactor: bind croplist in schedule
This commit is contained in:
parent
2f69c48800
commit
3a69119eb7
|
@ -90,10 +90,12 @@ public class MyGardenController {
|
|||
Label label = new Label(plant.name());
|
||||
label.setMaxWidth(2000);
|
||||
HBox.setHgrow(label, Priority.ALWAYS);
|
||||
|
||||
Button details = new Button("Details");
|
||||
Button delete = new Button("delete");
|
||||
details.setOnAction(getGoToCropDetailEvent(crop));
|
||||
delete.setOnAction(getDeleteCropEvent(crop));
|
||||
|
||||
hBox.getChildren().addAll(imageView, label, details, delete);
|
||||
return hBox;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
|||
import ch.zhaw.gartenverwaltung.types.Crop;
|
||||
import ch.zhaw.gartenverwaltung.types.Plant;
|
||||
import ch.zhaw.gartenverwaltung.types.Task;
|
||||
import javafx.beans.property.ListProperty;
|
||||
import javafx.beans.property.SimpleListProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
|
@ -37,8 +34,6 @@ public class MyScheduleController {
|
|||
@Inject
|
||||
private PlantList plantList;
|
||||
|
||||
private final ListProperty<Crop> cropListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||
|
||||
@FXML
|
||||
private Label day1_label;
|
||||
|
||||
|
@ -90,15 +85,8 @@ public class MyScheduleController {
|
|||
@AfterInject
|
||||
@SuppressWarnings("unused")
|
||||
public void init() {
|
||||
List<Crop> cropList;
|
||||
try {
|
||||
cropList = garden.getCrops();
|
||||
cropListProperty.addAll(cropList);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setCellFactoryListView();
|
||||
scheduledPlants_listview.itemsProperty().bind(cropListProperty);
|
||||
scheduledPlants_listview.itemsProperty().bind(garden.getPlantedCrops());
|
||||
lookForSelectedListEntries();
|
||||
setDayLabels();
|
||||
information_label.setText("");
|
||||
|
|
Loading…
Reference in New Issue