refactor: annotation-based dependency-injection
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package ch.zhaw.gartenverwaltung;
|
||||
|
||||
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
||||
import ch.zhaw.gartenverwaltung.models.PlantNotFoundException;
|
||||
import ch.zhaw.gartenverwaltung.types.GrowthPhaseType;
|
||||
import ch.zhaw.gartenverwaltung.types.Plant;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
@@ -20,12 +20,9 @@ import java.util.ResourceBundle;
|
||||
|
||||
public class SelectSowDayController implements Initializable {
|
||||
private Plant selectedPlant = null;
|
||||
private Garden garden;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void injectDependencies(Garden garden) {
|
||||
this.garden = garden;
|
||||
}
|
||||
@Inject
|
||||
private Garden garden;
|
||||
|
||||
@FXML
|
||||
private DatePicker datepicker;
|
||||
@@ -41,20 +38,18 @@ public class SelectSowDayController implements Initializable {
|
||||
|
||||
/**
|
||||
* close the date selector window
|
||||
* @param event event
|
||||
*/
|
||||
@FXML
|
||||
void cancel(ActionEvent event) {
|
||||
void cancel() {
|
||||
closeWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* get sow date from datePicker or calculate sow date from harvest date
|
||||
* save selected plant and sow date
|
||||
* @param event event
|
||||
*/
|
||||
@FXML
|
||||
void save(ActionEvent event) throws HardinessZoneNotSetException, IOException, PlantNotFoundException {
|
||||
void save() throws HardinessZoneNotSetException, IOException, PlantNotFoundException {
|
||||
LocalDate sowDate = datepicker.getValue();
|
||||
if (harvest_radio.isSelected()) {
|
||||
//ToDo method to get current lifecycle group in plant
|
||||
|
||||
Reference in New Issue
Block a user