Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96dc0ad827 | ||
|
|
4d2057d0df | ||
|
|
45035e565c | ||
|
|
c7b23335b5 | ||
|
|
7c015d78f4 |
@@ -3,6 +3,7 @@ package ch.zhaw.gartenverwaltung;
|
|||||||
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
|
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
|
||||||
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
||||||
import ch.zhaw.gartenverwaltung.io.PlantList;
|
import ch.zhaw.gartenverwaltung.io.PlantList;
|
||||||
|
import ch.zhaw.gartenverwaltung.io.TaskList;
|
||||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||||
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
||||||
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||||
@@ -28,7 +29,6 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -129,7 +129,14 @@ public class CropDetailController {
|
|||||||
}
|
}
|
||||||
area_label.setText(String.valueOf(crop.getArea()));
|
area_label.setText(String.valueOf(crop.getArea()));
|
||||||
|
|
||||||
setTaskListProperty(crop);
|
initializeTaskListProperty(crop);
|
||||||
|
|
||||||
|
TaskList.TaskListObserver taskListObserver = newTaskList -> {
|
||||||
|
taskListProperty.clear();
|
||||||
|
taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get()));
|
||||||
|
};
|
||||||
|
gardenSchedule.setTaskListObserver(taskListObserver);
|
||||||
|
|
||||||
taskList_listView.itemsProperty().bind(taskListProperty);
|
taskList_listView.itemsProperty().bind(taskListProperty);
|
||||||
|
|
||||||
pestListProperty.addAll(plant.pests());
|
pestListProperty.addAll(plant.pests());
|
||||||
@@ -186,10 +193,10 @@ public class CropDetailController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update task list
|
* initialize task list
|
||||||
* @param crop {@link Crop} that is selected
|
* @param crop {@link Crop} that is selected
|
||||||
*/
|
*/
|
||||||
private void setTaskListProperty(Crop crop) {
|
private void initializeTaskListProperty(Crop crop) {
|
||||||
crop.getCropId().ifPresent(id -> {
|
crop.getCropId().ifPresent(id -> {
|
||||||
List<Task> taskList;
|
List<Task> taskList;
|
||||||
try {
|
try {
|
||||||
@@ -223,8 +230,6 @@ public class CropDetailController {
|
|||||||
|
|
||||||
Button edit = new Button();
|
Button edit = new Button();
|
||||||
Button delete = new Button();
|
Button delete = new Button();
|
||||||
edit.getStyleClass().add("button-class");
|
|
||||||
delete.getStyleClass().add("button-class");
|
|
||||||
HBox.setHgrow(edit, Priority.NEVER);
|
HBox.setHgrow(edit, Priority.NEVER);
|
||||||
HBox.setHgrow(delete, Priority.NEVER);
|
HBox.setHgrow(delete, Priority.NEVER);
|
||||||
setIconToButton(edit, "editIcon.png");
|
setIconToButton(edit, "editIcon.png");
|
||||||
@@ -308,10 +313,6 @@ public class CropDetailController {
|
|||||||
|
|
||||||
DialogPane dialogPane = dialog.getDialogPane();
|
DialogPane dialogPane = dialog.getDialogPane();
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
ButtonType saveTask;
|
ButtonType saveTask;
|
||||||
if(newTask) {
|
if(newTask) {
|
||||||
saveTask = new ButtonType("Add", ButtonBar.ButtonData.OK_DONE);
|
saveTask = new ButtonType("Add", ButtonBar.ButtonData.OK_DONE);
|
||||||
@@ -333,13 +334,15 @@ public class CropDetailController {
|
|||||||
if (newTask) {
|
if (newTask) {
|
||||||
try {
|
try {
|
||||||
gardenSchedule.addTask(task);
|
gardenSchedule.addTask(task);
|
||||||
setTaskListProperty(this.crop);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//ToDo method to edit task
|
try {
|
||||||
setTaskListProperty(this.crop);
|
gardenSchedule.addTask(givenTask.updateTask(task));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -358,10 +361,6 @@ public class CropDetailController {
|
|||||||
|
|
||||||
DialogPane dialogPane = dialog.getDialogPane();
|
DialogPane dialogPane = dialog.getDialogPane();
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
||||||
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
||||||
|
|
||||||
@@ -393,18 +392,12 @@ public class CropDetailController {
|
|||||||
alert.setTitle("Delete " + task.getName());
|
alert.setTitle("Delete " + task.getName());
|
||||||
alert.setHeaderText("Are you sure want to delete this Task?");
|
alert.setHeaderText("Are you sure want to delete this Task?");
|
||||||
|
|
||||||
DialogPane dialogPane = alert.getDialogPane();
|
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
alert.showAndWait()
|
alert.showAndWait()
|
||||||
.ifPresent(buttonType -> {
|
.ifPresent(buttonType -> {
|
||||||
if (buttonType == ButtonType.OK) {
|
if (buttonType == ButtonType.OK) {
|
||||||
try {
|
try {
|
||||||
gardenSchedule.removeTask(task);
|
gardenSchedule.removeTask(task);
|
||||||
setTaskListProperty(this.crop);
|
//setTaskListProperty(this.crop);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO: Show error alert
|
// TODO: Show error alert
|
||||||
LOG.log(Level.SEVERE, "Could not remove crop.", e);
|
LOG.log(Level.SEVERE, "Could not remove crop.", e);
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ public class Main extends Application {
|
|||||||
AppLoader appLoader = new AppLoader();
|
AppLoader appLoader = new AppLoader();
|
||||||
|
|
||||||
backgroundTasks = new BackgroundTasks((TaskList) appLoader.getAppDependency(TaskList.class),(CropList) appLoader.getAppDependency(CropList.class), (PlantList) appLoader.getAppDependency(PlantList.class));
|
backgroundTasks = new BackgroundTasks((TaskList) appLoader.getAppDependency(TaskList.class),(CropList) appLoader.getAppDependency(CropList.class), (PlantList) appLoader.getAppDependency(PlantList.class));
|
||||||
// TODO reduce period
|
|
||||||
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 1000);
|
|
||||||
|
|
||||||
appLoader.loadSceneToStage("MainFXML.fxml", stage);
|
appLoader.loadSceneToStage("MainFXML.fxml", stage);
|
||||||
|
|
||||||
stage.setTitle("Gartenverwaltung");
|
stage.setTitle("Gartenverwaltung");
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
||||||
|
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 60000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import javafx.stage.Stage;
|
|||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -90,10 +89,6 @@ public class MainFXMLController {
|
|||||||
|
|
||||||
DialogPane dialogPane = dialog.getDialogPane();
|
DialogPane dialogPane = dialog.getDialogPane();
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
ButtonType saveSettings = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
ButtonType saveSettings = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
||||||
dialogPane.getButtonTypes().addAll(saveSettings, ButtonType.CANCEL);
|
dialogPane.getButtonTypes().addAll(saveSettings, ButtonType.CANCEL);
|
||||||
|
|
||||||
@@ -161,12 +156,7 @@ public class MainFXMLController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void styleChangeButton(Button button) {
|
private void styleChangeButton(Button button) {
|
||||||
/*home_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
//ToDo changeStyle of the menu buttons
|
||||||
myGarden_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
|
||||||
mySchedule_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
|
||||||
settings_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
|
||||||
tutorial_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
|
||||||
button.setStyle("-fx-background-color: darkgreen");*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -117,9 +117,6 @@ public class MyGardenController {
|
|||||||
|
|
||||||
Button details = new Button();
|
Button details = new Button();
|
||||||
Button delete = new Button();
|
Button delete = new Button();
|
||||||
details.getStyleClass().add("button-class");
|
|
||||||
delete.getStyleClass().add("button-class");
|
|
||||||
|
|
||||||
setIconToButton(details, "detailsIcon.png");
|
setIconToButton(details, "detailsIcon.png");
|
||||||
setIconToButton(delete, "deleteIcon.png");
|
setIconToButton(delete, "deleteIcon.png");
|
||||||
details.setOnAction(getGoToCropDetailEvent(crop));
|
details.setOnAction(getGoToCropDetailEvent(crop));
|
||||||
@@ -189,12 +186,6 @@ public class MyGardenController {
|
|||||||
Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
|
Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
|
||||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||||
alert.setTitle("Delete " + plant.name());
|
alert.setTitle("Delete " + plant.name());
|
||||||
DialogPane dialogPane = alert.getDialogPane();
|
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
alert.setHeaderText("Are you sure want to delete this Crop?");
|
alert.setHeaderText("Are you sure want to delete this Crop?");
|
||||||
alert.setContentText("Deleting this crop will remove all associated tasks from your schedule.");
|
alert.setContentText("Deleting this crop will remove all associated tasks from your schedule.");
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ package ch.zhaw.gartenverwaltung;
|
|||||||
import ch.zhaw.gartenverwaltung.bootstrap.AfterInject;
|
import ch.zhaw.gartenverwaltung.bootstrap.AfterInject;
|
||||||
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
|
||||||
import ch.zhaw.gartenverwaltung.io.PlantList;
|
import ch.zhaw.gartenverwaltung.io.PlantList;
|
||||||
|
import ch.zhaw.gartenverwaltung.io.TaskList;
|
||||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||||
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
|
||||||
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||||
import ch.zhaw.gartenverwaltung.types.Crop;
|
import ch.zhaw.gartenverwaltung.types.Crop;
|
||||||
import ch.zhaw.gartenverwaltung.types.Plant;
|
import ch.zhaw.gartenverwaltung.types.Plant;
|
||||||
import ch.zhaw.gartenverwaltung.types.Task;
|
import ch.zhaw.gartenverwaltung.types.Task;
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.ListProperty;
|
import javafx.beans.property.ListProperty;
|
||||||
import javafx.beans.property.SimpleListProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -32,7 +32,6 @@ import java.util.logging.Logger;
|
|||||||
*/
|
*/
|
||||||
public class MyScheduleController {
|
public class MyScheduleController {
|
||||||
private static final Logger LOG = Logger.getLogger(MyScheduleController.class.getName());
|
private static final Logger LOG = Logger.getLogger(MyScheduleController.class.getName());
|
||||||
private final ListProperty<List<Task>> taskListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
|
||||||
|
|
||||||
private Crop selectedCrop = null;
|
private Crop selectedCrop = null;
|
||||||
|
|
||||||
@@ -52,20 +51,35 @@ public class MyScheduleController {
|
|||||||
@FXML
|
@FXML
|
||||||
private ListView<Crop> scheduledPlants_listview;
|
private ListView<Crop> scheduledPlants_listview;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void showAllTasks(ActionEvent actionEvent) throws IOException {
|
||||||
|
gardenSchedule.getTasksUpcomingWeek();
|
||||||
|
scheduledPlants_listview.getSelectionModel().clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
@AfterInject
|
@AfterInject
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void init() {
|
public void init() throws IOException {
|
||||||
setCellFactoryCropListView();
|
setCellFactoryCropListView();
|
||||||
setCellFactoryTaskListView();
|
setCellFactoryTaskListView();
|
||||||
scheduledPlants_listview.itemsProperty().bind(garden.getPlantedCrops());
|
scheduledPlants_listview.itemsProperty().bind(garden.getPlantedCrops());
|
||||||
|
ListProperty<List<Task>> taskListProperty = gardenSchedule.getWeeklyTaskListProperty();
|
||||||
week_listView.itemsProperty().bind(taskListProperty);
|
week_listView.itemsProperty().bind(taskListProperty);
|
||||||
lookForSelectedListEntries();
|
lookForSelectedListEntries();
|
||||||
information_label.setText("");
|
information_label.setText("");
|
||||||
try {
|
|
||||||
loadTaskList();
|
gardenSchedule.getTasksUpcomingWeek();
|
||||||
} catch (IOException e) {
|
TaskList.TaskListObserver taskListObserver = newTaskList -> {
|
||||||
e.printStackTrace();
|
Platform.runLater(() -> {
|
||||||
}
|
try {
|
||||||
|
gardenSchedule.getTasksUpcomingWeek();
|
||||||
|
scheduledPlants_listview.getSelectionModel().clearSelection();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
gardenSchedule.setTaskListObserver(taskListObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,6 +100,8 @@ public class MyScheduleController {
|
|||||||
* set cellFactory for the crops.
|
* set cellFactory for the crops.
|
||||||
*/
|
*/
|
||||||
private void setCellFactoryCropListView() {
|
private void setCellFactoryCropListView() {
|
||||||
|
MultipleSelectionModel<Crop> selectionModel = scheduledPlants_listview.getSelectionModel();
|
||||||
|
selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
|
||||||
scheduledPlants_listview.setCellFactory(param -> new ListCell<>() {
|
scheduledPlants_listview.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Crop crop, boolean empty) {
|
protected void updateItem(Crop crop, boolean empty) {
|
||||||
@@ -117,8 +133,8 @@ public class MyScheduleController {
|
|||||||
super.updateItem(taskList, empty);
|
super.updateItem(taskList, empty);
|
||||||
|
|
||||||
if (empty || taskList == null) {
|
if (empty || taskList == null) {
|
||||||
setGraphic(null);
|
|
||||||
setText(null);
|
setText(null);
|
||||||
|
setGraphic(null);
|
||||||
} else {
|
} else {
|
||||||
setText("");
|
setText("");
|
||||||
setGraphic(weekTaskVBox(taskList, this.getIndex()));
|
setGraphic(weekTaskVBox(taskList, this.getIndex()));
|
||||||
@@ -134,12 +150,10 @@ public class MyScheduleController {
|
|||||||
private void loadTaskList() throws IOException {
|
private void loadTaskList() throws IOException {
|
||||||
List<List<Task>> taskLists;
|
List<List<Task>> taskLists;
|
||||||
if (selectedCrop != null) {
|
if (selectedCrop != null) {
|
||||||
taskLists = gardenSchedule.getTasksUpcomingWeekForCrop(selectedCrop.getCropId().get());
|
gardenSchedule.getTasksUpcomingWeekForCrop(selectedCrop.getCropId().get());
|
||||||
} else {
|
} else {
|
||||||
taskLists = gardenSchedule.getTasksUpcomingWeek();
|
gardenSchedule.getTasksUpcomingWeek();
|
||||||
}
|
}
|
||||||
taskListProperty.clear();
|
|
||||||
taskListProperty.addAll(taskLists);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,8 +183,6 @@ public class MyScheduleController {
|
|||||||
Pane puffer = new Pane();
|
Pane puffer = new Pane();
|
||||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||||
Button button = new Button("Task completed!");
|
Button button = new Button("Task completed!");
|
||||||
button.getStyleClass().add("button-class");
|
|
||||||
|
|
||||||
button.setOnAction(new EventHandler<ActionEvent>() {
|
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
@@ -207,5 +219,4 @@ public class MyScheduleController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import javafx.scene.layout.VBox;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -83,10 +82,6 @@ public class PlantsController {
|
|||||||
|
|
||||||
DialogPane dialogPane = dateSelection.getDialogPane();
|
DialogPane dialogPane = dateSelection.getDialogPane();
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
ButtonType sowButton = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
ButtonType sowButton = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
||||||
dialogPane.getButtonTypes().addAll(sowButton, ButtonType.CANCEL);
|
dialogPane.getButtonTypes().addAll(sowButton, ButtonType.CANCEL);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import javafx.scene.image.ImageView;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,10 +91,6 @@ public class SettingsController implements Initializable {
|
|||||||
|
|
||||||
DialogPane dialogPane = dialog.getDialogPane();
|
DialogPane dialogPane = dialog.getDialogPane();
|
||||||
|
|
||||||
dialogPane.getStylesheets().add(
|
|
||||||
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
|
|
||||||
dialogPane.getStyleClass().add("myDialog");
|
|
||||||
|
|
||||||
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
|
||||||
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class TaskFormularController implements Initializable {
|
|||||||
*/
|
*/
|
||||||
public Task returnResult(Crop crop) {
|
public Task returnResult(Crop crop) {
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
if (!(interval_field.getText().isEmpty() || interval_field.getText().equals(""))) {
|
if (interval_field.getText() != null && !(interval_field.getText().isEmpty() || interval_field.getText().equals(""))) {
|
||||||
interval = Integer.parseInt(interval_field.getText());
|
interval = Integer.parseInt(interval_field.getText());
|
||||||
}
|
}
|
||||||
Task task = new Task(taskName_field.getText(), description_area.getText(),
|
Task task = new Task(taskName_field.getText(), description_area.getText(),
|
||||||
@@ -159,7 +159,7 @@ public class TaskFormularController implements Initializable {
|
|||||||
*/
|
*/
|
||||||
public void initSaveButton(Button button) {
|
public void initSaveButton(Button button) {
|
||||||
interval_field.textProperty().addListener((observable, oldValue, newValue) -> {
|
interval_field.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (newValue != null && !newValue.matches("\\d*")) {
|
||||||
interval_field.setText(newValue.replaceAll("[^\\d]", ""));
|
interval_field.setText(newValue.replaceAll("[^\\d]", ""));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-1
@@ -43,7 +43,8 @@ public class WeatherGradenTaskPlanner {
|
|||||||
private void getSevereWeatherEvents() throws IOException {
|
private void getSevereWeatherEvents() throws IOException {
|
||||||
SevereWeather actualWeather = weatherService.causeSevereWeather(1);
|
SevereWeather actualWeather = weatherService.causeSevereWeather(1);
|
||||||
if (SevereWeather.HAIL.equals(actualWeather)) {
|
if (SevereWeather.HAIL.equals(actualWeather)) {
|
||||||
createPreHailTask();
|
//ToDo creates hail task all 3 seconds, pls fix
|
||||||
|
//createPreHailTask();
|
||||||
} else if (SevereWeather.FROST.equals(actualWeather)) {
|
} else if (SevereWeather.FROST.equals(actualWeather)) {
|
||||||
createPreFrostTask();
|
createPreFrostTask();
|
||||||
} else if (SevereWeather.SNOW.equals(actualWeather)) {
|
} else if (SevereWeather.SNOW.equals(actualWeather)) {
|
||||||
|
|||||||
@@ -67,11 +67,11 @@ public class JsonTaskList implements TaskList {
|
|||||||
* @see TaskList#getTaskList(LocalDate, LocalDate)
|
* @see TaskList#getTaskList(LocalDate, LocalDate)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Task> getTaskList(LocalDate start, LocalDate end) throws IOException{
|
public synchronized List<Task> getTaskList(LocalDate start, LocalDate end) throws IOException{
|
||||||
if(taskMap.isEmpty()) {
|
if(taskMap.isEmpty()) {
|
||||||
loadTaskListFromFile();
|
loadTaskListFromFile();
|
||||||
}
|
}
|
||||||
return taskMap.values().stream().filter(task -> task.isInTimePeriode(start, end)).toList();
|
return taskMap.values().stream().filter(task -> task.isInTimePeriod(start, end)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,7 @@ public class JsonTaskList implements TaskList {
|
|||||||
* @return List of Tasks for given Crop
|
* @return List of Tasks for given Crop
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Task> getTaskForCrop(long cropId) throws IOException {
|
public synchronized List<Task> getTaskForCrop(long cropId) throws IOException {
|
||||||
if(taskMap.isEmpty()) {
|
if(taskMap.isEmpty()) {
|
||||||
loadTaskListFromFile();
|
loadTaskListFromFile();
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ public class JsonTaskList implements TaskList {
|
|||||||
* @see TaskList#saveTask(Task)
|
* @see TaskList#saveTask(Task)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveTask(Task task) throws IOException {
|
public synchronized void saveTask(Task task) throws IOException {
|
||||||
if(taskMap.isEmpty()) {
|
if(taskMap.isEmpty()) {
|
||||||
loadTaskListFromFile();
|
loadTaskListFromFile();
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ public class JsonTaskList implements TaskList {
|
|||||||
/**
|
/**
|
||||||
* Calls the change handler method on all registered observers.
|
* Calls the change handler method on all registered observers.
|
||||||
*/
|
*/
|
||||||
private void notifySubscribers() {
|
private void notifySubscribers() throws IOException {
|
||||||
for (TaskListObserver subscriber : subscribers) {
|
for (TaskListObserver subscriber : subscribers) {
|
||||||
subscriber.onChange(taskMap.values().stream().toList());
|
subscriber.onChange(taskMap.values().stream().toList());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,6 @@ public interface TaskList {
|
|||||||
* Method which will be called when changes occur.
|
* Method which will be called when changes occur.
|
||||||
* @param newTaskList The new values
|
* @param newTaskList The new values
|
||||||
*/
|
*/
|
||||||
void onChange(List<Task> newTaskList);
|
void onChange(List<Task> newTaskList) throws IOException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package ch.zhaw.gartenverwaltung.models;
|
|||||||
import ch.zhaw.gartenverwaltung.Settings;
|
import ch.zhaw.gartenverwaltung.Settings;
|
||||||
import ch.zhaw.gartenverwaltung.io.*;
|
import ch.zhaw.gartenverwaltung.io.*;
|
||||||
import ch.zhaw.gartenverwaltung.types.*;
|
import ch.zhaw.gartenverwaltung.types.*;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.property.ListProperty;
|
||||||
|
import javafx.beans.property.SimpleListProperty;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -20,15 +24,28 @@ public class GardenSchedule {
|
|||||||
*/
|
*/
|
||||||
static final Comparator<Task> sortByStartDate = Comparator.comparing(Task::getStartDate);
|
static final Comparator<Task> sortByStartDate = Comparator.comparing(Task::getStartDate);
|
||||||
static final Comparator<Task> sortByNextExecution = Comparator.comparing(Task::getNextExecution);
|
static final Comparator<Task> sortByNextExecution = Comparator.comparing(Task::getNextExecution);
|
||||||
|
private final ListProperty<List<Task>> weeklyTaskListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to create Database Objects.
|
* Constructor to create Database Objects.
|
||||||
*/
|
*/
|
||||||
public GardenSchedule(TaskList taskList, PlantList plantList) {
|
public GardenSchedule(TaskList taskList, PlantList plantList) throws IOException {
|
||||||
this.taskList = taskList;
|
this.taskList = taskList;
|
||||||
this.plantList = plantList;
|
this.plantList = plantList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListProperty<List<Task>> getWeeklyTaskListProperty() {
|
||||||
|
return weeklyTaskListProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* subscribe task list observer to get notifications
|
||||||
|
* @param observer the task list which will be ovserved
|
||||||
|
*/
|
||||||
|
public void setTaskListObserver(TaskList.TaskListObserver observer) {
|
||||||
|
taskList.subscribe(observer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to save a new Task to Task Database
|
* Method to save a new Task to Task Database
|
||||||
* @param task the Task to save
|
* @param task the Task to save
|
||||||
@@ -163,18 +180,20 @@ public class GardenSchedule {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
weeklyTaskListProperty.clear();
|
||||||
|
weeklyTaskListProperty.addAll(dayTaskList);
|
||||||
return dayTaskList;
|
return dayTaskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to get an List of 7 Tasklists for the next 7 days. (Filtered Index 0 is Tasklist for Today.
|
* Method to get an List of 7 Tasklists for the next 7 days. (Filtered Index 0 is Tasklist for Today.
|
||||||
* @return List with length 7 (List<List<Task>>)
|
|
||||||
* @throws IOException If the database cannot be accessed
|
* @throws IOException If the database cannot be accessed
|
||||||
*/
|
*/
|
||||||
public List<List<Task>> getTasksUpcomingWeekForCrop(Long cropId) throws IOException {
|
public void getTasksUpcomingWeekForCrop(Long cropId) throws IOException {
|
||||||
List<List<Task>> dayTaskList = getTasksUpcomingWeek();
|
List<List<Task>> dayTaskList = getTasksUpcomingWeek();
|
||||||
dayTaskList.forEach(taskList -> taskList.removeIf(task -> task.getCropId() != cropId));
|
dayTaskList.forEach(taskList -> taskList.removeIf(task -> task.getCropId() != cropId));
|
||||||
return dayTaskList;
|
weeklyTaskListProperty.clear();
|
||||||
|
weeklyTaskListProperty.addAll(dayTaskList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
import ch.zhaw.gartenverwaltung.io.JsonPlantList;
|
|
||||||
import ch.zhaw.gartenverwaltung.io.PlantList;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a crop, meaning a specific plant growing at a specific time.
|
||||||
|
*/
|
||||||
public class Crop {
|
public class Crop {
|
||||||
private Long cropId = null;
|
private Long cropId = null;
|
||||||
private final long plantId;
|
private final long plantId;
|
||||||
|
|||||||
@@ -7,7 +7,19 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||||||
import java.time.MonthDay;
|
import java.time.MonthDay;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a growth phase of a plant.
|
||||||
|
* Plants go through several phases during their life (sowing, germinating, growing, ..., harvest).
|
||||||
|
* These phases are characterized by what kinds of tasks need to be executed by the gardener to stay alive.
|
||||||
|
* This class represents one such phase.
|
||||||
|
*
|
||||||
|
* @param startDate The earliest date on which this phase can start
|
||||||
|
* @param endDate The latest date on which this phase can start
|
||||||
|
* @param group Which group this phase belongs to (if the growth phase can occur multiple times a year, default: 0)
|
||||||
|
* @param type What {@link GrowthPhaseType} this represents
|
||||||
|
* @param zone The hardiness zone for which this growth phase is valid
|
||||||
|
* @param taskTemplates The (undated) tasks required to be performed by the gardener
|
||||||
|
*/
|
||||||
public record GrowthPhase(
|
public record GrowthPhase(
|
||||||
MonthDay startDate,
|
MonthDay startDate,
|
||||||
MonthDay endDate,
|
MonthDay endDate,
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumerates the different possible types of {@link GrowthPhase}.
|
||||||
|
* (Subject to later expansion)
|
||||||
|
*/
|
||||||
public enum GrowthPhaseType {
|
public enum GrowthPhaseType {
|
||||||
SOW, PLANT, REPLANT, HARVEST
|
SOW, PLANT, REPLANT, HARVEST
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a pest or pathogen which may afflict a plant.
|
||||||
|
*
|
||||||
|
* @param name The name of the pest
|
||||||
|
* @param description A description of the pest
|
||||||
|
* @param measures Measures that can be taken against the pest.
|
||||||
|
*/
|
||||||
public record Pest(String name, String description, String measures) {
|
public record Pest(String name, String description, String measures) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,20 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static java.time.temporal.ChronoUnit.DAYS;
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a plant
|
||||||
|
*
|
||||||
|
* @param id A unique identifier
|
||||||
|
* @param name The name of the plant
|
||||||
|
* @param description A description of the plant
|
||||||
|
* @param image An image representing the plant
|
||||||
|
* @param spacing The amount of space needed between individual plants of this type
|
||||||
|
* @param light The amount of light preferred by the plant (h/d)
|
||||||
|
* @param soil The type of soil required for the plant
|
||||||
|
* @param pests {@link Pest}s that may afflict the plant
|
||||||
|
* @param wateringCycle The {@link WateringCycle} required by the plant
|
||||||
|
* @param lifecycle A list of {@link GrowthPhase}s constituting the plants lifecycle
|
||||||
|
*/
|
||||||
public record Plant(
|
public record Plant(
|
||||||
long id,
|
long id,
|
||||||
String name,
|
String name,
|
||||||
@@ -30,9 +44,10 @@ public record Plant(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all growthPhases of lifecycle group
|
* Get all {@link GrowthPhase}s of a lifecycle group
|
||||||
* @param group lifecycle group
|
*
|
||||||
* @return list of growthPhases
|
* @param group The lifecycle group
|
||||||
|
* @return A list of {@link GrowthPhase}s
|
||||||
*/
|
*/
|
||||||
public List<GrowthPhase> lifecycleForGroup(int group) {
|
public List<GrowthPhase> lifecycleForGroup(int group) {
|
||||||
return lifecycle.stream()
|
return lifecycle.stream()
|
||||||
@@ -40,6 +55,12 @@ public record Plant(
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a {@link LocalDate}, determines which lifecycle group contains it.
|
||||||
|
*
|
||||||
|
* @param date The date to look for
|
||||||
|
* @return Which lifecycle group the date is in
|
||||||
|
*/
|
||||||
public int getGrowphaseGroupForDate(LocalDate date) {
|
public int getGrowphaseGroupForDate(LocalDate date) {
|
||||||
for(GrowthPhase growthPhase : lifecycle){
|
for(GrowthPhase growthPhase : lifecycle){
|
||||||
MonthDay plantingDate = MonthDay.of(date.getMonth().getValue(), date.getDayOfMonth());
|
MonthDay plantingDate = MonthDay.of(date.getMonth().getValue(), date.getDayOfMonth());
|
||||||
@@ -51,16 +72,18 @@ public record Plant(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get sow date from given harvest day from lifecycle group
|
* Get sow date from given harvest date from lifecycle group
|
||||||
|
*
|
||||||
* @param harvestDate date of the harvest
|
* @param harvestDate date of the harvest
|
||||||
* @return LocaleDate of sow date
|
* @return {@link LocalDate} of sow date
|
||||||
*/
|
*/
|
||||||
public LocalDate sowDateFromHarvestDate(LocalDate harvestDate) {
|
public LocalDate sowDateFromHarvestDate(LocalDate harvestDate) {
|
||||||
return harvestDate.minusDays(timeToHarvest(lifecycleGroupFromHarvestDate(harvestDate)));
|
return harvestDate.minusDays(timeToHarvest(lifecycleGroupFromHarvestDate(harvestDate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate the days between sow and harvest day for lifecycle group
|
* Calculate the number of days between sow and harvest date for lifecycle group
|
||||||
|
*
|
||||||
* @param group the lifecycle group
|
* @param group the lifecycle group
|
||||||
* @return Integer number of dates between sow and harvest day
|
* @return Integer number of dates between sow and harvest day
|
||||||
*/
|
*/
|
||||||
@@ -79,6 +102,12 @@ public record Plant(
|
|||||||
return (int) DAYS.between(sow.startDate().atYear(currentYear),harvest.startDate().atYear(currentYear));
|
return (int) DAYS.between(sow.startDate().atYear(currentYear),harvest.startDate().atYear(currentYear));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a harvest date, determines which lifecycle group it belongs to.
|
||||||
|
*
|
||||||
|
* @param harvestDate The harvest date
|
||||||
|
* @return Which lifecycle group the harvest date is in
|
||||||
|
*/
|
||||||
public int lifecycleGroupFromHarvestDate(LocalDate harvestDate) {
|
public int lifecycleGroupFromHarvestDate(LocalDate harvestDate) {
|
||||||
return lifecycle.stream()
|
return lifecycle.stream()
|
||||||
.filter(growthPhase -> growthPhase.type().equals(GrowthPhaseType.HARVEST) &&
|
.filter(growthPhase -> growthPhase.type().equals(GrowthPhaseType.HARVEST) &&
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package ch.zhaw.gartenverwaltung.types;
|
|||||||
|
|
||||||
import java.time.MonthDay;
|
import java.time.MonthDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the 4 Seasons in terms of {@link java.time.LocalDate}s
|
||||||
|
* Also describes "All Seasons" as the full year.
|
||||||
|
*/
|
||||||
public enum Seasons {
|
public enum Seasons {
|
||||||
ALLSEASONS("--01-01", "--12-31", "All Seasons"),
|
ALLSEASONS("--01-01", "--12-31", "All Seasons"),
|
||||||
SPRING("--03-01", "--05-30", "Spring"),
|
SPRING("--03-01", "--05-30", "Spring"),
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models a Task
|
* Represents a Task
|
||||||
* May be created using the builder pattern.
|
* May be created using the builder pattern.
|
||||||
*/
|
*/
|
||||||
public class Task {
|
public class Task {
|
||||||
@@ -18,10 +17,9 @@ public class Task {
|
|||||||
private LocalDate nextExecution;
|
private LocalDate nextExecution;
|
||||||
private LocalDate nextNotification;
|
private LocalDate nextNotification;
|
||||||
private long cropId;
|
private long cropId;
|
||||||
private boolean done;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor
|
* Default constructor
|
||||||
* (used by Json deserializer)
|
* (used by Json deserializer)
|
||||||
*/
|
*/
|
||||||
public Task(){
|
public Task(){
|
||||||
@@ -32,6 +30,14 @@ public class Task {
|
|||||||
nextExecution = startDate;
|
nextExecution = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for a non-repeating task related to a {@link Crop}
|
||||||
|
*
|
||||||
|
* @param name The name of the task
|
||||||
|
* @param description A description of the task
|
||||||
|
* @param startDate The start date of the task
|
||||||
|
* @param cropId The id of the crop to which the task belongs
|
||||||
|
*/
|
||||||
public Task(String name, String description, LocalDate startDate, long cropId) {
|
public Task(String name, String description, LocalDate startDate, long cropId) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -43,7 +49,12 @@ public class Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for weather events
|
* Constructor for weather events
|
||||||
*/
|
*
|
||||||
|
* @param name The name of the task
|
||||||
|
* @param description A description of the task
|
||||||
|
* @param startDate The start date of the task
|
||||||
|
* @param endDate The maximum date on which the task should be executed
|
||||||
|
*/
|
||||||
public Task(String name, String description, LocalDate startDate, LocalDate endDate) {
|
public Task(String name, String description, LocalDate startDate, LocalDate endDate) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -51,6 +62,16 @@ public class Task {
|
|||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full constructor (without id)
|
||||||
|
*
|
||||||
|
* @param name The name of the task
|
||||||
|
* @param description A description of the task
|
||||||
|
* @param startDate The start date of the task
|
||||||
|
* @param endDate The maximum date on which the task should be executed
|
||||||
|
* @param interval The number of days between executions
|
||||||
|
* @param cropId The id of the crop to which the task belongs
|
||||||
|
*/
|
||||||
public Task(String name, String description, LocalDate startDate, LocalDate endDate, int interval, long cropId) {
|
public Task(String name, String description, LocalDate startDate, LocalDate endDate, int interval, long cropId) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -75,10 +96,20 @@ public class Task {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimePeriode(LocalDate searchStartDate, LocalDate searchEndDate){
|
/**
|
||||||
return endDate.isAfter(searchStartDate) && startDate.isBefore(searchEndDate);
|
* Checks if the Task is within a specific date range.
|
||||||
|
*
|
||||||
|
* @param searchStartDate The minimum date
|
||||||
|
* @param searchEndDate The maximum date
|
||||||
|
* @return Whether the Task is within the given range
|
||||||
|
*/
|
||||||
|
public boolean isInTimePeriod(LocalDate searchStartDate, LocalDate searchEndDate) {
|
||||||
|
return endDate.isAfter(searchStartDate) && startDate.isBefore(searchEndDate) || (nextExecution != null && nextExecution.isBefore(searchEndDate) && nextExecution.isAfter(searchStartDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a specific execution of a Task as done.
|
||||||
|
*/
|
||||||
public void done(){
|
public void done(){
|
||||||
if(interval != null && interval != 0 && !nextExecution.plusDays(interval).isAfter(endDate)){
|
if(interval != null && interval != 0 && !nextExecution.plusDays(interval).isAfter(endDate)){
|
||||||
nextExecution = nextExecution.plusDays(interval);
|
nextExecution = nextExecution.plusDays(interval);
|
||||||
@@ -117,6 +148,12 @@ public class Task {
|
|||||||
return Optional.ofNullable(endDate);
|
return Optional.ofNullable(endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the fields of this Task using the values of the given Task
|
||||||
|
*
|
||||||
|
* @param task The task whose fields to copy
|
||||||
|
* @return This task with the fields already updated
|
||||||
|
*/
|
||||||
public Task updateTask(Task task) {
|
public Task updateTask(Task task) {
|
||||||
this.name = task.getName();
|
this.name = task.getName();
|
||||||
this.description = task.getDescription();
|
this.description = task.getDescription();
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ public class TaskTemplate {
|
|||||||
this.relativeStartDate = relativeStartDate;
|
this.relativeStartDate = relativeStartDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a concrete {@link Task} given a concrete start date
|
||||||
|
*
|
||||||
|
* @param realStartDate The start date of the {@link GrowthPhase} to which the {@link #relativeStartDate} is relative.
|
||||||
|
* @param cropId The crop for which the task should be generated.
|
||||||
|
* @return The created {@link Task}
|
||||||
|
*/
|
||||||
public Task generateTask(LocalDate realStartDate, long cropId) {
|
public Task generateTask(LocalDate realStartDate, long cropId) {
|
||||||
LocalDate endDate = relativeEndDate != null ? realStartDate.plusDays(relativeEndDate) : realStartDate;
|
LocalDate endDate = relativeEndDate != null ? realStartDate.plusDays(relativeEndDate) : realStartDate;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the cycle in which a {@link Plant} should be watered
|
||||||
|
*
|
||||||
|
* @param litersPerSqM How many litres of water per square metre of ground
|
||||||
|
* @param interval The interval (days)
|
||||||
|
* @param notes Notes on the cycle
|
||||||
|
*/
|
||||||
public record WateringCycle(
|
public record WateringCycle(
|
||||||
int litersPerSqM,
|
int litersPerSqM,
|
||||||
int interval,
|
int interval,
|
||||||
|
|||||||
@@ -19,19 +19,19 @@
|
|||||||
<content>
|
<content>
|
||||||
<VBox fx:id="cropDetailVBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0" spacing="5.0">
|
<VBox fx:id="cropDetailVBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0" spacing="5.0">
|
||||||
<children>
|
<children>
|
||||||
<Button styleClass="button-class" mnemonicParsing="false" onAction="#goBack" prefHeight="25.0" prefWidth="91.0" text="Go Back">
|
<Button mnemonicParsing="false" onAction="#goBack" prefHeight="25.0" prefWidth="91.0" text="Go Back">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="10.0" />
|
<Insets bottom="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Button>
|
</Button>
|
||||||
<Label styleClass="page-title" fx:id="cropName_label" text="Label">
|
<Label fx:id="cropName_label" text="Label">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="10.0" />
|
<Insets bottom="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<HBox maxHeight="1.7976931348623157E308" prefHeight="268.0" prefWidth="855.0" spacing="10.0" VBox.vgrow="NEVER">
|
<HBox maxHeight="1.7976931348623157E308" prefHeight="268.0" prefWidth="855.0" spacing="10.0" VBox.vgrow="NEVER">
|
||||||
<children>
|
<children>
|
||||||
<GridPane styleClass="custom-container" maxWidth="1.7976931348623157E308" prefHeight="231.0" prefWidth="555.0" HBox.hgrow="ALWAYS">
|
<GridPane maxWidth="1.7976931348623157E308" prefHeight="231.0" prefWidth="555.0" HBox.hgrow="ALWAYS">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" maxWidth="284.0" minWidth="10.0" prefWidth="97.33334350585938" />
|
<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 hgrow="SOMETIMES" maxWidth="488.99999237060547" minWidth="10.0" prefWidth="481.9999898274739" />
|
||||||
@@ -72,9 +72,6 @@
|
|||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</Label>
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
|
||||||
<Insets bottom="5.0" left="10.0" right="5.0" top="5.0" />
|
|
||||||
</padding>
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<ImageView fx:id="imageView" fitHeight="250.0" fitWidth="250.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER" />
|
<ImageView fx:id="imageView" fitHeight="250.0" fitWidth="250.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER" />
|
||||||
</children>
|
</children>
|
||||||
@@ -89,7 +86,7 @@
|
|||||||
<Insets bottom="10.0" />
|
<Insets bottom="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</ListView>
|
</ListView>
|
||||||
<Button styleClass="button-class" 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.vgrow="NEVER">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
@@ -112,7 +109,7 @@
|
|||||||
<Insets right="10.0" />
|
<Insets right="10.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<Button styleClass="button-class" fx:id="area_button" mnemonicParsing="false" onAction="#setArea" prefHeight="25.0" prefWidth="116.0" text="Set Area" />
|
<Button fx:id="area_button" mnemonicParsing="false" onAction="#setArea" prefHeight="25.0" prefWidth="116.0" text="Set Area" />
|
||||||
</children>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<content>
|
<content>
|
||||||
<VBox fx:id="homeVBox" prefHeight="1047.0" prefWidth="1019.0" spacing="10.0">
|
<VBox fx:id="homeVBox" prefHeight="1047.0" prefWidth="1019.0" spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
<Label styleClass="page-title" text="Garden Management">
|
<Label text="Garden Management">
|
||||||
<font>
|
<font>
|
||||||
<Font size="34.0" />
|
<Font size="34.0" />
|
||||||
</font>
|
</font>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||||
<children>
|
<children>
|
||||||
<Label text="Base Functionalities:">
|
<Label text="Base Functionalities:">
|
||||||
<font>
|
<font>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||||
<children>
|
<children>
|
||||||
<Label text="Advanced Functionalities:">
|
<Label text="Advanced Functionalities:">
|
||||||
<font>
|
<font>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||||
<children>
|
<children>
|
||||||
<Label text="Weather Forcast:">
|
<Label text="Weather Forcast:">
|
||||||
<font>
|
<font>
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="15.0">
|
<VBox prefHeight="200.0" prefWidth="100.0" spacing="15.0" style="-fx-background-color: white; -fx-border-color: black;">
|
||||||
<children>
|
<children>
|
||||||
<Label text="Created by:">
|
<Label text="Created by:">
|
||||||
<font>
|
<font>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<children>
|
<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" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<Label styleClass="page-title" text="My Garden">
|
<Label text="My Garden">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="28.0" />
|
<Font name="System Bold" size="28.0" />
|
||||||
</font>
|
</font>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<ListView fx:id="myGarden_listView" maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
|
<ListView fx:id="myGarden_listView" maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
|
||||||
<Button styleClass="button-class" fx:id="addPlant_button" mnemonicParsing="false" onAction="#addPlant" prefHeight="45.0" prefWidth="155.0" text="Add new Plant">
|
<Button fx:id="addPlant_button" mnemonicParsing="false" onAction="#addPlant" prefHeight="45.0" prefWidth="155.0" text="Add new Plant">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.ListView?>
|
<?import javafx.scene.control.ListView?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
@@ -12,18 +13,19 @@
|
|||||||
<children>
|
<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">
|
<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>
|
<children>
|
||||||
<Label styleClass="page-title" text="MySchedule" VBox.vgrow="NEVER">
|
<Label text="MySchedule" VBox.vgrow="NEVER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="24.0" />
|
<Font size="24.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="541.0" prefWidth="867.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="541.0" prefWidth="867.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="scheduledPlants_listview" maxWidth="1.7976931348623157E308" prefHeight="522.0" prefWidth="271.0" HBox.hgrow="NEVER">
|
<VBox prefHeight="497.0" prefWidth="237.0" spacing="10.0" HBox.hgrow="NEVER">
|
||||||
<HBox.margin>
|
<children>
|
||||||
<Insets />
|
<ListView fx:id="scheduledPlants_listview" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="522.0" prefWidth="271.0" VBox.vgrow="ALWAYS" />
|
||||||
</HBox.margin>
|
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#showAllTasks" styleClass="button-class" text="Show All Tasks" VBox.vgrow="NEVER" />
|
||||||
</ListView>
|
</children>
|
||||||
|
</VBox>
|
||||||
<VBox maxWidth="1.7976931348623157E308" prefHeight="537.0" prefWidth="650.0" spacing="10.0" HBox.hgrow="ALWAYS">
|
<VBox maxWidth="1.7976931348623157E308" prefHeight="537.0" prefWidth="650.0" spacing="10.0" HBox.hgrow="ALWAYS">
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="week_listView" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
<ListView fx:id="week_listView" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||||
@@ -31,7 +33,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</ListView>
|
</ListView>
|
||||||
<VBox styleClass="custom-container" prefHeight="131.0" prefWidth="603.0" spacing="5.0" VBox.vgrow="NEVER">
|
<VBox prefHeight="131.0" prefWidth="603.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="NEVER">
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="17.0" prefWidth="558.0" text="Importants Information:" wrapText="true" VBox.vgrow="NEVER">
|
<Label alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="17.0" prefWidth="558.0" text="Importants Information:" wrapText="true" VBox.vgrow="NEVER">
|
||||||
<font>
|
<font>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<children>
|
<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">
|
<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>
|
<children>
|
||||||
<Label styleClass="page-title" prefHeight="45.0" prefWidth="903.0" text="Plants" VBox.vgrow="NEVER">
|
<Label prefHeight="45.0" prefWidth="903.0" text="Plants" VBox.vgrow="NEVER">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="30.0" />
|
<Font name="System Bold" size="30.0" />
|
||||||
</font>
|
</font>
|
||||||
@@ -32,14 +32,14 @@
|
|||||||
<HBox alignment="CENTER_LEFT" minHeight="300.0" prefHeight="480.0" prefWidth="881.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
<HBox alignment="CENTER_LEFT" minHeight="300.0" prefHeight="480.0" prefWidth="881.0" spacing="10.0" VBox.vgrow="ALWAYS">
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="list_plants" maxWidth="1.7976931348623157E308" prefHeight="497.0" prefWidth="400.0" HBox.hgrow="ALWAYS" />
|
<ListView fx:id="list_plants" maxWidth="1.7976931348623157E308" prefHeight="497.0" prefWidth="400.0" HBox.hgrow="ALWAYS" />
|
||||||
<Pane styleClass="custom-container" maxHeight="1.7976931348623157E308" maxWidth="300.0" minWidth="300.0" prefHeight="200.0" prefWidth="200.0" HBox.hgrow="NEVER">
|
<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>
|
<children>
|
||||||
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" />
|
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" />
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox styleClass="vbox" maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" VBox.vgrow="ALWAYS">
|
<VBox maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="ALWAYS">
|
||||||
<children>
|
<children>
|
||||||
<Label maxHeight="1.7976931348623157E308" prefHeight="33.0" prefWidth="919.0" text="Plant Information:" VBox.vgrow="NEVER">
|
<Label maxHeight="1.7976931348623157E308" prefHeight="33.0" prefWidth="919.0" text="Plant Information:" VBox.vgrow="NEVER">
|
||||||
<font>
|
<font>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<Insets bottom="10.0" top="10.0" />
|
<Insets bottom="10.0" top="10.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Button styleClass="button-class" 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" />
|
<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>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<AnchorPane styleClass="custom-container" maxWidth="300.0" minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0">
|
<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>
|
<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">
|
<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>
|
<children>
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
</Label>
|
</Label>
|
||||||
<TitledPane animated="false" text="Seasons">
|
<TitledPane animated="false" text="Seasons">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane styleClass="custom-container" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||||
<children>
|
<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" />
|
<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>
|
</children>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</TitledPane>
|
</TitledPane>
|
||||||
<TitledPane animated="false" text="Climate Zones">
|
<TitledPane animated="false" text="Climate Zones">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane styleClass="custom-container" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||||
<children>
|
<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" />
|
<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>
|
</children>
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
<Separator prefWidth="50.0" visible="false" HBox.hgrow="ALWAYS" />
|
<Separator prefWidth="50.0" visible="false" HBox.hgrow="ALWAYS" />
|
||||||
<ButtonBar prefHeight="40.0" prefWidth="200.0">
|
<ButtonBar prefHeight="40.0" prefWidth="200.0">
|
||||||
<buttons>
|
<buttons>
|
||||||
<Button styleClass="button-class" cancelButton="true" contentDisplay="CENTER" graphicTextGap="5.0" mnemonicParsing="false" text="Close" onAction="#closeTutorial"/>
|
<Button cancelButton="true" contentDisplay="CENTER" graphicTextGap="5.0" mnemonicParsing="false" text="Close" onAction="#closeTutorial"/>
|
||||||
<Button styleClass="button-class" fx:id="previousPageButton" mnemonicParsing="false" text="Previous" onAction="#viewPreviousPage"/>
|
<Button fx:id="previousPageButton" mnemonicParsing="false" text="Previous" onAction="#viewPreviousPage"/>
|
||||||
<Button styleClass="button-class" fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" text="Next" onAction="#viewNextPage" />
|
<Button fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" text="Next" onAction="#viewNextPage" />
|
||||||
</buttons>
|
</buttons>
|
||||||
</ButtonBar>
|
</ButtonBar>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
.myDialog *.header-panel,
|
|
||||||
.myDialog *.header-panel .label {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-font-weight: bold;
|
|
||||||
}
|
|
||||||
.myDialog {
|
|
||||||
-fx-background-color: #EAFFE2;
|
|
||||||
-fx-border-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .button {
|
|
||||||
-fx-border-color: darkgreen;
|
|
||||||
-fx-border-radius: 4;
|
|
||||||
-fx-border-width: 1.5;
|
|
||||||
-fx-background-color: #D1FFB7;
|
|
||||||
-fx-font-weight: bold;
|
|
||||||
-fx-font-size: 13
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .check-box .box {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-border-color:grey;
|
|
||||||
-fx-border-radius: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box .list-cell
|
|
||||||
{
|
|
||||||
-fx-background-color: #D1FFB7;
|
|
||||||
-fx-text-fill: -fx-text-base-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-popup .list-view
|
|
||||||
{
|
|
||||||
-fx-background-color: darkgreen, darkgreen;
|
|
||||||
-fx-background-insets: 0, 1;
|
|
||||||
-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 8, 0.0 , 0 , 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-popup .list-view .list-cell
|
|
||||||
{
|
|
||||||
-fx-padding: 4 0 4 5;
|
|
||||||
|
|
||||||
/* No alternate highlighting */
|
|
||||||
-fx-background-color: #EAFFE2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-popup .list-view .list-cell:filled:selected, .combo-box-popup .list-view .list-cell:filled:selected:hover
|
|
||||||
{
|
|
||||||
-fx-background: -fx-accent;
|
|
||||||
-fx-text-fill: black;
|
|
||||||
-fx-background-color: #D1FFB7;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-popup .list-view .list-cell:filled:hover
|
|
||||||
{
|
|
||||||
-fx-text-fill: black;
|
|
||||||
-fx-background-color: #54B91C;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-base {
|
|
||||||
-fx-border-color: grey;
|
|
||||||
-fx-background-color: #D1FFB7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .combo-box-base:hover
|
|
||||||
{
|
|
||||||
-fx-color: #54B91C;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .radio-button .radio {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-border-color:grey;
|
|
||||||
-fx-border-radius: 25;
|
|
||||||
}
|
|
||||||
|
|
||||||
.myDialog .date-picker .button {
|
|
||||||
-fx-border-color: none;
|
|
||||||
-fx-background-color: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +1,10 @@
|
|||||||
.button-class {
|
|
||||||
-fx-border-color: darkgreen;
|
|
||||||
-fx-border-radius: 4;
|
|
||||||
-fx-border-width: 1.5;
|
|
||||||
-fx-background-color: #D1FFB7;
|
|
||||||
-fx-font-weight: bold;
|
|
||||||
-fx-font-size: 13
|
|
||||||
}
|
|
||||||
|
|
||||||
#home_button, #myGarden_button,
|
#home_button, #myGarden_button,
|
||||||
#mySchedule_button, #settings_button,
|
#mySchedule_button, #settings_button,
|
||||||
#tutorial_button, #menu_pane {
|
#tutorial_button, #menu_pane {
|
||||||
-fx-text-fill: white;
|
-fx-text-fill: white;
|
||||||
-fx-background-color: rgb(0,128,0);
|
-fx-background-color: rgb(0,128,0);
|
||||||
-fx-border-color: rgb(0,128,0);
|
|
||||||
-fx-border-radius: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#menubar {
|
#menubar {
|
||||||
@@ -22,64 +13,13 @@
|
|||||||
|
|
||||||
#home_button:hover, #myGarden_button:hover,
|
#home_button:hover, #myGarden_button:hover,
|
||||||
#mySchedule_button:hover, #settings_button:hover,
|
#mySchedule_button:hover, #settings_button:hover,
|
||||||
#tutorial_button:hover {
|
#tutorial_button:hover,
|
||||||
|
#home_button:focused, #myGarden_button:focused,
|
||||||
|
#mySchedule_button:focused, #settings_button:focused,
|
||||||
|
#tutorial_button:focused{
|
||||||
-fx-background-color: darkgreen;
|
-fx-background-color: darkgreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root, .scroll-pane, #homeVBox, #cropDetailVBox {
|
.root, .scroll-pane, #homeVBox, #cropDetailVBox {
|
||||||
-fx-background-color: #F3FFEC;
|
-fx-background-color: #e6ffe6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view {
|
|
||||||
-fx-border-color: black;
|
|
||||||
-fx-background-color: #EAFFE2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-cell:even:filled:selected:focused .label,
|
|
||||||
.list-cell:even:filled:selected .label,
|
|
||||||
.list-cell:even {
|
|
||||||
-fx-background-color: #EAFFE2;
|
|
||||||
-fx-text-fill: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-cell:odd:filled:selected:focused .label,
|
|
||||||
.list-cell:odd:filled:selected .label,
|
|
||||||
.list-cell:odd {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-text-fill: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
#list_plants .list-cell:even:filled:selected:focused,
|
|
||||||
#list_plants .list-cell:even:filled:selected,
|
|
||||||
#list_plants .list-cell:odd:filled:selected:focused,
|
|
||||||
#list_plants .list-cell:odd:filled:selected,
|
|
||||||
#scheduledPlants_listview .list-cell:even:filled:selected:focused,
|
|
||||||
#scheduledPlants_listview .list-cell:even:filled:selected,
|
|
||||||
#scheduledPlants_listview .list-cell:odd:filled:selected:focused,
|
|
||||||
#scheduledPlants_listview .list-cell:odd:filled:selected{
|
|
||||||
-fx-background-color: #7CD14B;
|
|
||||||
-fx-text-fill: white;
|
|
||||||
-fx-font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vbox, .custom-container {
|
|
||||||
-fx-background-color: #EAFFE2;
|
|
||||||
-fx-border-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.titled-pane > .title {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-border-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
|
||||||
-fx-font-size: 20;
|
|
||||||
-fx-font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.radio-button .radio {
|
|
||||||
-fx-background-color: #D3FFB5;
|
|
||||||
-fx-border-color:grey;
|
|
||||||
-fx-border-radius: 25;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ public class JsonTaskListTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSubscription() {
|
void testSubscription() throws IOException {
|
||||||
TaskList.TaskListObserver mockObs = Mockito.mock(TaskList.TaskListObserver.class);
|
TaskList.TaskListObserver mockObs = Mockito.mock(TaskList.TaskListObserver.class);
|
||||||
testDatabase.subscribe(mockObs);
|
testDatabase.subscribe(mockObs);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user