display List of Crops, get detail of crop and display taskList
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package ch.zhaw.gartenverwaltung;
|
||||
|
||||
import ch.zhaw.gartenverwaltung.gardenplan.Gardenplanmodel;
|
||||
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
||||
import ch.zhaw.gartenverwaltung.plantList.PlantListModel;
|
||||
import ch.zhaw.gartenverwaltung.taskList.TaskListModel;
|
||||
import ch.zhaw.gartenverwaltung.types.Crop;
|
||||
import ch.zhaw.gartenverwaltung.types.Task;
|
||||
@@ -28,6 +30,7 @@ public class MyScheduleController implements Initializable {
|
||||
private Crop selectedCrop = null;
|
||||
private final TaskListModel taskListModel = new TaskListModel();
|
||||
private final Gardenplanmodel gardenplanmodel = new Gardenplanmodel(taskListModel);
|
||||
private final PlantListModel plantListModel = new PlantListModel();
|
||||
|
||||
private final ListProperty<Crop> cropListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||
|
||||
@@ -84,7 +87,6 @@ public class MyScheduleController implements Initializable {
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
//ToDo method to load crop list
|
||||
List<Crop> cropList;
|
||||
try {
|
||||
cropList = gardenplanmodel.getCrops();
|
||||
@@ -138,7 +140,11 @@ public class MyScheduleController implements Initializable {
|
||||
if (empty || crop == null) {
|
||||
setText(null);
|
||||
} else {
|
||||
setText("placeholder");
|
||||
try {
|
||||
setText(plantListModel.getFilteredPlantListById(Config.getCurrentHardinessZone(), crop.getPlantId()).get(0).name());
|
||||
} catch (HardinessZoneNotSetException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -146,11 +152,10 @@ public class MyScheduleController implements Initializable {
|
||||
|
||||
private void loadTaskList() throws IOException {
|
||||
List<List<Task>> taskLists = new LinkedList<>();
|
||||
//ToDo uncomment, when error from JsonTaskDatabase.java loadTaskListFromFile() is fixed.
|
||||
if (selectedCrop != null) {
|
||||
//taskLists = taskListModel.getTasksUpcomingWeekForCrop(selectedCrop.getCropId().get());
|
||||
taskLists = taskListModel.getTasksUpcomingWeekForCrop(selectedCrop.getCropId().get());
|
||||
} else {
|
||||
//taskLists = taskListModel.getTasksUpcomingWeek();
|
||||
taskLists = taskListModel.getTasksUpcomingWeek();
|
||||
}
|
||||
if (!taskLists.isEmpty()) {
|
||||
viewTaskListOfDay(day1_pane, taskLists.get(0));
|
||||
@@ -167,7 +172,7 @@ public class MyScheduleController implements Initializable {
|
||||
//ToDo update pane with task list
|
||||
VBox vBox = new VBox();
|
||||
for (Task task : tasks) {
|
||||
Label label = new Label("placeholder");
|
||||
Label label = new Label(task.getDescription());
|
||||
vBox.getChildren().add(label);
|
||||
}
|
||||
pane.getChildren().add(vBox);
|
||||
|
||||
Reference in New Issue
Block a user