Compare commits
No commits in common. "d725367f4db31a379227d5cdd99b051ddce8921c" and "e9fbbf2f9ffc78ebfdd2efd80e39b2f6cf13f775" have entirely different histories.
d725367f4d
...
e9fbbf2f9f
|
@ -31,9 +31,6 @@ import java.util.List;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Controller class for the CropDetail.fxml file
|
||||
*/
|
||||
public class CropDetailController {
|
||||
private Crop crop;
|
||||
|
||||
|
@ -66,9 +63,15 @@ public class CropDetailController {
|
|||
@FXML
|
||||
private Label description_label;
|
||||
|
||||
@FXML
|
||||
private Label location_label;
|
||||
|
||||
@FXML
|
||||
private Label light_label;
|
||||
|
||||
@FXML
|
||||
private Button location_button;
|
||||
|
||||
@FXML
|
||||
private Label soil_label;
|
||||
|
||||
|
@ -103,7 +106,15 @@ public class CropDetailController {
|
|||
*/
|
||||
@FXML
|
||||
void setArea() throws IOException {
|
||||
openTextFieldDialog();
|
||||
openTextFieldDialog("set Text Area", "Text Area", area_label.getText(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* open dialog to set location
|
||||
*/
|
||||
@FXML
|
||||
void setLocation() throws IOException {
|
||||
openTextFieldDialog("set Location", "Location", location_label.getText(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,6 +138,7 @@ public class CropDetailController {
|
|||
imageView.setImage(plant.image());
|
||||
}
|
||||
area_label.setText(String.valueOf(crop.getArea()));
|
||||
location_label.setText("");
|
||||
|
||||
setTaskListProperty(crop);
|
||||
taskList_listView.itemsProperty().bind(taskListProperty);
|
||||
|
@ -140,13 +152,11 @@ public class CropDetailController {
|
|||
}
|
||||
setIconToButton(addTask_button, "addIcon.png");
|
||||
setIconToButton(area_button, "areaIcon.png");
|
||||
setIconToButton(location_button, "locationIcon.png");
|
||||
setCellFactoryPests();
|
||||
setCellFactoryTasks();
|
||||
}
|
||||
|
||||
/**
|
||||
* cell Factory for TaskListView
|
||||
*/
|
||||
private void setCellFactoryTasks() {
|
||||
taskList_listView.setCellFactory(param -> new ListCell<>() {
|
||||
@Override
|
||||
|
@ -164,9 +174,6 @@ public class CropDetailController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* cell Factory for PestListView
|
||||
*/
|
||||
private void setCellFactoryPests() {
|
||||
pests_listView.setCellFactory(param -> new ListCell<>() {
|
||||
@Override
|
||||
|
@ -184,10 +191,6 @@ public class CropDetailController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* update task list
|
||||
* @param crop {@link Crop} that is selected
|
||||
*/
|
||||
private void setTaskListProperty(Crop crop) {
|
||||
crop.getCropId().ifPresent(id -> {
|
||||
List<Task> taskList;
|
||||
|
@ -202,11 +205,6 @@ public class CropDetailController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link HBox} for the given {@link Task}.
|
||||
* @param task {@link Task} which is selected
|
||||
* @return {@link HBox} that was created
|
||||
*/
|
||||
private HBox createTaskHBox(Task task) {
|
||||
HBox hBox = new HBox(10);
|
||||
Label taskName = new Label(task.getName()+": ");
|
||||
|
@ -233,11 +231,6 @@ public class CropDetailController {
|
|||
return hBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link HBox} for the given {@link Pest}.
|
||||
* @param pest {@link Pest} which is selected
|
||||
* @return {@link HBox} that was created
|
||||
*/
|
||||
private HBox createPestHBox(Pest pest) {
|
||||
Label label = new Label(pest.name() + ": ");
|
||||
label.setStyle("-fx-font-weight: bold");
|
||||
|
@ -246,8 +239,12 @@ public class CropDetailController {
|
|||
Label description = new Label(pest.description());
|
||||
description.setAlignment(Pos.TOP_LEFT);
|
||||
description.setWrapText(true);
|
||||
description.setMaxWidth(800);
|
||||
hBox.getChildren().addAll(label, description);
|
||||
description.setMaxWidth(600);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
Button button = new Button("Get Counter Measures");
|
||||
HBox.setHgrow(button, Priority.NEVER);
|
||||
hBox.getChildren().addAll(label, description, puffer, button);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
@ -264,11 +261,6 @@ public class CropDetailController {
|
|||
button.setGraphic(imageView);
|
||||
}
|
||||
|
||||
/**
|
||||
* opens dialog of {@link Task} edit.
|
||||
* @param task {@link Task}
|
||||
* @return {@link EventHandler} for the case of editing a {@link Task}
|
||||
*/
|
||||
private EventHandler<ActionEvent> getEditTaskEvent(Task task) {
|
||||
return (event) -> {
|
||||
try {
|
||||
|
@ -279,24 +271,12 @@ public class CropDetailController {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* opens alert of {@link Task} deletion.
|
||||
* @param task {@link Task}
|
||||
* @return {@link EventHandler} for the case of deleting a {@link Task}
|
||||
*/
|
||||
private EventHandler<ActionEvent> deleteTask(Task task) {
|
||||
return (event) -> {
|
||||
showDeleteTask(task);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* opens a dialog to create a new Task or edit the given Task
|
||||
* @param newTask boolean if it is a new Task
|
||||
* @param givenTask {@link Task} which was selected
|
||||
* @throws IOException Exception
|
||||
* @throws HardinessZoneNotSetException Exception
|
||||
*/
|
||||
private void createTaskDialog(boolean newTask, Task givenTask) throws IOException, HardinessZoneNotSetException {
|
||||
Dialog<Task> dialog = new Dialog<>();
|
||||
dialog.setTitle("Set Task");
|
||||
|
@ -339,14 +319,10 @@ public class CropDetailController {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* opens TextField Dialog to enter the plant area.
|
||||
* @throws IOException Exception
|
||||
*/
|
||||
private void openTextFieldDialog() throws IOException {
|
||||
private void openTextFieldDialog(String title, String labelDescription, String value, boolean isLocation) throws IOException {
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle("set Text Area");
|
||||
dialog.setHeaderText("set Text Area");
|
||||
dialog.setTitle(title);
|
||||
dialog.setHeaderText(title);
|
||||
dialog.setResizable(false);
|
||||
|
||||
DialogPane dialogPane = dialog.getDialogPane();
|
||||
|
@ -355,28 +331,30 @@ public class CropDetailController {
|
|||
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
||||
|
||||
if (appLoader.loadPaneToDialog("TextFieldFormular.fxml", dialogPane) instanceof TextFieldFormularController controller) {
|
||||
controller.setDescription_label("Text Area");
|
||||
controller.setValueTextArea(area_label.getText());
|
||||
controller.setDescription_label(labelDescription);
|
||||
controller.setValueTextArea(value);
|
||||
controller.initSaveButton((Button) dialogPane.lookupButton(save));
|
||||
|
||||
dialog.setResultConverter(button -> button.equals(save) ? controller.getValue() : null);
|
||||
|
||||
dialog.showAndWait()
|
||||
.ifPresent(string -> {
|
||||
try {
|
||||
garden.updateCrop(this.crop.withArea(Double.parseDouble(string)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (isLocation) {
|
||||
System.out.println(string);
|
||||
//ToDo method to set location
|
||||
location_label.setText(string);
|
||||
} else {
|
||||
try {
|
||||
garden.updateCrop(this.crop.withArea(Double.parseDouble(string)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
area_label.setText(string);
|
||||
}
|
||||
area_label.setText(string);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alert to delete Task.
|
||||
* @param task {@link Task} which is being deleted
|
||||
*/
|
||||
private void showDeleteTask(Task task) {
|
||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle("Delete " + task.getName());
|
||||
|
|
|
@ -8,9 +8,6 @@ import javafx.scene.image.ImageView;
|
|||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller class for the Home.fxml file
|
||||
*/
|
||||
public class HomeController implements Initializable {
|
||||
|
||||
@FXML
|
||||
|
@ -37,11 +34,6 @@ public class HomeController implements Initializable {
|
|||
setImages(imageViewPhilippe, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* set image to image view
|
||||
* @param imageView the imageView to update
|
||||
* @param photoName the file name of the photo
|
||||
*/
|
||||
private void setImages(ImageView imageView, String photoName) {
|
||||
Image img;
|
||||
if (photoName.equals("")) {
|
||||
|
|
|
@ -19,9 +19,6 @@ import java.io.IOException;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Controller class for the MainFXML.fxml file
|
||||
*/
|
||||
public class MainFXMLController {
|
||||
private static final Logger LOG = Logger.getLogger(MainFXMLController.class.getName());
|
||||
|
||||
|
@ -179,10 +176,6 @@ public class MainFXMLController {
|
|||
tutorial_button.visibleProperty().bind(Settings.getInstance().getShowTutorialProperty());
|
||||
}
|
||||
|
||||
/**
|
||||
* close Tutorial Window
|
||||
* @param windowEvent event
|
||||
*/
|
||||
private void closeWindowHandler(WindowEvent windowEvent) {
|
||||
tutorialModal.close();
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@ import java.util.*;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Controller class for the MyGarden.fxml file
|
||||
*/
|
||||
public class MyGardenController {
|
||||
private static final Logger LOG = Logger.getLogger(MyGardenController.class.getName());
|
||||
@Inject
|
||||
|
|
|
@ -12,8 +12,6 @@ import ch.zhaw.gartenverwaltung.types.Task;
|
|||
import javafx.beans.property.ListProperty;
|
||||
import javafx.beans.property.SimpleListProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
@ -27,9 +25,6 @@ import java.util.List;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Controller class for the MySchedule.fxml file
|
||||
*/
|
||||
public class MyScheduleController {
|
||||
private static final Logger LOG = Logger.getLogger(MyScheduleController.class.getName());
|
||||
private final ListProperty<List<Task>> taskListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||
|
@ -68,9 +63,6 @@ public class MyScheduleController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sort scheduler to selected crop
|
||||
*/
|
||||
private void lookForSelectedListEntries() {
|
||||
scheduledPlants_listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
selectedCrop = newValue;
|
||||
|
@ -82,9 +74,6 @@ public class MyScheduleController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* set cellFactory for the crops.
|
||||
*/
|
||||
private void setCellFactoryCropListView() {
|
||||
scheduledPlants_listview.setCellFactory(param -> new ListCell<>() {
|
||||
@Override
|
||||
|
@ -107,9 +96,6 @@ public class MyScheduleController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* set CallFactory for the given Tasks
|
||||
*/
|
||||
private void setCellFactoryTaskListView() {
|
||||
week_listView.setCellFactory(param -> new ListCell<>() {
|
||||
@Override
|
||||
|
@ -127,10 +113,6 @@ public class MyScheduleController {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* update task list
|
||||
* @throws IOException exception
|
||||
*/
|
||||
private void loadTaskList() throws IOException {
|
||||
List<List<Task>> taskLists;
|
||||
if (selectedCrop != null) {
|
||||
|
@ -142,12 +124,6 @@ public class MyScheduleController {
|
|||
taskListProperty.addAll(taskLists);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link VBox} of the given TaskList.
|
||||
* @param tasks List of {@link Task}s
|
||||
* @param dayIndex index of the day
|
||||
* @return {@link VBox} of the given Task of the day
|
||||
*/
|
||||
private VBox weekTaskVBox(List<Task> tasks, int dayIndex) {
|
||||
VBox vBox = new VBox(10);
|
||||
LocalDate today = LocalDate.now();
|
||||
|
@ -168,15 +144,14 @@ public class MyScheduleController {
|
|||
taskDescription.setMaxSize(600, Double.MAX_VALUE);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
Button button = new Button("Task completed!");
|
||||
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
showConfirmation(task);
|
||||
CheckBox checkBox = new CheckBox("Task completed?");
|
||||
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
showConfirmation(task, checkBox);
|
||||
}
|
||||
});
|
||||
HBox.setHgrow(button, Priority.NEVER);
|
||||
hBoxDescription.getChildren().addAll(taskDescription, puffer, button);
|
||||
HBox.setHgrow(checkBox, Priority.NEVER);
|
||||
hBoxDescription.getChildren().addAll(taskDescription, puffer, checkBox);
|
||||
vBox.getChildren().addAll(hBox, hBoxDescription);
|
||||
}
|
||||
return vBox;
|
||||
|
@ -186,7 +161,7 @@ public class MyScheduleController {
|
|||
* Alert to confirm that task has been completed.
|
||||
* @param task {@link Task} which is selected
|
||||
*/
|
||||
private void showConfirmation(Task task) {
|
||||
private void showConfirmation(Task task, CheckBox checkBox) {
|
||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle("Task Completed?");
|
||||
alert.setHeaderText("Are you sure you have completed this task?");
|
||||
|
@ -201,6 +176,8 @@ public class MyScheduleController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
checkBox.setSelected(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@ import java.util.List;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Controller class for the Plants.fxml file
|
||||
*/
|
||||
public class PlantsController {
|
||||
private static final Logger LOG = Logger.getLogger(PlantsController.class.getName());
|
||||
|
||||
|
@ -236,11 +233,11 @@ public class PlantsController {
|
|||
RadioButton radioButton = new RadioButton(season.getName());
|
||||
radioButton.setToggleGroup(seasonGroup);
|
||||
radioButton.setPadding(new Insets(0, 0, 10, 0));
|
||||
if (season.equals(Seasons.ALLSEASONS)) {
|
||||
if (season.equals(Seasons.AllSEASONS)) {
|
||||
radioButton.setSelected(true);
|
||||
}
|
||||
radioButton.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (season.equals(Seasons.ALLSEASONS)) {
|
||||
if (season.equals(Seasons.AllSEASONS)) {
|
||||
fillPlantListWithHardinessZone();
|
||||
} else {
|
||||
try {
|
||||
|
|
|
@ -8,10 +8,6 @@ import javafx.util.Callback;
|
|||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Controller class for the SelectSowDay.fxml file
|
||||
* Gets opened with a dialog.
|
||||
*/
|
||||
public class SelectSowDayController {
|
||||
private Plant selectedPlant;
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ public class Settings {
|
|||
private static Settings instance;
|
||||
private final BooleanProperty showTutorial = new SimpleBooleanProperty(false);
|
||||
|
||||
private String location = "";
|
||||
|
||||
static {
|
||||
instance = new Settings();
|
||||
}
|
||||
|
@ -40,12 +38,4 @@ public class Settings {
|
|||
public boolean getShowTutorial() {
|
||||
return this.showTutorial.get();
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,49 +1,23 @@
|
|||
package ch.zhaw.gartenverwaltung;
|
||||
|
||||
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
|
||||
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
||||
import ch.zhaw.gartenverwaltung.types.HardinessZone;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller class for the Settings.fxml file
|
||||
*/
|
||||
public class SettingsController implements Initializable {
|
||||
Settings settings = Settings.getInstance();
|
||||
|
||||
@Inject
|
||||
AppLoader appLoader;
|
||||
@FXML
|
||||
private ComboBox<HardinessZone> selectHardinessZone_comboBox;
|
||||
|
||||
@FXML
|
||||
private CheckBox showTutorial_checkBox;
|
||||
|
||||
@FXML
|
||||
private Button location_button;
|
||||
|
||||
@FXML
|
||||
private Label location_label;
|
||||
|
||||
/**
|
||||
* open dialog to set location
|
||||
* @param event event
|
||||
* @throws IOException exception
|
||||
*/
|
||||
@FXML
|
||||
void setLocation(ActionEvent event) throws IOException {
|
||||
openTextFieldDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* save selected values to {@link Settings}
|
||||
*/
|
||||
|
@ -62,50 +36,5 @@ public class SettingsController implements Initializable {
|
|||
showTutorial_checkBox.setSelected(settings.getShowTutorial());
|
||||
selectHardinessZone_comboBox.getItems().addAll(HardinessZone.values());
|
||||
selectHardinessZone_comboBox.setValue(settings.getCurrentHardinessZone());
|
||||
setIconToButton(location_button, "locationIcon.png");
|
||||
location_label.setText(settings.getLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* adds icon to button
|
||||
* @param button the button which get the icon
|
||||
* @param iconFileName file name of icon
|
||||
*/
|
||||
private void setIconToButton(Button button, String iconFileName) {
|
||||
Image img = new Image(String.valueOf(getClass().getResource("icons/" + iconFileName)));
|
||||
ImageView imageView = new ImageView(img);
|
||||
imageView.setFitHeight(20);
|
||||
imageView.setPreserveRatio(true);
|
||||
button.setGraphic(imageView);
|
||||
}
|
||||
|
||||
/**
|
||||
* opens Dialog to set exception
|
||||
* @throws IOException exception
|
||||
*/
|
||||
private void openTextFieldDialog() throws IOException {
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle("Set Location of your Garden");
|
||||
dialog.setHeaderText("set Location of your Garden!");
|
||||
dialog.setResizable(false);
|
||||
|
||||
DialogPane dialogPane = dialog.getDialogPane();
|
||||
|
||||
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
||||
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
||||
|
||||
if (appLoader.loadPaneToDialog("TextFieldFormular.fxml", dialogPane) instanceof TextFieldFormularController controller) {
|
||||
controller.setDescription_label("Set");
|
||||
controller.setValueTextArea(settings.getLocation());
|
||||
controller.initSaveButton((Button) dialogPane.lookupButton(save));
|
||||
|
||||
dialog.setResultConverter(button -> button.equals(save) ? controller.getValue() : null);
|
||||
|
||||
dialog.showAndWait()
|
||||
.ifPresent(string -> {
|
||||
settings.setLocation(string);
|
||||
location_label.setText(settings.getLocation());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ import java.net.URL;
|
|||
import java.time.LocalDate;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller class for the TaskFormular.fxml file
|
||||
*/
|
||||
public class TaskFormularController implements Initializable {
|
||||
private Crop crop;
|
||||
private Plant plant;
|
||||
|
@ -52,11 +49,6 @@ public class TaskFormularController implements Initializable {
|
|||
@AfterInject
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
/**
|
||||
* returns the edited or added {@link Task}
|
||||
* @param crop {@link Crop} which was selected
|
||||
* @return {@link Task} which was edited or added
|
||||
*/
|
||||
public Task returnResult(Crop crop) {
|
||||
int interval = 0;
|
||||
if (!(interval_field.getText().isEmpty() || interval_field.getText().equals(""))) {
|
||||
|
@ -69,21 +61,11 @@ public class TaskFormularController implements Initializable {
|
|||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* set selected crop and get the plant from the crop.
|
||||
* @param crop {@link Crop} which was selected
|
||||
* @throws HardinessZoneNotSetException exception
|
||||
* @throws IOException exception
|
||||
*/
|
||||
public void setCorp(Crop crop) throws HardinessZoneNotSetException, IOException {
|
||||
this.crop = crop;
|
||||
this.plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
|
||||
}
|
||||
|
||||
/**
|
||||
* set the values of task into the labels and datePicker.
|
||||
* @param task {@link Task} which was given
|
||||
*/
|
||||
public void setTaskValue(Task task) {
|
||||
this.task = task;
|
||||
taskName_field.setText(task.getName());
|
||||
|
@ -97,10 +79,6 @@ public class TaskFormularController implements Initializable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dayCellFactory of the start date
|
||||
* @return {@link Callback} of the dayCellFactory
|
||||
*/
|
||||
private Callback<DatePicker, DateCell> getDayCellFactoryStartDate() {
|
||||
|
||||
return (datePicker) -> new DateCell() {
|
||||
|
@ -125,10 +103,6 @@ public class TaskFormularController implements Initializable {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* dayCellFactory of the end date
|
||||
* @return {@link Callback} of the dayCellFactory
|
||||
*/
|
||||
private Callback<DatePicker, DateCell> getDayCellFactoryEndDate() {
|
||||
|
||||
return (datePicker) -> new DateCell() {
|
||||
|
@ -153,10 +127,6 @@ public class TaskFormularController implements Initializable {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* disable button until condition meet.
|
||||
* @param button {@link Button} which was given
|
||||
*/
|
||||
public void initSaveButton(Button button) {
|
||||
interval_field.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (!newValue.matches("\\d*")) {
|
||||
|
@ -169,16 +139,6 @@ public class TaskFormularController implements Initializable {
|
|||
.or(description_area.textProperty().isEmpty()));
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize dayCellFactories
|
||||
* @param location
|
||||
* The location used to resolve relative paths for the root object, or
|
||||
* {@code null} if the location is not known.
|
||||
*
|
||||
* @param resources
|
||||
* The resources used to localize the root object, or {@code null} if
|
||||
* the root object was not localized.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
start_datePicker.setDayCellFactory(getDayCellFactoryStartDate());
|
||||
|
|
|
@ -5,9 +5,6 @@ import javafx.scene.control.Button;
|
|||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
/**
|
||||
* Controller class for the TexFieldFormular.fxml file
|
||||
*/
|
||||
public class TextFieldFormularController {
|
||||
|
||||
@FXML
|
||||
|
@ -17,34 +14,18 @@ public class TextFieldFormularController {
|
|||
private TextField text_area;
|
||||
|
||||
|
||||
/**
|
||||
* set description label
|
||||
* @param string string of the description
|
||||
*/
|
||||
public void setDescription_label(String string) {
|
||||
description_label.setText(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* set text area value
|
||||
* @param string string of text area value
|
||||
*/
|
||||
public void setValueTextArea(String string) {
|
||||
text_area.setText(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* return value of text area
|
||||
* @return string of the tex area
|
||||
*/
|
||||
public String getValue() {
|
||||
return text_area.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Button until condition meet
|
||||
* @param button {@link Button} which is gets dissabled
|
||||
*/
|
||||
public void initSaveButton(Button button) {
|
||||
text_area.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue.matches("\\d*\\.?\\d*")) {
|
||||
|
|
|
@ -8,9 +8,6 @@ import javafx.scene.image.ImageView;
|
|||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* Controller class for the Tutorial.fxml file
|
||||
*/
|
||||
public class TutorialController {
|
||||
|
||||
@FXML
|
||||
|
@ -47,25 +44,16 @@ public class TutorialController {
|
|||
setButtonAbilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* disable next or close button according to the location of button
|
||||
*/
|
||||
private void setButtonAbilities() {
|
||||
previousPageButton.setDisable(page <= 0);
|
||||
nextPageButton.setDisable(page >= tourPages.getChildren().size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* switch to next view
|
||||
*/
|
||||
private void switchViews() {
|
||||
tourPages.getChildren().forEach(node -> node.setOpacity(0));
|
||||
tourPages.getChildren().get(page).setOpacity(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* close Tutorial
|
||||
*/
|
||||
public void closeTutorial() {
|
||||
Stage root = (Stage) tourPages.getScene().getWindow();
|
||||
root.close();
|
||||
|
|
|
@ -96,8 +96,7 @@ public class JsonTaskList implements TaskList {
|
|||
if(taskMap.isEmpty()) {
|
||||
loadTaskListFromFile();
|
||||
}
|
||||
taskMap.entrySet().removeIf(entry -> entry.getValue().getCropId() == cropId);
|
||||
writeTaskListToFile();
|
||||
taskMap.values().removeIf(task -> task.getCropId() == cropId);
|
||||
notifySubscribers();
|
||||
}
|
||||
|
||||
|
|
|
@ -66,16 +66,16 @@ public record Plant(
|
|||
public int timeToHarvest(int group) {
|
||||
List<GrowthPhase> activeLifecycle = lifecycleForGroup(group);
|
||||
GrowthPhase sow = activeLifecycle.stream()
|
||||
.filter(growthPhase -> growthPhase.type().equals(GrowthPhaseType.SOW))
|
||||
.filter(growthPhase -> !growthPhase.type().equals(GrowthPhaseType.SOW))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
GrowthPhase harvest = activeLifecycle.stream()
|
||||
.filter(growthPhase -> growthPhase.type().equals(GrowthPhaseType.HARVEST))
|
||||
.filter(growthPhase -> !growthPhase.type().equals(GrowthPhaseType.HARVEST))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
|
||||
int currentYear = LocalDate.now().getYear();
|
||||
return (int) DAYS.between(sow.startDate().atYear(currentYear),harvest.startDate().atYear(currentYear));
|
||||
return (int) DAYS.between(harvest.startDate().atYear(currentYear), sow.startDate().atYear(currentYear));
|
||||
}
|
||||
|
||||
public int lifecycleGroupFromHarvestDate(LocalDate harvestDate) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package ch.zhaw.gartenverwaltung.types;
|
|||
import java.time.MonthDay;
|
||||
|
||||
public enum Seasons {
|
||||
ALLSEASONS("--01-01", "--12-31", "All Seasons"),
|
||||
AllSEASONS("--01-01", "--12-31", "All Seasons"),
|
||||
SPRING("--03-01", "--05-30", "Spring"),
|
||||
SUMMER("--06-01", "--08-30", "Summer"),
|
||||
AUTUMN("--09-01", "--11-30", "Autumn"),
|
||||
|
|
|
@ -15,9 +15,12 @@
|
|||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="785.0" prefWidth="899.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.CropDetailController">
|
||||
<children>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="759.0" prefWidth="664.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<ScrollPane fitToWidth="true" prefHeight="759.0" prefWidth="664.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<VBox fx:id="cropDetailVBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0" spacing="5.0">
|
||||
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onAction="#goBack" prefHeight="25.0" prefWidth="91.0" text="Go Back">
|
||||
<VBox.margin>
|
||||
|
@ -29,18 +32,18 @@
|
|||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox maxHeight="1.7976931348623157E308" prefHeight="268.0" prefWidth="855.0" spacing="10.0" VBox.vgrow="NEVER">
|
||||
<HBox prefHeight="265.0" prefWidth="879.0">
|
||||
<children>
|
||||
<GridPane maxWidth="1.7976931348623157E308" prefHeight="231.0" prefWidth="555.0" HBox.hgrow="ALWAYS">
|
||||
<GridPane maxWidth="1.7976931348623157E308" prefHeight="296.0" prefWidth="577.0" HBox.hgrow="ALWAYS">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" maxWidth="284.0" minWidth="10.0" prefWidth="97.33334350585938" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="488.99999237060547" minWidth="10.0" prefWidth="481.9999898274739" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="149.66665903727215" minHeight="10.0" prefHeight="126.33328501383463" valignment="TOP" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="187.9999647140503" minHeight="10.0" prefHeight="45.00002034505208" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="46.33331298828125" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="45.66668701171875" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="149.66665903727215" minHeight="10.0" prefHeight="149.66665903727215" valignment="TOP" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="187.9999647140503" minHeight="10.0" prefHeight="51.00000762939453" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="54.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="46.66666666666666" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label prefHeight="17.0" prefWidth="65.0" text="Description:">
|
||||
|
@ -73,31 +76,31 @@
|
|||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
<ImageView fx:id="imageView" fitHeight="250.0" fitWidth="250.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER" />
|
||||
<ImageView fx:id="imageView" fitHeight="300.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER" />
|
||||
</children>
|
||||
</HBox>
|
||||
<Label text="Tasks:">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<ListView fx:id="taskList_listView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" prefHeight="100.0" prefWidth="869.0" VBox.vgrow="ALWAYS">
|
||||
<ListView fx:id="taskList_listView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="877.0" VBox.vgrow="ALWAYS">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</ListView>
|
||||
<Button fx:id="addTask_button" mnemonicParsing="false" onAction="#addTask" prefHeight="25.0" prefWidth="45.0" VBox.vgrow="NEVER">
|
||||
<Button fx:id="addTask_button" mnemonicParsing="false" onAction="#addTask" prefHeight="25.0" prefWidth="45.0">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
<Label text="Pests:" VBox.vgrow="NEVER" />
|
||||
<ListView fx:id="pests_listView" maxHeight="1.7976931348623157E308" minHeight="-Infinity" prefHeight="100.0" prefWidth="855.0" VBox.vgrow="SOMETIMES">
|
||||
<Label text="Pests:" />
|
||||
<ListView fx:id="pests_listView" maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</ListView>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="27.0" prefWidth="869.0" VBox.vgrow="NEVER">
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<Label text="Area:">
|
||||
<HBox.margin>
|
||||
|
@ -112,15 +115,27 @@
|
|||
<Button fx:id="area_button" mnemonicParsing="false" onAction="#setArea" prefHeight="25.0" prefWidth="116.0" text="Set Area" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="719.0" prefHeight="100.0" prefWidth="200.0" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<Label text="Location:">
|
||||
<HBox.margin>
|
||||
<Insets right="40.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<Label fx:id="location_label" minHeight="-Infinity" prefWidth="50.0" text="Label">
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<Button fx:id="location_button" mnemonicParsing="false" onAction="#setLocation" prefHeight="25.0" prefWidth="115.0" text="Set Location" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</content>
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</padding>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -6,245 +6,204 @@
|
|||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1091.0" prefWidth="1060.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.HomeController">
|
||||
<children>
|
||||
<ScrollPane fitToWidth="true" prefHeight="1157.0" prefWidth="1060.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</padding>
|
||||
<content>
|
||||
<VBox fx:id="homeVBox" prefHeight="1047.0" prefWidth="1019.0" spacing="10.0">
|
||||
<VBox prefHeight="1091.0" prefWidth="1058.0">
|
||||
<children>
|
||||
<Label text="Garden Management">
|
||||
<font>
|
||||
<Font size="34.0" />
|
||||
</font>
|
||||
<Pane prefHeight="1085.0" prefWidth="1018.0">
|
||||
<children>
|
||||
<VBox prefHeight="1047.0" prefWidth="1019.0">
|
||||
<children>
|
||||
<Label text="Garden Management">
|
||||
<font>
|
||||
<Font size="34.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="30.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label alignment="TOP_LEFT" prefHeight="22.0" prefWidth="1039.0" text="This Application was created to help the user manage his or her garden. For this the Application has many functionalities:" wrapText="true">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label text="Base Functionalities:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can select a plant he wants to cultivate.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="62.0" text="- The user can filter the plants according to seasons, hardiness zone and search query">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="62.0" text="- The user can select the harverst or sow date. ">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="102.0" text="- The user can get a detailed information of the plant he wants to harvest.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="122.0" text="- The user can get view the task list of the given plant.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="142.0" text="- The user can get the tasks of the next seven days in the scheduler.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="42.0" text="Advanced Functionalities:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="62.0" text="- The user can edit the task list and add custom tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="212.0" text="- The user can set the area (sqare meter) for the plants.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="232.0" text="- The user can set the location (PLZ) for the plants.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="162.0" text="- The user can set the pesticide which will be used, which will create additonal tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="192.0" text="Weather Forcast:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="212.0" text="- According to the location the weather forcast will crate or delete tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="10.0" layoutY="272.0" text="- The user receives notifications that aditional tasks werde created or some tasks were deleted.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label text="Created by:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewElias" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label text="Elias Csomor" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="15.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewPhilippe" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label text="Philippe Giavarini" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="15.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewDavid" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label text="David Guler" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="15.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewGian" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label text="Gian-Andrea Hutter" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="15.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewRoman" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label text="Roman Schenk" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="15.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<Label alignment="TOP_LEFT" prefHeight="22.0" prefWidth="1039.0" text="This Application was created to help the user manage his or her garden. For this the Application has many functionalities:" wrapText="true">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||
<children>
|
||||
<Label text="Base Functionalities:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can select a plant he wants to cultivate.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can filter the plants according to seasons, hardiness zone and search query">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can select the harverst or sow date. ">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can get a detailed information of the plant he wants to harvest.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can get view the task list of the given plant.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can get the tasks of the next seven days in the scheduler.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||
<children>
|
||||
<Label text="Advanced Functionalities:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can edit the task list and add custom tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can set the area (sqare meter) for the plants.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can set the location (PLZ) for the plants.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user can set the pesticide which will be used, which will create additonal tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||
<children>
|
||||
<Label text="Weather Forcast:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- According to the location the weather forcast will crate or delete tasks.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="- The user receives notifications that aditional tasks werde created or some tasks were deleted.">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="15.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||
<children>
|
||||
<Label text="Created by:">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewElias" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label minWidth="150.0" text="Elias Csomor" />
|
||||
<Label minWidth="200.0" text="csomoeli@students.zhaw.ch" />
|
||||
<Label text="Assistent Project Lead/Developer" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets left="50.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewPhilippe" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label minWidth="150.0" text="Philippe Giavarini" />
|
||||
<Label minWidth="200.0" text="giavaphi@students.zhaw.ch" />
|
||||
<Label text="Project Lead/Developer" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets left="50.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewDavid" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label minWidth="150.0" text="David Guler" />
|
||||
<Label minWidth="200.0" text="gulerdav@students.zhaw.ch" />
|
||||
<Label text="Developer" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets left="50.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewGian" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label minWidth="150.0" text="Gian-Andrea Hutter" />
|
||||
<Label minWidth="200.0" text="huttergia@students.zhaw.ch" />
|
||||
<Label text="Developer" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets left="50.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageViewRoman" fitHeight="100.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
</HBox.margin>
|
||||
</ImageView>
|
||||
<Label minWidth="150.0" text="Roman Schenk" />
|
||||
<Label minWidth="200.0" text="schrom01@students.zhaw.ch" />
|
||||
<Label text="Developer" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets left="50.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</Pane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
|
|
|
@ -10,26 +10,26 @@
|
|||
|
||||
<AnchorPane fx:id="myGardenRoot" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="655.0" prefWidth="1175.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyGardenController">
|
||||
<children>
|
||||
<VBox layoutY="49.0" prefHeight="655.0" prefWidth="1175.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<VBox layoutY="49.0" prefHeight="655.0" prefWidth="1175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label text="My Garden">
|
||||
<font>
|
||||
<Font name="System Bold" size="28.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<ListView fx:id="myGarden_listView" maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
|
||||
<Button fx:id="addPlant_button" mnemonicParsing="false" onAction="#addPlant" prefHeight="45.0" prefWidth="155.0" text="Add new Plant">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets top="10.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -5,56 +5,46 @@
|
|||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="572.0" prefWidth="867.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyScheduleController">
|
||||
<children>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Label layoutX="14.0" layoutY="14.0" text="MySchedule">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<HBox layoutY="31.0" prefHeight="541.0" prefWidth="867.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0">
|
||||
<children>
|
||||
<Label text="MySchedule" VBox.vgrow="NEVER">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="541.0" prefWidth="867.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
||||
<ListView fx:id="scheduledPlants_listview" maxWidth="1.7976931348623157E308" prefHeight="522.0" prefWidth="271.0" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</HBox.margin></ListView>
|
||||
<VBox maxWidth="1.7976931348623157E308" prefHeight="537.0" prefWidth="650.0" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<ListView fx:id="scheduledPlants_listview" maxWidth="1.7976931348623157E308" prefHeight="522.0" prefWidth="271.0" HBox.hgrow="NEVER">
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
<ListView fx:id="week_listView" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</ListView>
|
||||
<VBox maxWidth="1.7976931348623157E308" prefHeight="537.0" prefWidth="650.0" spacing="10.0" HBox.hgrow="ALWAYS">
|
||||
<Pane prefHeight="131.0" prefWidth="593.0" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<ListView fx:id="week_listView" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</ListView>
|
||||
<VBox prefHeight="131.0" prefWidth="603.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<Label alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="17.0" prefWidth="558.0" text="Importants Information:" wrapText="true" VBox.vgrow="NEVER">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="information_label" alignment="TOP_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="73.0" prefWidth="550.0" text="Label" wrapText="true" VBox.vgrow="ALWAYS" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<Label alignment="TOP_LEFT" layoutX="14.0" layoutY="14.0" prefHeight="17.0" prefWidth="550.0" text="Importants Information:" wrapText="true">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="information_label" alignment="TOP_LEFT" layoutX="14.0" layoutY="31.0" maxWidth="1.7976931348623157E308" prefHeight="82.0" prefWidth="550.0" text="Label" wrapText="true" />
|
||||
</children>
|
||||
</VBox>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Pane>
|
||||
</children>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</HBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -4,109 +4,91 @@
|
|||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.TitledPane?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="plantsRoot" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="1000.0" prefHeight="853.0" prefWidth="1219.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.PlantsController">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="1000.0" prefHeight="853.0"
|
||||
prefWidth="1219.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="ch.zhaw.gartenverwaltung.PlantsController"
|
||||
fx:id="plantsRoot">
|
||||
<children>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label prefHeight="45.0" prefWidth="903.0" text="Plants" VBox.vgrow="NEVER">
|
||||
<font>
|
||||
<Font name="System Bold" size="30.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="100.0" prefWidth="200.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
||||
<SplitPane dividerPositions="0.7377363661277062" layoutX="539.0" layoutY="266.0" prefHeight="853.0" prefWidth="1219.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<AnchorPane maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" HBox.hgrow="ALWAYS">
|
||||
<VBox maxWidth="1.7976931348623157E308" prefHeight="850.6666666666666" prefWidth="894.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<VBox maxWidth="1.7976931348623157E308" prefHeight="850.6666666666666" prefWidth="894.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<Label prefHeight="45.0" prefWidth="903.0" text="Plants">
|
||||
<font>
|
||||
<Font name="System Bold" size="30.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TextField fx:id="search_plants" promptText="Search for Plant Name" />
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="480.0" prefWidth="881.0" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<TextField fx:id="search_plants" promptText="Search for Plant Name" VBox.vgrow="NEVER" />
|
||||
<HBox alignment="CENTER_LEFT" minHeight="300.0" prefHeight="480.0" prefWidth="881.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<ListView fx:id="list_plants" maxWidth="1.7976931348623157E308" prefHeight="497.0" prefWidth="400.0" HBox.hgrow="ALWAYS" />
|
||||
<Pane maxHeight="1.7976931348623157E308" maxWidth="300.0" minWidth="300.0" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: white; -fx-border-color: black;" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" />
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
</HBox>
|
||||
<VBox maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<Label maxHeight="1.7976931348623157E308" prefHeight="33.0" prefWidth="919.0" text="Plant Information:" VBox.vgrow="NEVER">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="description_plant" alignment="TOP_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="96.0" prefWidth="879.0" text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." textAlignment="JUSTIFY" wrapText="true" VBox.vgrow="ALWAYS">
|
||||
<padding>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Button fx:id="selectSowDay_button" alignment="CENTER" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#selectSowDate" prefHeight="38.0" prefWidth="917.0" text="Select Harvest/Sow Day" VBox.vgrow="NEVER" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<ListView fx:id="list_plants" maxWidth="1.7976931348623157E308" prefHeight="497.0" prefWidth="400.0" HBox.hgrow="ALWAYS" />
|
||||
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER" />
|
||||
</children>
|
||||
</VBox>
|
||||
</HBox>
|
||||
<Label prefHeight="33.0" prefWidth="919.0" text="Plant Information:">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0" />
|
||||
</font>
|
||||
<padding>
|
||||
<Insets top="15.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="description_plant" alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="194.0" prefWidth="893.0" text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." textAlignment="JUSTIFY" wrapText="true">
|
||||
<padding>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Button fx:id="selectSowDay_button" alignment="CENTER" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#selectSowDate" prefHeight="38.0" prefWidth="917.0" text="Select Harvest/Sow Day" />
|
||||
</children>
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
</AnchorPane>
|
||||
<AnchorPane maxWidth="300.0" minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0" style="-fx-border-color: black; -fx-background-color: white;">
|
||||
<children>
|
||||
<VBox layoutX="38.0" layoutY="100.0" prefHeight="850.6666666666666" prefWidth="316.6666666666667" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label text="Filter">
|
||||
<font>
|
||||
<Font name="System Bold" size="17.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TitledPane animated="false" text="Seasons">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<VBox fx:id="seasons" layoutX="37.0" layoutY="-19.0" prefHeight="180.66666666666666" prefWidth="310.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
<TitledPane animated="false" text="Climate Zones">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<VBox fx:id="climate_zones" layoutX="36.0" layoutY="-19.0" prefHeight="180.66666666666666" prefWidth="310.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
<AnchorPane maxWidth="300.0" minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<VBox layoutX="38.0" layoutY="100.0" prefHeight="850.6666666666666" prefWidth="316.6666666666667" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label text="Filter">
|
||||
<font>
|
||||
<Font name="System Bold" size="17.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TitledPane animated="false" text="Seasons">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<VBox fx:id="seasons" layoutX="37.0" layoutY="-19.0" prefHeight="180.66666666666666" prefWidth="310.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
<TitledPane animated="false" text="Climate Zones">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<VBox fx:id="climate_zones" layoutX="36.0" layoutY="-19.0" prefHeight="180.66666666666666" prefWidth="310.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</SplitPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
|
@ -9,9 +8,10 @@
|
|||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="117.0" prefWidth="374.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.SettingsController">
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="80.0" prefWidth="374.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.SettingsController">
|
||||
<children>
|
||||
<VBox layoutX="14.0" layoutY="14.0" prefHeight="73.0" prefWidth="374.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<VBox layoutX="14.0" layoutY="14.0" prefHeight="73.0" prefWidth="374.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<HBox prefHeight="23.0" prefWidth="334.0">
|
||||
<children>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<CheckBox fx:id="showTutorial_checkBox" mnemonicParsing="false" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="20.0" prefHeight="23.0" prefWidth="334.0">
|
||||
|
@ -28,20 +28,10 @@
|
|||
<ComboBox fx:id="selectHardinessZone_comboBox" prefWidth="150.0" promptText="Hardniness Zone" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="53.0" prefHeight="23.0" prefWidth="334.0" spacing="5.0">
|
||||
<children>
|
||||
<Label maxWidth="1.7976931348623157E308" text="Set Location" HBox.hgrow="ALWAYS" />
|
||||
<Label fx:id="location_label" />
|
||||
<Button fx:id="location_button" mnemonicParsing="false" onAction="#setLocation" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
/*
|
||||
|
||||
#home_button, #myGarden_button,
|
||||
#mySchedule_button, #settings_button,
|
||||
|
@ -20,6 +20,6 @@
|
|||
-fx-background-color: darkgreen;
|
||||
}
|
||||
|
||||
.root, .scroll-pane, #homeVBox, #cropDetailVBox {
|
||||
-fx-background-color: #e6ffe6;
|
||||
}
|
||||
.root, .split-pane {
|
||||
-fx-background-color: linear-gradient(green 0%, lawngreen 33%, lightgreen 66%, #eee 100%);
|
||||
}./
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="ch.zhaw.gartenverwaltung.HelloController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
||||
</padding>
|
||||
|
||||
<Label fx:id="welcomeText"/>
|
||||
<Button text="Hello!" onAction="#onHelloButtonClick"/>
|
||||
</VBox>
|
|
@ -264,7 +264,7 @@
|
|||
"lifecycle": [
|
||||
{
|
||||
"startDate": "12-01",
|
||||
"endDate": "12-19",
|
||||
"endDate": "12-02",
|
||||
"type": "SOW",
|
||||
"zone": "ZONE_8A",
|
||||
"group": 0,
|
||||
|
@ -285,7 +285,7 @@
|
|||
},
|
||||
{
|
||||
"startDate": "12-03",
|
||||
"endDate": "12-22",
|
||||
"endDate": "12-15",
|
||||
"type": "PLANT",
|
||||
"zone": "ZONE_8A",
|
||||
"group": 0,
|
||||
|
@ -306,7 +306,7 @@
|
|||
},
|
||||
{
|
||||
"startDate": "12-16",
|
||||
"endDate": "12-30",
|
||||
"endDate": "12-18",
|
||||
"type": "HARVEST",
|
||||
"zone": "ZONE_8A",
|
||||
"group": 0,
|
||||
|
|
|
@ -30,7 +30,6 @@ public class JsonCropListTest {
|
|||
*/
|
||||
private final URL dbDataSource = this.getClass().getResource("test-user-crops.json");
|
||||
private final URL testFile = this.getClass().getResource("template-user-crops.json");
|
||||
private final URL corruptTestFile = this.getClass().getResource("corrupt-template-user-crops.json");
|
||||
|
||||
@BeforeEach
|
||||
void connectToDb() throws URISyntaxException, IOException {
|
||||
|
@ -102,13 +101,5 @@ public class JsonCropListTest {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void detectCorruptJsonResource(){
|
||||
JsonCropList tL = new JsonCropList(corruptTestFile);
|
||||
Assertions.assertThrows(InvalidJsonException.class, () -> {
|
||||
tL.getCrops();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Optional;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class JsonPlantListTest {
|
||||
private final URL testFile = this.getClass().getResource("test-plantdb.json");
|
||||
|
@ -63,8 +62,6 @@ public class JsonPlantListTest {
|
|||
void getPlantByIdAndZone() {
|
||||
Optional<Plant> testPlant;
|
||||
try {
|
||||
assertThrows(HardinessZoneNotSetException.class, () -> testDatabase.getPlantById(null,1).get());
|
||||
|
||||
testPlant = testDatabase.getPlantById(HardinessZone.ZONE_8A, 1);
|
||||
} catch (IOException | HardinessZoneNotSetException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -98,16 +95,5 @@ public class JsonPlantListTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDefaultConstructor(){
|
||||
JsonPlantList db = new JsonPlantList();
|
||||
try {
|
||||
assertNotNull(db.getPlantList(HardinessZone.ZONE_8A));
|
||||
} catch (IOException | HardinessZoneNotSetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package ch.zhaw.gartenverwaltung.io;
|
|||
|
||||
import ch.zhaw.gartenverwaltung.types.Task;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -16,8 +14,6 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class JsonTaskListTest {
|
||||
|
||||
|
@ -51,16 +47,17 @@ public class JsonTaskListTest {
|
|||
|
||||
}
|
||||
|
||||
@Disabled("disabled until adding works.")
|
||||
@Test
|
||||
@DisplayName("Add task.")
|
||||
void addTask() {
|
||||
Task task = new Task("Testtask", "This is a test Task.", LocalDate.parse("2022-05-01", formatter), 1);
|
||||
Task task = new Task("Testtask", "This is a test Task.", LocalDate.parse("01.05.2022", formatter), 1);
|
||||
try {
|
||||
testDatabase.saveTask(task);
|
||||
List<Task> taskList;
|
||||
try {
|
||||
taskList = testDatabase.getTaskList(LocalDate.parse("2022-04-30", formatter),
|
||||
LocalDate.parse("2022-05-31", formatter));
|
||||
taskList = testDatabase.getTaskList(LocalDate.parse("30.04.2022", formatter),
|
||||
LocalDate.parse("31.05.2022", formatter));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -75,7 +72,8 @@ public class JsonTaskListTest {
|
|||
@Test
|
||||
@DisplayName("Remove task.")
|
||||
void removeTask() {
|
||||
Task task = new Task("Dummy", "Dummy", LocalDate.parse("2022-05-31", formatter), 1).withId(2);
|
||||
Task task = new Task("Dummy", "Dummy", LocalDate.parse("2022-05-31", formatter), 1)
|
||||
.withId(2);
|
||||
try {
|
||||
testDatabase.removeTask(task);
|
||||
List<Task> taskList;
|
||||
|
@ -104,7 +102,7 @@ public class JsonTaskListTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Disabled("Disabled until removing works")
|
||||
@Test
|
||||
void removeTasksForCrop() {
|
||||
List<Task> taskList;
|
||||
|
@ -117,27 +115,4 @@ public class JsonTaskListTest {
|
|||
|
||||
Assertions.assertEquals(0, taskList.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDefaultConstructor(){
|
||||
JsonTaskList db = new JsonTaskList();
|
||||
try {
|
||||
assertNotNull(db.getTaskForCrop(0));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSubscription() {
|
||||
TaskList.TaskListObserver mockObs = Mockito.mock(TaskList.TaskListObserver.class);
|
||||
testDatabase.subscribe(mockObs);
|
||||
try {
|
||||
testDatabase.removeTasksForCrop(0);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
verify(mockObs, times(1)).onChange(ArgumentMatchers.anyList());
|
||||
}
|
||||
}
|
|
@ -188,7 +188,6 @@ class GardenScheduleTest {
|
|||
|
||||
@Test
|
||||
void planTasksForCrop() throws HardinessZoneNotSetException, PlantNotFoundException, IOException {
|
||||
assertThrows(PlantNotFoundException.class,()-> model.planTasksForCrop(new Crop()));
|
||||
model.planTasksForCrop(new Crop(20, exampleStartDate).withId(30));
|
||||
verify(exampleTaskTemplateList.get(0), times(1)).generateTask(exampleStartDate, 30);
|
||||
verify(exampleTaskTemplateList.get(1), times(1)).generateTask(exampleStartDate, 30);
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
package ch.zhaw.gartenverwaltung.types;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.MonthDay;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class PlantTest {
|
||||
|
||||
Plant testPlant;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
List<GrowthPhase> growthPhases = new ArrayList<>();
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(2, 1), MonthDay.of(4, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(4, 2), MonthDay.of(6, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(6, 3), MonthDay.of(8, 6), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(3, 1), MonthDay.of(5, 4), 1, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(5, 2), MonthDay.of(7, 5), 1, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(7, 3), MonthDay.of(9, 6), 1, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(4, 1), MonthDay.of(6, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_1A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(6, 2), MonthDay.of(8, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(7, 2), MonthDay.of(9, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>()));
|
||||
growthPhases.add(new GrowthPhase(MonthDay.of(8, 3), MonthDay.of(10, 6), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_1A, new ArrayList<>()));
|
||||
|
||||
testPlant = new Plant(
|
||||
20,
|
||||
"summertime onion",
|
||||
"Onion, (Allium cepa), herbaceous biennial plant in the amaryllis family (Amaryllidaceae) grown for its edible bulb. The onion is likely native to southwestern Asia but is now grown throughout the world, chiefly in the temperate zones. Onions are low in nutrients but are valued for their flavour and are used widely in cooking. They add flavour to such dishes as stews, roasts, soups, and salads and are also served as a cooked vegetable.",
|
||||
null,
|
||||
"15,30,2",
|
||||
0,
|
||||
"sandy to loamy, loose soil, free of stones",
|
||||
new ArrayList<>(),
|
||||
growthPhases);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void inZone() {
|
||||
assertEquals(7,testPlant.lifecycleForGroup(0).size());
|
||||
testPlant.inZone(HardinessZone.ZONE_8A);
|
||||
assertEquals(3,testPlant.lifecycleForGroup(0).size());
|
||||
assertEquals(Arrays.asList(3,5,7),testPlant.lifecycleForGroup(1).stream().map(gp ->gp.startDate().getMonthValue()).toList() );
|
||||
testPlant.inZone(HardinessZone.ZONE_1A);
|
||||
assertEquals(0,testPlant.lifecycleForGroup(0).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void lifecycleForGroup() {
|
||||
assertEquals(Arrays.asList(2,4,6,4,6,7,8),testPlant.lifecycleForGroup(0).stream().map(gp ->gp.startDate().getMonthValue()).toList() );
|
||||
assertEquals(Arrays.asList(3,5,7),testPlant.lifecycleForGroup(1).stream().map(gp ->gp.startDate().getMonthValue()).toList() );
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void sowDateFromHarvestDate() {
|
||||
assertEquals(LocalDate.of(2022,8,1),
|
||||
testPlant.sowDateFromHarvestDate(LocalDate.of(2022,12,1))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void timeToHarvest() {
|
||||
testPlant.inZone(HardinessZone.ZONE_8A);
|
||||
assertEquals(122,testPlant.timeToHarvest(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
void lifecycleGroupFromHarvestDate() {
|
||||
testPlant.inZone(HardinessZone.ZONE_8A);
|
||||
assertEquals(0,testPlant.lifecycleGroupFromHarvestDate(LocalDate.of(2022,6,30)));
|
||||
assertEquals(1,testPlant.lifecycleGroupFromHarvestDate(LocalDate.of(2022,8,30)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isDateInPhase() {
|
||||
assertTrue(testPlant.isDateInPhase(LocalDate.of(2022,6,30),GrowthPhaseType.HARVEST));
|
||||
assertTrue(testPlant.isDateInPhase(LocalDate.of(2022,8,30),GrowthPhaseType.HARVEST));
|
||||
assertTrue(testPlant.isDateInPhase(LocalDate.of(2022,2,1),GrowthPhaseType.SOW));
|
||||
assertTrue(testPlant.isDateInPhase(LocalDate.of(2022,4,2),GrowthPhaseType.PLANT));
|
||||
assertFalse(testPlant.isDateInPhase(LocalDate.of(2022,6,30),GrowthPhaseType.SOW));
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package ch.zhaw.gartenverwaltung.types;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.MonthDay;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class SeasonsTest {
|
||||
|
||||
@Test
|
||||
void getStartDate() {
|
||||
assertEquals(MonthDay.of(1,1), Seasons.ALLSEASONS.getStartDate());
|
||||
assertEquals(MonthDay.of(3,1), Seasons.SPRING.getStartDate());
|
||||
assertEquals(MonthDay.of(6,1), Seasons.SUMMER.getStartDate());
|
||||
assertEquals(MonthDay.of(9,1), Seasons.AUTUMN.getStartDate());
|
||||
assertEquals(MonthDay.of(12,1), Seasons.WINTER.getStartDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEndDate() {
|
||||
assertEquals(MonthDay.of(12,31), Seasons.ALLSEASONS.getEndDate());
|
||||
assertEquals(MonthDay.of(5,30), Seasons.SPRING.getEndDate());
|
||||
assertEquals(MonthDay.of(8,30), Seasons.SUMMER.getEndDate());
|
||||
assertEquals(MonthDay.of(11,30), Seasons.AUTUMN.getEndDate());
|
||||
assertEquals(MonthDay.of(2,28), Seasons.WINTER.getEndDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getName() {
|
||||
assertEquals("All Seasons", Seasons.ALLSEASONS.getName());
|
||||
assertEquals("Spring", Seasons.SPRING.getName());
|
||||
assertEquals("Summer", Seasons.SUMMER.getName());
|
||||
assertEquals("Autumn", Seasons.AUTUMN.getName());
|
||||
assertEquals("Winter", Seasons.WINTER.getName());
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[
|
||||
{
|
||||
"plantId": 1,
|
||||
"startDate": "2023-02-25",
|
||||
"area": 0.5
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue