Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76197a19df | ||
|
|
56020a7529 | ||
|
|
5830ee5180 | ||
|
|
b3c7dd67e8 | ||
|
|
59c5d4be5a | ||
|
|
035f5d7fcd | ||
|
|
ccaff13df3 | ||
|
|
c9baf4dfb1 | ||
|
|
f54b39b1f2 | ||
|
|
00be979863 | ||
|
|
86386d8a91 | ||
|
|
d119fd1331 |
@@ -29,6 +29,7 @@ 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;
|
||||||
|
|
||||||
@@ -230,6 +231,8 @@ 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");
|
||||||
@@ -313,6 +316,10 @@ 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);
|
||||||
@@ -361,6 +368,10 @@ 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);
|
||||||
|
|
||||||
@@ -392,6 +403,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) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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;
|
||||||
|
|
||||||
@@ -89,6 +90,10 @@ 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);
|
||||||
|
|
||||||
@@ -156,7 +161,12 @@ public class MainFXMLController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void styleChangeButton(Button button) {
|
private void styleChangeButton(Button button) {
|
||||||
//ToDo changeStyle of the menu buttons
|
/*home_button.setStyle("-fx-background-color: rgb(0,128,0)");
|
||||||
|
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,6 +117,9 @@ 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));
|
||||||
@@ -186,6 +189,12 @@ 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.");
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ 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) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ 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;
|
||||||
|
|
||||||
@@ -82,6 +83,10 @@ 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,6 +12,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +92,10 @@ 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);
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -20,7 +20,7 @@ public class WeatherGradenTaskPlanner {
|
|||||||
private final PlantList plantList;
|
private final PlantList plantList;
|
||||||
private final CropList cropList;
|
private final CropList cropList;
|
||||||
WeatherService weatherService;
|
WeatherService weatherService;
|
||||||
private final LocalDate dateSevereWeather = LocalDate.of(2022,12,15);
|
private final LocalDate dateSevereWeather = LocalDate.now();
|
||||||
|
|
||||||
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
|
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
|
||||||
this.taskList = taskList;
|
this.taskList = taskList;
|
||||||
@@ -65,7 +65,7 @@ public class WeatherGradenTaskPlanner {
|
|||||||
|
|
||||||
Task preHailTask = new Task("Hail",
|
Task preHailTask = new Task("Hail",
|
||||||
"During a summer Thunderstorm it could hail heavily. THe Hail could damage the crops. To prevent damage cover the plants with a strong tarpaulin",
|
"During a summer Thunderstorm it could hail heavily. THe Hail could damage the crops. To prevent damage cover the plants with a strong tarpaulin",
|
||||||
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
|
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L),1L);
|
||||||
taskList.saveTask(preHailTask);
|
taskList.saveTask(preHailTask);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ public class WeatherGradenTaskPlanner {
|
|||||||
private void createPreFrostTask() throws IOException {
|
private void createPreFrostTask() throws IOException {
|
||||||
Task preFrostTask = new Task("Frost",
|
Task preFrostTask = new Task("Frost",
|
||||||
"The temperatur falls below zero degrees, cover especially the root with wool",
|
"The temperatur falls below zero degrees, cover especially the root with wool",
|
||||||
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
|
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L),1L);
|
||||||
taskList.saveTask(preFrostTask);
|
taskList.saveTask(preFrostTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public class WeatherGradenTaskPlanner {
|
|||||||
private void createPreSnowTask() throws IOException {
|
private void createPreSnowTask() throws IOException {
|
||||||
Task preSnowTask = new Task("Snow",
|
Task preSnowTask = new Task("Snow",
|
||||||
"The weather brings little snowfall. Cover your crops",
|
"The weather brings little snowfall. Cover your crops",
|
||||||
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L));
|
dateSevereWeather.minusDays(1L),dateSevereWeather.plusDays(1L),1L);
|
||||||
taskList.saveTask(preSnowTask);
|
taskList.saveTask(preSnowTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +114,6 @@ public class WeatherGradenTaskPlanner {
|
|||||||
/**
|
/**
|
||||||
* Method to set next execution date of the water plant tasks
|
* Method to set next execution date of the water plant tasks
|
||||||
* @param cropTaskList List with tasks from crops
|
* @param cropTaskList List with tasks from crops
|
||||||
* @throws IOException If the database cannot be accessed
|
|
||||||
* @throws HardinessZoneNotSetException If the hardiness zone is not available
|
|
||||||
* @throws PlantNotFoundException if the plant is not available for the watering task
|
|
||||||
*/
|
*/
|
||||||
private void adjustNextExecutionOfWateringTasks(List<Task> cropTaskList){
|
private void adjustNextExecutionOfWateringTasks(List<Task> cropTaskList){
|
||||||
for(Task task : cropTaskList){
|
for(Task task : cropTaskList){
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package ch.zhaw.gartenverwaltung.types;
|
package ch.zhaw.gartenverwaltung.types;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -55,10 +57,11 @@ public class Task {
|
|||||||
* @param startDate The start date of the task
|
* @param startDate The start date of the task
|
||||||
* @param endDate The maximum date on which the task should be executed
|
* @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, long cropId) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
|
nextExecution = startDate;
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +123,7 @@ public class Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public boolean isDone(){
|
public boolean isDone(){
|
||||||
return nextExecution == null;
|
return nextExecution == null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 mnemonicParsing="false" onAction="#goBack" prefHeight="25.0" prefWidth="91.0" text="Go Back">
|
<Button styleClass="button-class" 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 fx:id="cropName_label" text="Label">
|
<Label styleClass="page-title" 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 maxWidth="1.7976931348623157E308" prefHeight="231.0" prefWidth="555.0" HBox.hgrow="ALWAYS">
|
<GridPane styleClass="custom-container" 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,6 +72,9 @@
|
|||||||
</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>
|
||||||
@@ -86,7 +89,7 @@
|
|||||||
<Insets bottom="10.0" />
|
<Insets bottom="10.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</ListView>
|
</ListView>
|
||||||
<Button fx:id="addTask_button" mnemonicParsing="false" onAction="#addTask" prefHeight="25.0" prefWidth="45.0" VBox.vgrow="NEVER">
|
<Button styleClass="button-class" 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>
|
||||||
@@ -109,7 +112,7 @@
|
|||||||
<Insets right="10.0" />
|
<Insets right="10.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<Button fx:id="area_button" mnemonicParsing="false" onAction="#setArea" prefHeight="25.0" prefWidth="116.0" text="Set Area" />
|
<Button styleClass="button-class" 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 text="Garden Management">
|
<Label styleClass="page-title" 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 prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||||
<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 prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||||
<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 prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;">
|
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||||
<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 prefHeight="200.0" prefWidth="100.0" spacing="15.0" style="-fx-background-color: white; -fx-border-color: black;">
|
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="15.0">
|
||||||
<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 text="My Garden">
|
<Label styleClass="page-title" 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 fx:id="addPlant_button" mnemonicParsing="false" onAction="#addPlant" prefHeight="45.0" prefWidth="155.0" text="Add new Plant">
|
<Button styleClass="button-class" 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>
|
||||||
|
|||||||
@@ -12,7 +12,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 text="MySchedule" VBox.vgrow="NEVER">
|
<Label styleClass="page-title" text="MySchedule" VBox.vgrow="NEVER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="24.0" />
|
<Font size="24.0" />
|
||||||
</font>
|
</font>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</ListView>
|
</ListView>
|
||||||
<VBox prefHeight="131.0" prefWidth="603.0" spacing="5.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="NEVER">
|
<VBox styleClass="custom-container" prefHeight="131.0" prefWidth="603.0" spacing="5.0" 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 prefHeight="45.0" prefWidth="903.0" text="Plants" VBox.vgrow="NEVER">
|
<Label styleClass="page-title" 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 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">
|
<Pane styleClass="custom-container" maxHeight="1.7976931348623157E308" maxWidth="300.0" minWidth="300.0" prefHeight="200.0" prefWidth="200.0" 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 maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" style="-fx-background-color: white; -fx-border-color: black;" VBox.vgrow="ALWAYS">
|
<VBox styleClass="vbox" maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" 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 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 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" />
|
||||||
</children>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets />
|
<Insets />
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</AnchorPane>
|
</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;">
|
<AnchorPane styleClass="custom-container" maxWidth="300.0" minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0">
|
||||||
<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 minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane styleClass="custom-container" 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 minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane styleClass="custom-container" 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 cancelButton="true" contentDisplay="CENTER" graphicTextGap="5.0" mnemonicParsing="false" text="Close" onAction="#closeTutorial"/>
|
<Button styleClass="button-class" cancelButton="true" contentDisplay="CENTER" graphicTextGap="5.0" mnemonicParsing="false" text="Close" onAction="#closeTutorial"/>
|
||||||
<Button fx:id="previousPageButton" mnemonicParsing="false" text="Previous" onAction="#viewPreviousPage"/>
|
<Button styleClass="button-class" fx:id="previousPageButton" mnemonicParsing="false" text="Previous" onAction="#viewPreviousPage"/>
|
||||||
<Button fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" text="Next" onAction="#viewNextPage" />
|
<Button styleClass="button-class" fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" text="Next" onAction="#viewNextPage" />
|
||||||
</buttons>
|
</buttons>
|
||||||
</ButtonBar>
|
</ButtonBar>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
.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,10 +1,19 @@
|
|||||||
|
.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 {
|
||||||
@@ -13,13 +22,64 @@
|
|||||||
|
|
||||||
#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: #e6ffe6;
|
-fx-background-color: #F3FFEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+91
@@ -0,0 +1,91 @@
|
|||||||
|
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
|
||||||
|
|
||||||
|
import ch.zhaw.gartenverwaltung.io.*;
|
||||||
|
import ch.zhaw.gartenverwaltung.models.PlantNotFoundException;
|
||||||
|
import ch.zhaw.gartenverwaltung.types.*;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.MonthDay;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
public class WeatherGardenTaskPlannerTest {
|
||||||
|
private final URL testFile = JsonCropListTest.class.getResource("test-taskdb.json");
|
||||||
|
Plant examplePlantOnion;
|
||||||
|
Crop exampleCropOnion;
|
||||||
|
Task exampleTask;
|
||||||
|
Task exampleWeatherTask;
|
||||||
|
List<Crop> cropList;
|
||||||
|
List<Plant> plantList;
|
||||||
|
TaskList taskList;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
examplePlantOnion = 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<>(),
|
||||||
|
new WateringCycle(15, 3, null),
|
||||||
|
List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()),
|
||||||
|
new GrowthPhase(MonthDay.of(4, 3), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()),
|
||||||
|
new GrowthPhase(MonthDay.of(8, 5), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()),
|
||||||
|
new GrowthPhase(MonthDay.of(2, 8), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()),
|
||||||
|
new GrowthPhase(MonthDay.of(10, 2), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())));
|
||||||
|
|
||||||
|
exampleCropOnion = new Crop(examplePlantOnion.id(), LocalDate.of(2022, 12, 5))
|
||||||
|
.withId(3L);
|
||||||
|
exampleTask = new Task("water plant","water the plant until the ground is wet enough",LocalDate.now(), LocalDate.now().plusDays(2L),3L);
|
||||||
|
exampleTask.setNextExecution(LocalDate.now().plusDays(1L));
|
||||||
|
exampleWeatherTask = new Task("Hail",
|
||||||
|
"During a summer Thunderstorm it could hail heavily. THe Hail could damage the crops. To prevent damage cover the plants with a strong tarpaulin",
|
||||||
|
LocalDate.now().minusDays(1L),LocalDate.now().plusDays(1L),3L);
|
||||||
|
|
||||||
|
taskList = new JsonTaskList(testFile);
|
||||||
|
|
||||||
|
plantList = new ArrayList<>();
|
||||||
|
plantList.add(examplePlantOnion);
|
||||||
|
|
||||||
|
cropList = new ArrayList<>();
|
||||||
|
cropList.add(exampleCropOnion);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CropList mockCropList(List<Crop> cropList) throws IOException {
|
||||||
|
CropList croplist = mock(CropList.class);
|
||||||
|
when(croplist.getCrops()).thenReturn(cropList);
|
||||||
|
when(croplist.getCropById(3)).thenReturn(java.util.Optional.ofNullable(exampleCropOnion));
|
||||||
|
return croplist;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlantList mockPlantDatabase(List<Plant> plantList) throws HardinessZoneNotSetException, IOException {
|
||||||
|
PlantList plantDatabase = mock(JsonPlantList.class);
|
||||||
|
when(plantDatabase.getPlantList(HardinessZone.ZONE_8A)).thenReturn(plantList);
|
||||||
|
when(plantDatabase.getPlantById(HardinessZone.ZONE_8A,20)).thenReturn(Optional.of(plantList.get(0)));
|
||||||
|
return plantDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void refreshtasks() throws HardinessZoneNotSetException, IOException, PlantNotFoundException {
|
||||||
|
WeatherGradenTaskPlanner weatherGradenTaskPlanner = new WeatherGradenTaskPlanner(taskList, mockPlantDatabase(plantList), mockCropList(cropList));
|
||||||
|
taskList.saveTask(exampleTask);
|
||||||
|
weatherGradenTaskPlanner.refreshTasks();
|
||||||
|
assertEquals(exampleTask.getName(),taskList.getTaskList(LocalDate.now(),LocalDate.now().plusDays(7)).get(0).getName());
|
||||||
|
assertEquals(LocalDate.now().plusDays(2L),taskList.getTaskList(LocalDate.now(),LocalDate.now().plusDays(7)).get(0).getNextExecution());
|
||||||
|
assertEquals(exampleWeatherTask.getName(),taskList.getTaskList(LocalDate.now(),LocalDate.now().plusDays(7)).get(1).getName());
|
||||||
|
assertEquals(exampleWeatherTask.getStartDate(),taskList.getTaskList(LocalDate.now(),LocalDate.now().plusDays(7)).get(1).getStartDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
package ch.zhaw.gartenverwaltung.io;
|
package ch.zhaw.gartenverwaltung.io;
|
||||||
|
|
||||||
|
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||||
|
import ch.zhaw.gartenverwaltung.models.PlantNotFoundException;
|
||||||
|
import ch.zhaw.gartenverwaltung.types.Crop;
|
||||||
import ch.zhaw.gartenverwaltung.types.Task;
|
import ch.zhaw.gartenverwaltung.types.Task;
|
||||||
|
import javafx.application.Platform;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.ArgumentMatchers;
|
import org.mockito.ArgumentMatchers;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
@@ -13,6 +18,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
@@ -27,6 +33,22 @@ public class JsonTaskListTest {
|
|||||||
private final URL dbDataSource = this.getClass().getResource("test-taskdb.json");
|
private final URL dbDataSource = this.getClass().getResource("test-taskdb.json");
|
||||||
private final URL testFile = this.getClass().getResource("template-taskdb.json");
|
private final URL testFile = this.getClass().getResource("template-taskdb.json");
|
||||||
|
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUpAll() {
|
||||||
|
try{
|
||||||
|
Platform.startup(()->{});
|
||||||
|
}catch (IllegalStateException ise){
|
||||||
|
//ignore double launches
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
static void tearDownAll() {
|
||||||
|
//Dont do: Platform.exit();
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void connectToDb() throws URISyntaxException, IOException {
|
void connectToDb() throws URISyntaxException, IOException {
|
||||||
assertNotNull(testFile);
|
assertNotNull(testFile);
|
||||||
@@ -35,6 +57,10 @@ public class JsonTaskListTest {
|
|||||||
testDatabase = new JsonTaskList(dbDataSource);
|
testDatabase = new JsonTaskList(dbDataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadDb() {
|
||||||
|
testDatabase = new JsonTaskList(dbDataSource);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Check if results are retrieved completely")
|
@DisplayName("Check if results are retrieved completely")
|
||||||
void getTasks() {
|
void getTasks() {
|
||||||
@@ -47,7 +73,8 @@ public class JsonTaskListTest {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertEquals(3, taskList.size());
|
List<Long> ids = taskList.stream().map(t -> t.getId().orElse(0L)).toList();
|
||||||
|
Assertions.assertEquals(Arrays.asList(1L, 2L, 5L), ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +92,8 @@ public class JsonTaskListTest {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertEquals(4, taskList.size());
|
List<Long> ids = taskList.stream().map(t -> t.getId().orElse(0L)).toList();
|
||||||
|
Assertions.assertEquals(Arrays.asList(1L, 2L, 5L, 9L), ids);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -83,7 +111,8 @@ public class JsonTaskListTest {
|
|||||||
taskList = testDatabase.getTaskList(LocalDate.parse("2022-04-30", formatter),
|
taskList = testDatabase.getTaskList(LocalDate.parse("2022-04-30", formatter),
|
||||||
LocalDate.parse("2022-05-31", formatter));
|
LocalDate.parse("2022-05-31", formatter));
|
||||||
|
|
||||||
Assertions.assertEquals(2, taskList.size());
|
List<Long> ids = taskList.stream().map(t -> t.getId().orElse(0L)).toList();
|
||||||
|
Assertions.assertEquals(Arrays.asList(1L, 5L), ids);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -100,8 +129,8 @@ public class JsonTaskListTest {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertEquals(6, taskList.size());
|
List<Long> ids = taskList.stream().map(t -> t.getId().orElse(0L)).toList();
|
||||||
|
Assertions.assertEquals(Arrays.asList(1L, 2L, 3L, 4L, 5L, 6L), ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -116,10 +145,20 @@ public class JsonTaskListTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertEquals(0, taskList.size());
|
Assertions.assertEquals(0, taskList.size());
|
||||||
|
|
||||||
|
try {
|
||||||
|
taskList = testDatabase.getTaskForCrop(1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> ids = (taskList.stream().map( task -> task.getId().orElse(0L)).toList());
|
||||||
|
Assertions.assertEquals(Arrays.asList(7L, 8L), ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDefaultConstructor(){
|
void testDefaultConstructor() {
|
||||||
JsonTaskList db = new JsonTaskList();
|
JsonTaskList db = new JsonTaskList();
|
||||||
try {
|
try {
|
||||||
assertNotNull(db.getTaskForCrop(0));
|
assertNotNull(db.getTaskForCrop(0));
|
||||||
@@ -138,6 +177,43 @@ public class JsonTaskListTest {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
verify(mockObs, times(1)).onChange(ArgumentMatchers.anyList());
|
|
||||||
|
ArgumentCaptor<List<Task>> captor = ArgumentCaptor.forClass(List.class);
|
||||||
|
|
||||||
|
verify(mockObs, times(1)).onChange(captor.capture());
|
||||||
|
List<Long> ids = captor.getValue().stream().map(t -> t.getId().orElse(0L)).toList();
|
||||||
|
Assertions.assertEquals(Arrays.asList(7L, 8L), ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Tag("IntegrationTest")
|
||||||
|
void testComplete() {
|
||||||
|
JsonPlantList plantList = new JsonPlantList();
|
||||||
|
try {
|
||||||
|
testDatabase.removeTasksForCrop(0);
|
||||||
|
testDatabase.removeTasksForCrop(1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
GardenSchedule gardenSchedule = null;
|
||||||
|
try {
|
||||||
|
gardenSchedule = new GardenSchedule(testDatabase, plantList);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
Crop crop = new Crop(3L, LocalDate.parse("2022-12-01", formatter));
|
||||||
|
|
||||||
|
try {
|
||||||
|
gardenSchedule.planTasksForCrop(crop);
|
||||||
|
|
||||||
|
reloadDb();
|
||||||
|
|
||||||
|
List<Task> tasks = gardenSchedule.getTaskList();
|
||||||
|
List<String> tasknames = (tasks.stream().map( task -> task.getName().substring(0,3).toLowerCase()).toList());
|
||||||
|
Assertions.assertEquals(Arrays.asList("ger","wat","hil","har"), tasknames);
|
||||||
|
} catch (IOException | PlantNotFoundException | HardinessZoneNotSetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,9 @@ package ch.zhaw.gartenverwaltung.models;
|
|||||||
import ch.zhaw.gartenverwaltung.io.*;
|
import ch.zhaw.gartenverwaltung.io.*;
|
||||||
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||||
import ch.zhaw.gartenverwaltung.types.*;
|
import ch.zhaw.gartenverwaltung.types.*;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -29,6 +32,21 @@ class GardenScheduleTest {
|
|||||||
List<TaskTemplate> exampleTaskTemplateList;
|
List<TaskTemplate> exampleTaskTemplateList;
|
||||||
GardenSchedule model;
|
GardenSchedule model;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUpAll() {
|
||||||
|
try{
|
||||||
|
Platform.startup(()->{});
|
||||||
|
}catch (IllegalStateException ise){
|
||||||
|
//ignore double launches
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
static void tearDownAll() {
|
||||||
|
//Dont do: Platform.exit();
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() throws IOException, HardinessZoneNotSetException {
|
void setUp() throws IOException, HardinessZoneNotSetException {
|
||||||
createExampleTaskList();
|
createExampleTaskList();
|
||||||
@@ -221,5 +239,8 @@ class GardenScheduleTest {
|
|||||||
testTaskList.getTaskList(LocalDate.MIN,LocalDate.MAX).get(0);
|
testTaskList.getTaskList(LocalDate.MIN,LocalDate.MAX).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testPlantNotFoundException() throws HardinessZoneNotSetException, IOException {
|
||||||
|
assertThrowsExactly(PlantNotFoundException.class, () -> { model.planTasksForCrop(new Crop(0, exampleStartDate)); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[
|
||||||
|
]
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
"name" : "fertilize plant",
|
"name" : "fertilize plant",
|
||||||
"description": "The fertilizer has to be mixed with water. Then fertilize the plants soil with the mixture",
|
"description": "The fertilizer has to be mixed with water. Then fertilize the plants soil with the mixture",
|
||||||
"startDate" : "2022-06-01",
|
"startDate" : "2022-06-01",
|
||||||
"nextExecution": "2022-05-01",
|
"nextExecution": "2022-06-01",
|
||||||
"nextNotification": "2022-05-01",
|
"nextNotification": "2022-06-01",
|
||||||
"endDate" : "2022-08-01",
|
"endDate" : "2022-08-01",
|
||||||
"interval" : 28,
|
"interval" : 28,
|
||||||
"cropId" : 0
|
"cropId" : 0
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
"name" : "covering plant",
|
"name" : "covering plant",
|
||||||
"description": "Take a big enough coverage for the plants. Cover the whole plant with a bit space between the plant and the coverage",
|
"description": "Take a big enough coverage for the plants. Cover the whole plant with a bit space between the plant and the coverage",
|
||||||
"startDate" : "2022-07-01",
|
"startDate" : "2022-07-01",
|
||||||
"nextExecution": "2022-05-01",
|
"nextExecution": "2022-07-01",
|
||||||
"nextNotification": "2022-05-01",
|
"nextNotification": "2022-07-01",
|
||||||
"endDate" : "2022-07-01",
|
"endDate" : "2022-07-01",
|
||||||
"interval" : 0,
|
"interval" : 0,
|
||||||
"cropId" : 0
|
"cropId" : 0
|
||||||
@@ -59,10 +59,32 @@
|
|||||||
"name" : "harvest plant",
|
"name" : "harvest plant",
|
||||||
"description": "Pull the ripe vegetables out from the soil. Clean them with clear, fresh water. ",
|
"description": "Pull the ripe vegetables out from the soil. Clean them with clear, fresh water. ",
|
||||||
"startDate" : "2022-09-01",
|
"startDate" : "2022-09-01",
|
||||||
"nextExecution": "2022-05-01",
|
"nextExecution": "2022-09-01",
|
||||||
"nextNotification": "2022-05-01",
|
"nextNotification": "2022-09-01",
|
||||||
"endDate" : "2022-09-01",
|
"endDate" : "2022-09-01",
|
||||||
"interval" : 0,
|
"interval" : 0,
|
||||||
"cropId" : 0
|
"cropId" : 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 7,
|
||||||
|
"name" : "sow plant",
|
||||||
|
"description": "Plant the seeds, crops in de bed.",
|
||||||
|
"startDate" : "2022-11-01",
|
||||||
|
"nextExecution": "2022-11-01",
|
||||||
|
"nextNotification": "2022-11-01",
|
||||||
|
"endDate" : "2022-11-01",
|
||||||
|
"interval" : 0,
|
||||||
|
"cropId" : 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 8,
|
||||||
|
"name" : "harvest plant",
|
||||||
|
"description": "Pull the ripe vegetables out from the soil. Clean them with clear, fresh water. ",
|
||||||
|
"startDate" : "2022-12-01",
|
||||||
|
"nextExecution": "2022-12-01",
|
||||||
|
"nextNotification": "2022-12-01",
|
||||||
|
"endDate" : "2022-12-01",
|
||||||
|
"interval" : 0,
|
||||||
|
"cropId" : 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user