refactor: annotation-based dependency-injection

This commit is contained in:
David Guler
2022-11-14 21:15:27 +01:00
parent 15279838b7
commit 5ef3f6c587
9 changed files with 188 additions and 139 deletions
@@ -1,5 +1,6 @@
package ch.zhaw.gartenverwaltung;
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.models.Garden;
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
@@ -9,7 +10,6 @@ import ch.zhaw.gartenverwaltung.types.Crop;
import ch.zhaw.gartenverwaltung.types.Pest;
import ch.zhaw.gartenverwaltung.types.Plant;
import ch.zhaw.gartenverwaltung.types.Task;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
@@ -26,18 +26,16 @@ import java.util.logging.Logger;
public class CropDetailController {
private Crop crop;
@Inject
private PlantList plantList;
@Inject
private GardenSchedule gardenSchedule;
@Inject
private Garden garden;
private static final Logger LOG = Logger.getLogger(CropDetailController.class.getName());
@SuppressWarnings("unused")
public void injectDependencies(Garden garden, PlantList plantList, GardenSchedule gardenSchedule) {
this.garden = garden;
this.plantList = plantList;
this.gardenSchedule = gardenSchedule;
}
@FXML
private ImageView imageView;
@@ -75,23 +73,23 @@ public class CropDetailController {
private Label spacing_label;
@FXML
void editTaskList(ActionEvent event) {
void editTaskList() {
}
@FXML
void goBack(ActionEvent event) {
void goBack() {
Stage stage = (Stage) imageView.getScene().getWindow();
stage.close();
}
@FXML
void setArea(ActionEvent event) {
void setArea() {
}
@FXML
void setLocation(ActionEvent event) {
void setLocation() {
}