Compare commits

...

87 Commits

Author SHA1 Message Date
giavaphi 6e98517013 Merge pull request #90 from schrom01/dev
Update of Readme and removed old Documents
2022-12-11 17:53:11 +01:00
schrom01 a81c073407 updated README.md 2022-12-11 17:50:39 +01:00
schrom01 aa9c543624 Merge remote-tracking branch 'origin/dev' into dev 2022-12-11 17:49:44 +01:00
schrom01 95748c79b1 updated README.md 2022-12-11 17:49:20 +01:00
giavaphi 01ddb38ccb Merge pull request #89 from schrom01/dev
Final Version for M3 Beta Release
2022-12-11 17:15:50 +01:00
giavaphi 3a50c2655d delete of unused todos 2022-12-11 17:09:49 +01:00
giavaphi de01503598 Merge pull request #88 from schrom01/feature_weather
Feature weather
2022-12-11 17:02:59 +01:00
giavaphi a8a693296e delete unused function 2022-12-11 16:45:07 +01:00
giavaphi a519393fc7 small change garden plant description 2022-12-11 16:23:05 +01:00
Gian-Andrea Hutter 2864c54c72 Merge branch 'dev' into feature_weather 2022-12-11 16:16:34 +01:00
Gian-Andrea Hutter a20edae4b8 #23 refactoring of the WeatherGradenTaskPlanner 2022-12-11 16:16:06 +01:00
giavaphi 2dd8cffda2 delete unused imports 2022-12-11 16:06:16 +01:00
giavaphi 3f51adcbd0 show screenshots in tutorial 2022-12-11 16:04:28 +01:00
giavaphi 4acd328286 Merge pull request #87 from schrom01/feature_tutorial-screenshots_M3
added screenshot pngs (whoops)
2022-12-11 15:29:36 +01:00
Gian-Andrea Hutter dbba4e2662 Merge branch 'dev' into feature_weather 2022-12-11 15:15:19 +01:00
schrom01 6aeda395c3 Javadocs and code cleanup 2022-12-11 14:58:15 +01:00
schrom01 7741569659 Javadocs and code cleanup 2022-12-11 14:57:59 +01:00
schrom01 27b8d1754e Javadocs and code cleanup 2022-12-11 14:25:57 +01:00
David Guler 06c4c47e44 added screenshot pngs 2022-12-11 09:23:53 +01:00
giavaphi dc0830120f small fixes 2022-12-11 07:59:34 +01:00
giavaphi 39bff805ac small fixes 2022-12-11 07:44:03 +01:00
giavaphi 3ebbb0e0e3 small fixes 2022-12-11 07:19:06 +01:00
Roman Schenk 8a2119028c Merge pull request #86 from schrom01/fix_tasklist_filteringPastTasks
Fix tasklist filtering past tasks
2022-12-10 14:00:24 +01:00
giavaphi 083d934472 Merge pull request #85 from schrom01/feature_weather
#23 bugfix testclass WeatherGradenTaskPlannerTest and bugfix Task and…
2022-12-10 13:58:26 +01:00
schrom01 1b096035a7 Merge branch 'dev' into fix_tasklist_filteringPastTasks 2022-12-10 13:54:42 +01:00
schrom01 0074d43364 fixed problem "showing task multiple times in in schedule" 2022-12-10 13:52:33 +01:00
Gian-Andrea Hutter 08d40d8b80 Merge branch 'dev' into feature_weather 2022-12-10 13:48:50 +01:00
Gian-Andrea Hutter 3bda390708 #23 bugfix testclass WeatherGradenTaskPlannerTest and bugfix Task and WeatherGradenTaskPlanner 2022-12-10 13:47:54 +01:00
Roman Schenk c6952aba55 Merge pull request #81 from schrom01/feature_updaeTaskListViewOnUpdate_M3
show all tasks in scheduler
2022-12-10 13:41:04 +01:00
Roman Schenk 807a9017ad Merge pull request #82 from schrom01/fix_tasklist_filteringPastTasks
Fix tasklist filtering past tasks
2022-12-10 13:40:55 +01:00
Roman Schenk c134025408 Merge pull request #83 from schrom01/tests_extended_M3
extending tests and adding integration test
2022-12-10 13:40:46 +01:00
Roman Schenk 1e95e0ff30 Merge pull request #84 from schrom01/feature_tutorial-screenshots_M3
added screenshots to tutorial
2022-12-10 13:40:38 +01:00
David Guler fb21797040 added screenshots to tutorial 2022-12-10 13:22:40 +01:00
Elias Csomor 76197a19df extending tests and adding integration test
and better precision when comparing results
2022-12-10 12:48:06 +01:00
schrom01 5f7d690875 fixed not showing past tasks 2022-12-09 21:27:13 +01:00
giavaphi 96dc0ad827 fix show all tasks 2022-12-09 19:38:22 +01:00
Elias Csomor 56020a7529 Setup Platform for runLater in GardenSchedule
Otherwise Test planTaskForCrop crashes due to unitialized Platform
2022-12-09 17:35:41 +01:00
Elias Csomor 5830ee5180 fixing execution and notification dates in test db 2022-12-09 17:13:05 +01:00
David Guler b3c7dd67e8 fix: remove "done" field from json serialisation 2022-12-09 15:27:21 +01:00
giavaphi 59c5d4be5a Merge pull request #80 from schrom01/feature_guiOverhaul_M3
css style update
2022-12-09 14:20:02 +01:00
giavaphi 035f5d7fcd Merge pull request #79 from schrom01/feature_updaeTaskListViewOnUpdate_M3
update tasks with subscription from JsonTaskList
2022-12-09 14:18:56 +01:00
giavaphi 4d2057d0df fix update scheduler 2022-12-09 14:16:12 +01:00
gulerdav ccaff13df3 Merge pull request #78 from schrom01/feature_weather
Feature weather
2022-12-09 12:59:53 +01:00
gulerdav c9baf4dfb1 Merge branch 'dev' into feature_weather 2022-12-09 12:59:43 +01:00
giavaphi f54b39b1f2 updated style 2022-12-09 06:59:37 +01:00
giavaphi 45035e565c update tasks with subscription from JsonTaskList 2022-12-09 01:27:37 +01:00
Gian-Andrea Hutter 00be979863 #23 implemented test class for WeatherGradenTaskPlanner 2022-12-09 00:08:32 +01:00
Gian-Andrea Hutter 86386d8a91 #23 implemented test class for WeatherGradenTaskPlanner 2022-12-09 00:02:21 +01:00
David Guler c7b23335b5 doc: javadoc for types 2022-12-05 15:26:10 +01:00
gulerdav 7c015d78f4 Merge pull request #76 from schrom01/feature_guiOverhaul_M3
changesFXMLFile_and_JavaDocControllerFiles
2022-12-05 13:15:36 +01:00
gulerdav dd09fad581 Merge branch 'dev' into feature_guiOverhaul_M3 2022-12-05 13:08:47 +01:00
gulerdav 952a6a16d2 Merge pull request #77 from schrom01/feature_weather
Feature Background Tasks (weather and Notifications)
2022-12-05 13:05:28 +01:00
Gian-Andrea Hutter d119fd1331 Merge branch 'dev' into feature_weather 2022-12-05 11:40:53 +01:00
Gian-Andrea Hutter 28f76e7a04 #23 documentation 2022-12-05 11:40:09 +01:00
Gian-Andrea Hutter 0fa2b81427 #23 bugfix adjust task 2022-12-05 11:02:15 +01:00
gulerdav 92ee656a5d Merge pull request #75 from schrom01/fix_imageLoad_M3
fixed image loading when app is packed as jar
2022-12-05 10:59:41 +01:00
giavaphi d725367f4d JavaDoc for controller classes 2022-12-05 01:56:15 +01:00
giavaphi 0257dd9bf0 fxml files changes + first style 2022-12-05 01:12:18 +01:00
Gian-Andrea Hutter d0c6525d7a Merge remote-tracking branch 'origin/feature_weather' into feature_weather 2022-12-04 16:32:51 +01:00
Gian-Andrea Hutter a29066ed05 #23 bugfix adjust task 2022-12-04 16:32:30 +01:00
schrom01 564cecd4ff Merge remote-tracking branch 'origin/feature_weather' into feature_weather 2022-12-01 23:46:08 +01:00
schrom01 2f5440696f Cleanup of Class BackgroundTasks, added Logger 2022-12-01 23:45:53 +01:00
Gian-Andrea Hutter 5e42cae290 #23 bugfix adjust task 2022-11-29 21:55:42 +01:00
schrom01 028bc0240d Merged Notification Branch with Weather Branch 2022-11-29 12:25:54 +01:00
schrom01 8ecc14db91 Merged Notification Branch with Weather Branch 2022-11-29 12:19:45 +01:00
Gian-Andrea Hutter c16f99aabc Merge remote-tracking branch 'origin/feature_weather' into feature_weather 2022-11-29 12:13:01 +01:00
Gian-Andrea Hutter 6ec0ccaeaa #23 bugfix GardenScheduleTest and PlantTest 2022-11-29 12:12:18 +01:00
schrom01 55f92f92bd Merged Notification Branch with Weather Branch 2022-11-29 12:12:16 +01:00
schrom01 fd28ca7cc2 Merged Notification Branch with Weather Branch 2022-11-29 11:55:49 +01:00
schrom01 1faf1c10de Merge branch 'feature_notification_m3' into feature_weather
# Conflicts:
#	src/main/java/ch/zhaw/gartenverwaltung/bootstrap/AppLoader.java
2022-11-29 11:41:28 +01:00
Gian-Andrea Hutter f43bfeebd2 #23 bugfix plantdb.json 2022-11-29 11:32:20 +01:00
schrom01 220d138185 fixed saving Task after editing 2022-11-28 19:31:08 +01:00
Gian-Andrea Hutter aa87a23f7d Merge branch 'dev' into feature_weather
# Conflicts:
#	src/test/java/ch/zhaw/gartenverwaltung/models/GardenScheduleTest.java
2022-11-28 13:54:47 +01:00
Gian-Andrea Hutter eccb519bfb #23 watering task refactor 2022-11-28 13:53:47 +01:00
Gian-Andrea Hutter cae6f950ad #23 comments added 2022-11-28 10:20:00 +01:00
schrom01 fd184e1248 implemented Exception handling in EMailSender 2022-11-28 09:11:37 +01:00
schrom01 fbf1700c34 implemented EMailSender 2022-11-28 08:00:31 +01:00
Gian-Andrea Hutter 233ce6b088 #23 add Task generation watertask 2022-11-27 23:42:29 +01:00
Gian-Andrea Hutter 4072308ae6 #23 Implementation of Gardenschedule for wateringtask adjustment 2022-11-27 10:13:11 +01:00
Gian-Andrea Hutter 65b15b6a4c Merge remote-tracking branch 'origin/feature_weather' into feature_weather 2022-11-26 11:59:06 +01:00
Gian-Andrea Hutter 9424c8713f Merge branch 'dev' into feature_weather 2022-11-26 11:57:34 +01:00
schrom01 2d88c9ea91 implemented multithreading 2022-11-25 12:58:03 +01:00
David Guler 07569b83e1 fix: syntax errors 2022-11-25 12:39:10 +01:00
schrom01 e48be29d59 Merge branch 'feature_taskList_m2' into feature_notification_m3 2022-11-25 11:14:47 +01:00
schrom01 a437236788 created Class Notifier 2022-11-24 23:45:33 +01:00
Gian-Andrea Hutter d2b8fe4ba2 #23 small adjustments 2022-11-22 14:48:09 +01:00
Gian-Andrea Hutter 670938ef85 #23 added constructor in Task class, implemented SevereWeather, WeatherService, WeatherGradenTaskPlanner 2022-11-22 14:44:56 +01:00
81 changed files with 2401 additions and 1066 deletions

View File

@ -1,32 +1,19 @@
# PM3-HS22-IT21b_WIN-Team1 # GardenPlanner
PM3 FivePlants Gartenverwaltung
## Class Diagram ## Installations- und Gebrauchsanweisung
Umletino: https://www.umletino.com/umletino.html ### Vorbedingungen
- Das Java Runtime Environment (JRE) muss in der Version 17 auf Ihrem Computer installiert sein.
- Das Java Development Kit (JDK) muss in der Version 17 auf Ihrem Computer installiert sein.
Draft File: doc/ClassDiagramDraft.uxf ### Installation und Starten der Applikation
1. Laden sie die neuste Version der Applikation herunter. Sie finden die Applikation hier:
https://github.zhaw.ch/schrom01/PM3-HS22-IT21b_WIN-Team1/tags
2. Extrahieren sie die heruntergeladene ZIP-Datei
3. Öffnen sie ein Kommandozeilenfenster und navigieren sie an den Speicherort der Entpack-ten Applikation.
4. Führen sie den Befehl: «./gradlew.bat run» (auf Windows) oder «./gradlew run» (auf ma-cOS und Linux) aus.
## Branch model ### Anwendung
- production branch: `main` Eine Bedienungsanleitung finden Sie im Dokument ["Technischer Bericht II"](doc/PM3-HS22-IT21b_WIN-Technischer_Bericht_II-Team1.pdf) im Kapitel 6.3.3.
This branch has a working version of the code. ## Projektdokumentation
Die gesamte Projektdokumentation ist im Dokument ["Technischer Bericht II"](doc/PM3-HS22-IT21b_WIN-Technischer_Bericht_II-Team1.pdf) zu finden.
- development branch: `dev`
This branch should contain a running (although not necessarily working) version of the code. Working states are to be merged into the `main` branch regularly.
- feature: `feature_xy_<Milestone>`
These branches contain features in active development. When the code is ready it will be merged into the `dev` branch.
- bugfix: `bugfix_xy_<Milestone>`
These branches are for bugfixes.
- documentation: `doc_xy_<Milestone>`
These branches are for javadoc and project documentation (such as the readme, class diagrams etc.).
## User Manual
- Search Plant List: if first Char is '#': only exact match in ID.

View File

@ -26,7 +26,7 @@ tasks.withType(JavaCompile) {
application { application {
mainModule = 'ch.zhaw.gartenverwaltung' mainModule = 'ch.zhaw.gartenverwaltung'
mainClass = 'ch.zhaw.gartenverwaltung.HelloApplication' mainClass = 'ch.zhaw.gartenverwaltung.Main'
} }
javafx { javafx {
@ -42,6 +42,8 @@ dependencies {
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4'
testImplementation 'org.mockito:mockito-core:4.3.+' testImplementation 'org.mockito:mockito-core:4.3.+'
implementation 'com.sun.mail:javax.mail:1.6.2'
} }
test { test {

View File

@ -1,92 +0,0 @@
<diagram program="umletino" version="15.0.0"><zoom_level>10</zoom_level><element><id>UMLClass</id><coordinates><x>720</x><y>30</y><w>100</w><h>30</h></coordinates><panel_attributes>Main</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1240</x><y>250</y><w>300</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
PlantDatabase
--
+ getPlantList(zone: HardinessZone): List&lt;Plant&gt;
+ getPlant(id: long): Optional&lt;Plant&gt;</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>940</x><y>580</y><w>220</w><h>40</h></coordinates><panel_attributes>TaskListController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1240</x><y>10</y><w>300</w><h>180</h></coordinates><panel_attributes>&lt;&lt;Record&gt;&gt;
Plant
--
+ id: long
+ name: String
+ description: String
+ spacing: int
+ lifecycle: List&lt;GrowthPhase&gt;
--
+ calculateStartDate(harvestDate: Date): Date
+ generateTasks()
</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1210</x><y>580</y><w>210</w><h>120</h></coordinates><panel_attributes>TaskListModel
--
- tasks: ListProperty&lt;Task&gt;
- taskDb: TaskDatabase
--
+ getTask(id: long): Optional&lt;Task&gt;
+ saveTask(task: Task)
+ removeTask(task: Task)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>590</x><y>560</y><w>250</w><h>110</h></coordinates><panel_attributes>GardenPlanModel
--
- tasks: ListProperty&lt;Task&gt;
- gardenPlan: GardenPlan
--
+ savePlanting(planting: UserPlanting)
+ removePlanting(planting: UserPlanting)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>340</x><y>550</y><w>180</w><h>80</h></coordinates><panel_attributes>GardenPlanController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1660</x><y>720</y><w>490</w><h>240</h></coordinates><panel_attributes>Task
--
+ id: long
+ name: String {readOnly}
+ description: String {readOnly}
+ startDate: Date {readOnly}
+ isReadOnly: boolean {readOnly}
- interval: int
- endDate: Date
--
+ Task(name: String, description: String, startDate: String, isReadOnly: boolean): Task
+ withInterval(interval: int): Task
+ withEndDate(endDate: Date): Task
+ withId(id: long): Task
--
+ getInterval(): Optional&lt;int&gt;
+ getEndDate(): Optional&lt;Date&gt;</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1170</x><y>760</y><w>280</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
TaskDatabase
--
+ getTaskList(start: Date, end: Date): List&lt;Task&gt;
+ saveTask(Task task) throws ??Exception
+ removeTask(Task task) throws ??Exception</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>780</x><y>310</y><w>100</w><h>100</h></coordinates><panel_attributes>MainWindow</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>440</x><y>180</y><w>180</w><h>130</h></coordinates><panel_attributes>MainWindowController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1340</x><y>1070</y><w>210</w><h>70</h></coordinates><panel_attributes>NotificationService
--
- taskDb: TaskDatabase
--
+ tick()</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1640</x><y>1210</y><w>240</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
WeatherProvider
--
+ getWeatherForecast: WeatherForecast</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1620</x><y>1040</y><w>400</w><h>100</h></coordinates><panel_attributes>WeatherService
--
- weatherPovider: WeatherProvider
- taskDb: TaskDatabase
--
+ WeatherService(provider: WeatherProvider, taskDb: TaskDatabase)
- updateTasks()</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1620</x><y>10</y><w>260</w><h>150</h></coordinates><panel_attributes>&lt;&lt;Record&gt;&gt;
GrowthPhase
--
+ startDate: Date
+ endDate: Date
+ type: GrowthPhaseType
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1530</x><y>80</y><w>110</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>90;10;10;10</additional_attributes></element><element><id>Text</id><coordinates><x>420</x><y>0</y><w>190</w><h>70</h></coordinates><panel_attributes>Note:
--
{final, readOnly} omitted on public data fields in &lt;&lt;Record&gt;&gt; Entities for clarity
style=wordwrap</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1440</x><y>820</y><w>240</w><h>30</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>220;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1300</x><y>690</y><w>30</w><h>90</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;70;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>600</x><y>980</y><w>210</w><h>120</h></coordinates><panel_attributes>&lt;&lt;Record&gt;&gt;
UserPlanting
--
+ plantId: long
+ asSowing: boolean
+ startDate: Date
+ area: int</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1380</x><y>180</y><w>30</w><h>90</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;10;70</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1950</x><y>10</y><w>140</w><h>120</h></coordinates><panel_attributes>&lt;&lt;Enumeration&gt;&gt;
GrowthPhaseType
--
SOW
PLANT
HARVEST</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1870</x><y>70</y><w>100</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1150</x><y>590</y><w>80</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>60;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>700</x><y>890</y><w>30</w><h>110</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;90;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>510</x><y>580</y><w>100</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>570</x><y>760</y><w>280</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
GardenPlan
--
+ getPlantings(): List&lt;UserPlanting&gt;
+ addPlanting(plantId: long, startDate)
+ savePlanting(planting: UserPlanting)
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>690</x><y>660</y><w>30</w><h>120</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;100;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>60</x><y>390</y><w>180</w><h>80</h></coordinates><panel_attributes>PlantingCell
{extends ListCell&lt;&gt;}</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>0</x><y>540</y><w>290</w><h>80</h></coordinates><panel_attributes>PlantingCellFactory
{implements Callback&lt;ListView&lt;UserPlanting&gt; &gt;}</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>140</x><y>460</y><w>30</w><h>100</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;10;80</additional_attributes></element><element><id>Relation</id><coordinates><x>1750</x><y>1130</y><w>30</w><h>100</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;80;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1350</x><y>890</y><w>120</w><h>200</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;100;180</additional_attributes></element><element><id>Relation</id><coordinates><x>1380</x><y>890</y><w>260</w><h>220</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;240;200</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1090</x><y>1060</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonTaskDatabase</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1180</x><y>890</y><w>30</w><h>190</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>10;10;10;170</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1620</x><y>310</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonPlantDatabase</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1530</x><y>320</y><w>110</w><h>30</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>10;10;90;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>300</x><y>800</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonGardenPlan</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>490</x><y>810</y><w>100</w><h>30</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>280</x><y>570</y><w>80</w><h>30</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;60;10</additional_attributes></element><element><id>Relation</id><coordinates><x>850</x><y>400</y><w>220</w><h>200</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>200;180;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>440</x><y>400</y><w>390</w><h>170</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;150;370;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>850</x><y>120</y><w>160</w><h>60</h></coordinates><panel_attributes>PlantListController</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>760</x><y>50</y><w>90</w><h>280</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>70;260;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>610</x><y>230</y><w>190</w><h>140</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;10;170;120</additional_attributes></element><element><id>Relation</id><coordinates><x>870</x><y>170</y><w>80</w><h>210</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>60;10;10;190</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1020</x><y>290</y><w>160</w><h>60</h></coordinates><panel_attributes>PlantListModel</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1000</x><y>150</y><w>110</w><h>160</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>90;140;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1170</x><y>310</y><w>90</w><h>30</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>70;10;10;10</additional_attributes></element></diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,7 +0,0 @@
<diagram program="umletino" version="15.0.0"><zoom_level>10</zoom_level><element><id>UMLPackage</id><coordinates><x>390</x><y>60</y><w>340</w><h>100</h></coordinates><panel_attributes>UI</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>390</x><y>180</y><w>460</w><h>120</h></coordinates><panel_attributes>Domain</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>390</x><y>330</y><w>460</w><h>120</h></coordinates><panel_attributes>Technical Services</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>400</x><y>90</y><w>100</w><h>60</h></coordinates><panel_attributes>Views (JFX)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>400</x><y>220</y><w>100</w><h>60</h></coordinates><panel_attributes>IO</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>400</x><y>370</y><w>100</w><h>60</h></coordinates><panel_attributes>Jackson</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>510</x><y>220</y><w>100</w><h>60</h></coordinates><panel_attributes>Types</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>620</x><y>220</y><w>100</w><h>60</h></coordinates><panel_attributes>Models</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>510</x><y>90</y><w>110</w><h>60</h></coordinates><panel_attributes>Controllers (JFX)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>510</x><y>370</y><w>100</w><h>60</h></coordinates><panel_attributes>Logging</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>620</x><y>370</y><w>100</w><h>60</h></coordinates><panel_attributes>JavaFX</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>730</x><y>220</y><w>110</w><h>60</h></coordinates><panel_attributes>Services</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLPackage</id><coordinates><x>730</x><y>370</y><w>110</w><h>60</h></coordinates><panel_attributes>HTTP/API</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>570</x><y>150</y><w>90</w><h>70</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>70;10;10;50</additional_attributes></element><element><id>Relation</id><coordinates><x>570</x><y>290</y><w>110</w><h>80</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>90;10;10;60</additional_attributes></element><element><id>Relation</id><coordinates><x>340</x><y>120</y><w>350</w><h>400</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>60;10;10;10;10;380;330;380;330;310</additional_attributes></element><element><id>Relation</id><coordinates><x>770</x><y>270</y><w>30</w><h>120</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>10;10;10;100</additional_attributes></element><element><id>Relation</id><coordinates><x>360</x><y>250</y><w>60</w><h>180</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>40;10;10;10;10;160;40;160</additional_attributes></element><element><id>Relation</id><coordinates><x>610</x><y>120</y><w>70</w><h>120</h></coordinates><panel_attributes>lt=.&gt;
</panel_attributes><additional_attributes>10;10;50;10;50;100</additional_attributes></element></diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

View File

@ -1,144 +0,0 @@
<diagram program="umletino" version="15.0.0"><zoom_level>10</zoom_level><element><id>UMLClass</id><coordinates><x>482</x><y>360</y><w>100</w><h>30</h></coordinates><panel_attributes>Main</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1082</x><y>380</y><w>370</w><h>100</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
PlantDatabase
--
+ getPlantList(zone: HardinessZone): List&lt;Plant&gt;
+ getPlantById(zone: HardinessZone id: long): Optional&lt;Plant&gt;</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>672</x><y>710</y><w>220</w><h>40</h></coordinates><panel_attributes>TaskListController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1132</x><y>110</y><w>300</w><h>180</h></coordinates><panel_attributes>&lt;&lt;Record&gt;&gt;
Plant
--
+ id: long
+ name: String
+ description: String
+ spacing: int
+ lifecycle: List&lt;GrowthPhase&gt;
--
+ calculateStartDate(harvestDate: Date): Date
+ generateTasks()
</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>942</x><y>710</y><w>210</w><h>120</h></coordinates><panel_attributes>TaskListModel
--
- tasks: ListProperty&lt;Task&gt;
- taskDb: TaskDatabase
--
+ getTask(id: long): Optional&lt;Task&gt;
+ saveTask(task: Task)
+ removeTask(task: Task)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>322</x><y>690</y><w>250</w><h>120</h></coordinates><panel_attributes>GardenPlanModel
--
- tasks: ListProperty&lt;Crop&gt;
- gardenPlan: GardenPlan
--
+ plantAsCrop(planting: UserPlanting)
+ removePlanting(planting: UserPlanting)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>72</x><y>680</y><w>180</w><h>80</h></coordinates><panel_attributes>GardenPlanController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1362</x><y>830</y><w>490</w><h>240</h></coordinates><panel_attributes>Task
--
+ id: long
+ name: String {readOnly}
+ description: String {readOnly}
+ startDate: Date {readOnly}
+ isOptional: boolean {readOnly}
- interval: int
- endDate: Date
--
+ Task(name: String, description: String, startDate: String, isReadOnly: boolean): Task
+ withInterval(interval: int): Task
+ withEndDate(endDate: Date): Task
+ withId(id: long): Task
--
+ getInterval(): Optional&lt;int&gt;
+ getEndDate(): Optional&lt;Date&gt;</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>902</x><y>930</y><w>280</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
TaskDatabase
--
+ getTaskList(start: Date, end: Date): List&lt;Task&gt;
+ saveTask(Task task) throws ??Exception
+ removeTask(Task task) throws ??Exception</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>442</x><y>440</y><w>170</w><h>80</h></coordinates><panel_attributes>MainWindowController</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>962</x><y>1310</y><w>210</w><h>70</h></coordinates><panel_attributes>NotificationService
--
- taskDb: TaskDatabase
--
+ tick()</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1412</x><y>1310</y><w>240</w><h>90</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
WeatherProvider
--
+ getWeatherForecast: WeatherForecast</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1392</x><y>1150</y><w>400</w><h>100</h></coordinates><panel_attributes>WeatherService
--
- weatherPovider: WeatherProvider
- taskDb: TaskDatabase
--
+ WeatherService(provider: WeatherProvider, taskDb: TaskDatabase)
- updateTasks()</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1502</x><y>110</y><w>260</w><h>150</h></coordinates><panel_attributes>&lt;&lt;Record&gt;&gt;
GrowthPhase
--
+ startDate: MonthDay
+ endDate: MonthDay
+ type: GrowthPhaseType
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1422</x><y>180</y><w>100</w><h>40</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;&gt;
m1=*
m2=1</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>Text</id><coordinates><x>152</x><y>130</y><w>190</w><h>70</h></coordinates><panel_attributes>Note:
--
{final, readOnly} omitted on public data fields in &lt;&lt;Record&gt;&gt; Entities for clarity
style=wordwrap</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1172</x><y>970</y><w>210</w><h>50</h></coordinates><panel_attributes>lt=&lt;.
m1=*
m2=1
returns &gt;</panel_attributes><additional_attributes>190;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>1032</x><y>820</y><w>140</w><h>130</h></coordinates><panel_attributes>lt=&lt;-
m1=1 external database
m2=1 internal list
accesses</panel_attributes><additional_attributes>10;110;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>322</x><y>1120</y><w>240</w><h>150</h></coordinates><panel_attributes>Crop
--
- cropId: Long
+ plantId: long {final, readOnly}
+ startDate: LocalDate {final, readOnly}
+ area: Double
--
+ withId(long): Crop
+ withArea(double): Crop
--
+ getCropId(): Optional&lt;Long&gt;</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1262</x><y>280</y><w>70</w><h>120</h></coordinates><panel_attributes>lt=&lt;.
m1=*
m2=1
returns</panel_attributes><additional_attributes>10;10;10;100</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1632</x><y>290</y><w>130</w><h>100</h></coordinates><panel_attributes>&lt;&lt;Enumeration&gt;&gt;
GrowthPhaseType
--
SOW
PLANT
HARVEST</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1582</x><y>250</y><w>70</w><h>120</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;
m1=1
m2=*</panel_attributes><additional_attributes>50;90;10;90;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>882</x><y>720</y><w>80</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>60;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>432</x><y>1020</y><w>110</w><h>120</h></coordinates><panel_attributes>lt=&lt;.
m1=*
m2=1
returns / saves</panel_attributes><additional_attributes>10;100;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>242</x><y>710</y><w>100</w><h>30</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>302</x><y>890</y><w>280</w><h>140</h></coordinates><panel_attributes>&lt;&lt;Interface&gt;&gt;
GardenPlan
--
+ getPlantings(): List&lt;UserPlanting&gt;
+ addPlanting(plantId: long, startDate)
+ savePlanting(planting: UserPlanting)
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>422</x><y>800</y><w>80</w><h>110</h></coordinates><panel_attributes>lt=&lt;.
m1=1
m2=1
accesses</panel_attributes><additional_attributes>10;90;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1522</x><y>1240</y><w>30</w><h>90</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;70;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1062</x><y>1060</y><w>80</w><h>270</h></coordinates><panel_attributes>lt=&lt;-
m1=1
m2=1
accesses</panel_attributes><additional_attributes>10;10;10;250</additional_attributes></element><element><id>Relation</id><coordinates><x>1142</x><y>1060</y><w>270</w><h>170</h></coordinates><panel_attributes>lt=&lt;-
m1=1
m2=1
adds Tasks</panel_attributes><additional_attributes>10;10;10;140;250;140</additional_attributes></element><element><id>UMLClass</id><coordinates><x>822</x><y>1140</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonTaskDatabase</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>912</x><y>1060</y><w>30</w><h>100</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>10;10;10;80</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1562</x><y>430</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonPlantDatabase</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1442</x><y>440</y><w>140</w><h>30</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>10;10;120;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>32</x><y>930</y><w>200</w><h>50</h></coordinates><panel_attributes>JsonGardenPlan</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>222</x><y>940</y><w>100</w><h>30</h></coordinates><panel_attributes>lt=&lt;&lt;-</panel_attributes><additional_attributes>80;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>582</x><y>510</y><w>220</w><h>220</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>200;200;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>172</x><y>510</y><w>340</w><h>190</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;170;320;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>582</x><y>250</y><w>160</w><h>60</h></coordinates><panel_attributes>PlantListController</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>522</x><y>380</y><w>30</w><h>80</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>10;60;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>602</x><y>300</y><w>80</w><h>210</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>60;10;10;190</additional_attributes></element><element><id>UMLClass</id><coordinates><x>732</x><y>390</y><w>160</w><h>60</h></coordinates><panel_attributes>PlantListModel</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>732</x><y>280</y><w>90</w><h>130</h></coordinates><panel_attributes>lt=&lt;.</panel_attributes><additional_attributes>70;110;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>882</x><y>400</y><w>220</w><h>70</h></coordinates><panel_attributes>lt=&lt;-
m1=1\nexternal\ndatabase
m2=1\ninternal\nlist
accesses &gt;</panel_attributes><additional_attributes>200;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>582</x><y>0</y><w>190</w><h>50</h></coordinates><panel_attributes>lt=-
m1=0..n
m2=0..1
teaches to &gt;</panel_attributes><additional_attributes>10;20;170;20</additional_attributes></element><element><id>UMLClass</id><coordinates><x>1412</x><y>530</y><w>420</w><h>200</h></coordinates><panel_attributes>TaskTemplate
--
+ name: String {readOnly}
+ description: String {readOnly}
+ relativeStartDate: int {readOnly}
- interval: Integer
- relativeEndDate: Integer
- isOptional: boolean
--
+ Task(name: String, description: String, startDate: String): TaskTemplate
+ setRelativeEndDate(relativeEndDate: int)
+ setInterval(interval: Integer)
+ generateTask(realStartDate: LocalDate): Task
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1752</x><y>180</y><w>130</w><h>490</h></coordinates><panel_attributes>lt=&lt;-&gt;&gt;&gt;&gt;&gt;
m1=*
m2=1</panel_attributes><additional_attributes>80;460;110;460;110;10;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>1602</x><y>720</y><w>90</w><h>130</h></coordinates><panel_attributes>lt=&lt;.
m1=*
m2=1
generates</panel_attributes><additional_attributes>10;110;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>562</x><y>770</y><w>400</w><h>40</h></coordinates><panel_attributes>lt=&lt;-
delegates generating Tasks</panel_attributes><additional_attributes>380;20;10;20</additional_attributes></element></diagram>

File diff suppressed because one or more lines are too long

View File

@ -1,70 +0,0 @@
<diagram program="umletino" version="15.0.0"><zoom_level>12</zoom_level><element><id>UMLClass</id><coordinates><x>852</x><y>372</y><w>120</w><h>72</h></coordinates><panel_attributes>Gardener
--
Name
Type</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>144</x><y>372</y><w>120</w><h>120</h></coordinates><panel_attributes>Plant
--
name
description</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>600</x><y>372</y><w>120</w><h>84</h></coordinates><panel_attributes>Garden
--
Location
hardiness zone</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>384</x><y>372</y><w>120</w><h>72</h></coordinates><panel_attributes>Bed
--
Area</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1152</x><y>624</y><w>120</w><h>36</h></coordinates><panel_attributes>Weather</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>852</x><y>816</y><w>120</w><h>36</h></coordinates><panel_attributes>Calendar</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>852</x><y>96</y><w>144</w><h>72</h></coordinates><panel_attributes>Community
--
Plant Information
</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>288</x><y>636</y><w>120</w><h>72</h></coordinates><panel_attributes>Growth phase
--
duration</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>852</x><y>624</y><w>120</w><h>84</h></coordinates><panel_attributes>Gardening task
--
start date
end date
interval</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>852</x><y>156</y><w>120</w><h>240</h></coordinates><panel_attributes>lt=-
m1=0..*
m2=1..*
&lt; is part of </panel_attributes><additional_attributes>10;180;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>708</x><y>372</y><w>168</w><h>60</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
&lt; has </panel_attributes><additional_attributes>120;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>252</x><y>372</y><w>156</w><h>60</h></coordinates><panel_attributes>lt=-
m1=1
m2=0..*
&lt; contains </panel_attributes><additional_attributes>110;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>252</x><y>444</y><w>156</w><h>216</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
has &gt;</panel_attributes><additional_attributes>10;10;80;10;80;160</additional_attributes></element><element><id>Relation</id><coordinates><x>492</x><y>372</y><w>132</w><h>60</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
&lt; contains </panel_attributes><additional_attributes>90;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>900</x><y>432</y><w>120</w><h>216</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
&lt; manages </panel_attributes><additional_attributes>10;10;10;160</additional_attributes></element><element><id>Relation</id><coordinates><x>960</x><y>624</y><w>216</w><h>60</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
&lt; manipulates</panel_attributes><additional_attributes>160;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>900</x><y>696</y><w>108</w><h>144</h></coordinates><panel_attributes>lt=-
m1=1
m2=0..*
&lt; contains</panel_attributes><additional_attributes>10;10;10;100</additional_attributes></element><element><id>Relation</id><coordinates><x>960</x><y>408</y><w>468</w><h>468</h></coordinates><panel_attributes>lt=-
m1=1
m2=1
&lt; informs </panel_attributes><additional_attributes>10;360;310;360;310;10;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>12</x><y>636</y><w>120</w><h>84</h></coordinates><panel_attributes>Need
--
start date
end date</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>60</x><y>432</y><w>108</w><h>228</h></coordinates><panel_attributes>lt=-
m1=1..*
m2=1..*
has &gt;</panel_attributes><additional_attributes>10;170;10;10;70;10</additional_attributes></element><element><id>Relation</id><coordinates><x>60</x><y>672</y><w>816</w><h>120</h></coordinates><panel_attributes>lt=-
m1=1
m2=1
requires &gt;</panel_attributes><additional_attributes>660;10;520;10;520;80;10;80;10;40</additional_attributes></element><element><id>UMLClass</id><coordinates><x>456</x><y>588</y><w>120</w><h>36</h></coordinates><panel_attributes>Team
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>564</x><y>432</y><w>312</w><h>180</h></coordinates><panel_attributes>lt=-
m1=1
m2=1..*
contains of &gt;</panel_attributes><additional_attributes>10;130;240;10</additional_attributes></element><element><id>Relation</id><coordinates><x>564</x><y>600</y><w>312</w><h>60</h></coordinates><panel_attributes>lt=-
m1=1
m2=0..*
manages &gt;</panel_attributes><additional_attributes>10;20;240;20</additional_attributes></element><element><id>Relation</id><coordinates><x>960</x><y>156</y><w>216</w><h>240</h></coordinates><panel_attributes>lt=-
m1=0..n
m2=1..n
exchanges Informatione &gt;</panel_attributes><additional_attributes>10;10;10;180</additional_attributes></element><element><id>Relation</id><coordinates><x>120</x><y>648</y><w>192</w><h>60</h></coordinates><panel_attributes>lt=-
m1=0..n
m2=1
&lt; contains </panel_attributes><additional_attributes>10;20;140;20</additional_attributes></element></diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

View File

@ -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;
@ -11,6 +12,7 @@ import ch.zhaw.gartenverwaltung.types.Crop;
import ch.zhaw.gartenverwaltung.types.Pest; import ch.zhaw.gartenverwaltung.types.Pest;
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.beans.property.SimpleListProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@ -28,9 +30,13 @@ 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;
/**
* Controller class for the CropDetail.fxml file
*/
public class CropDetailController { public class CropDetailController {
private Crop crop; private Crop crop;
@ -63,15 +69,9 @@ public class CropDetailController {
@FXML @FXML
private Label description_label; private Label description_label;
@FXML
private Label location_label;
@FXML @FXML
private Label light_label; private Label light_label;
@FXML
private Button location_button;
@FXML @FXML
private Label soil_label; private Label soil_label;
@ -106,15 +106,7 @@ public class CropDetailController {
*/ */
@FXML @FXML
void setArea() throws IOException { void setArea() throws IOException {
openTextFieldDialog("set Text Area", "Text Area", area_label.getText(), false); openTextFieldDialog();
}
/**
* open dialog to set location
*/
@FXML
void setLocation() throws IOException {
openTextFieldDialog("set Location", "Location", location_label.getText(), true);
} }
/** /**
@ -138,9 +130,21 @@ public class CropDetailController {
imageView.setImage(plant.image()); imageView.setImage(plant.image());
} }
area_label.setText(String.valueOf(crop.getArea())); area_label.setText(String.valueOf(crop.getArea()));
location_label.setText("");
setTaskListProperty(crop); initializeTaskListProperty(crop);
TaskList.TaskListObserver taskListObserver = newTaskList -> {
Platform.runLater(() -> {
taskListProperty.clear();
try {
taskListProperty.addAll(gardenSchedule.getTaskListForCrop(crop.getCropId().get()));
} catch (IOException e) {
e.printStackTrace();
}
});
};
gardenSchedule.setTaskListObserver(taskListObserver);
taskList_listView.itemsProperty().bind(taskListProperty); taskList_listView.itemsProperty().bind(taskListProperty);
pestListProperty.addAll(plant.pests()); pestListProperty.addAll(plant.pests());
@ -152,11 +156,13 @@ public class CropDetailController {
} }
setIconToButton(addTask_button, "addIcon.png"); setIconToButton(addTask_button, "addIcon.png");
setIconToButton(area_button, "areaIcon.png"); setIconToButton(area_button, "areaIcon.png");
setIconToButton(location_button, "locationIcon.png");
setCellFactoryPests(); setCellFactoryPests();
setCellFactoryTasks(); setCellFactoryTasks();
} }
/**
* cell Factory for TaskListView
*/
private void setCellFactoryTasks() { private void setCellFactoryTasks() {
taskList_listView.setCellFactory(param -> new ListCell<>() { taskList_listView.setCellFactory(param -> new ListCell<>() {
@Override @Override
@ -174,6 +180,9 @@ public class CropDetailController {
}); });
} }
/**
* cell Factory for PestListView
*/
private void setCellFactoryPests() { private void setCellFactoryPests() {
pests_listView.setCellFactory(param -> new ListCell<>() { pests_listView.setCellFactory(param -> new ListCell<>() {
@Override @Override
@ -191,7 +200,11 @@ public class CropDetailController {
}); });
} }
private void setTaskListProperty(Crop crop) { /**
* initialize task list
* @param crop {@link Crop} that is selected
*/
private void initializeTaskListProperty(Crop crop) {
crop.getCropId().ifPresent(id -> { crop.getCropId().ifPresent(id -> {
List<Task> taskList; List<Task> taskList;
try { try {
@ -199,12 +212,16 @@ public class CropDetailController {
taskListProperty.clear(); taskListProperty.clear();
taskListProperty.addAll(taskList); taskListProperty.addAll(taskList);
} catch (IOException e) { } catch (IOException e) {
// TODO: Alert
LOG.log(Level.SEVERE, "Could not get task list for crop", e.getCause()); LOG.log(Level.SEVERE, "Could not get task list for crop", e.getCause());
} }
}); });
} }
/**
* Creates a {@link HBox} for the given {@link Task}.
* @param task {@link Task} which is selected
* @return {@link HBox} that was created
*/
private HBox createTaskHBox(Task task) { private HBox createTaskHBox(Task task) {
HBox hBox = new HBox(10); HBox hBox = new HBox(10);
Label taskName = new Label(task.getName()+": "); Label taskName = new Label(task.getName()+": ");
@ -220,6 +237,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");
@ -231,6 +250,11 @@ public class CropDetailController {
return hBox; return hBox;
} }
/**
* Creates a {@link HBox} for the given {@link Pest}.
* @param pest {@link Pest} which is selected
* @return {@link HBox} that was created
*/
private HBox createPestHBox(Pest pest) { private HBox createPestHBox(Pest pest) {
Label label = new Label(pest.name() + ": "); Label label = new Label(pest.name() + ": ");
label.setStyle("-fx-font-weight: bold"); label.setStyle("-fx-font-weight: bold");
@ -239,12 +263,8 @@ public class CropDetailController {
Label description = new Label(pest.description()); Label description = new Label(pest.description());
description.setAlignment(Pos.TOP_LEFT); description.setAlignment(Pos.TOP_LEFT);
description.setWrapText(true); description.setWrapText(true);
description.setMaxWidth(600); description.setMaxWidth(800);
Pane puffer = new Pane(); hBox.getChildren().addAll(label, description);
HBox.setHgrow(puffer, Priority.ALWAYS);
Button button = new Button("Get Counter Measures");
HBox.setHgrow(button, Priority.NEVER);
hBox.getChildren().addAll(label, description, puffer, button);
return hBox; return hBox;
} }
@ -261,6 +281,11 @@ public class CropDetailController {
button.setGraphic(imageView); button.setGraphic(imageView);
} }
/**
* opens dialog of {@link Task} edit.
* @param task {@link Task}
* @return {@link EventHandler} for the case of editing a {@link Task}
*/
private EventHandler<ActionEvent> getEditTaskEvent(Task task) { private EventHandler<ActionEvent> getEditTaskEvent(Task task) {
return (event) -> { return (event) -> {
try { try {
@ -271,12 +296,24 @@ public class CropDetailController {
}; };
} }
/**
* opens alert of {@link Task} deletion.
* @param task {@link Task}
* @return {@link EventHandler} for the case of deleting a {@link Task}
*/
private EventHandler<ActionEvent> deleteTask(Task task) { private EventHandler<ActionEvent> deleteTask(Task task) {
return (event) -> { return (event) -> {
showDeleteTask(task); showDeleteTask(task);
}; };
} }
/**
* opens a dialog to create a new Task or edit the given Task
* @param newTask boolean if it is a new Task
* @param givenTask {@link Task} which was selected
* @throws IOException Exception
* @throws HardinessZoneNotSetException Exception
*/
private void createTaskDialog(boolean newTask, Task givenTask) throws IOException, HardinessZoneNotSetException { private void createTaskDialog(boolean newTask, Task givenTask) throws IOException, HardinessZoneNotSetException {
Dialog<Task> dialog = new Dialog<>(); Dialog<Task> dialog = new Dialog<>();
dialog.setTitle("Set Task"); dialog.setTitle("Set Task");
@ -285,6 +322,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);
@ -306,68 +347,80 @@ 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);
}
} }
}); });
} }
} }
private void openTextFieldDialog(String title, String labelDescription, String value, boolean isLocation) throws IOException { /**
* opens TextField Dialog to enter the plant area.
* @throws IOException Exception
*/
private void openTextFieldDialog() throws IOException {
Dialog<String> dialog = new Dialog<>(); Dialog<String> dialog = new Dialog<>();
dialog.setTitle(title); dialog.setTitle("set Text Area");
dialog.setHeaderText(title); dialog.setHeaderText("set Text Area");
dialog.setResizable(false); dialog.setResizable(false);
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);
if (appLoader.loadPaneToDialog("TextFieldFormular.fxml", dialogPane) instanceof TextFieldFormularController controller) { if (appLoader.loadPaneToDialog("TextFieldFormular.fxml", dialogPane) instanceof TextFieldFormularController controller) {
controller.setDescription_label(labelDescription); controller.setDescription_label("Text Area");
controller.setValueTextArea(value); controller.setValueTextArea(area_label.getText());
controller.initSaveButton((Button) dialogPane.lookupButton(save)); controller.initSaveButton((Button) dialogPane.lookupButton(save));
dialog.setResultConverter(button -> button.equals(save) ? controller.getValue() : null); dialog.setResultConverter(button -> button.equals(save) ? controller.getValue() : null);
dialog.showAndWait() dialog.showAndWait()
.ifPresent(string -> { .ifPresent(string -> {
if (isLocation) {
System.out.println(string);
//ToDo method to set location
location_label.setText(string);
} else {
try { try {
garden.updateCrop(this.crop.withArea(Double.parseDouble(string))); garden.updateCrop(this.crop.withArea(Double.parseDouble(string)));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
area_label.setText(string); area_label.setText(string);
}
}); });
} }
} }
/**
* Alert to delete Task.
* @param task {@link Task} which is being deleted
*/
private void showDeleteTask(Task task) { private void showDeleteTask(Task task) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
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);
} catch (IOException e) { } catch (IOException e) {
// TODO: Show error alert
LOG.log(Level.SEVERE, "Could not remove crop.", e); LOG.log(Level.SEVERE, "Could not remove crop.", e);
} }
} }

View File

@ -1,23 +0,0 @@
package ch.zhaw.gartenverwaltung;
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
import javafx.application.Application;
import javafx.stage.Stage;
import java.io.IOException;
public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
AppLoader appLoader = new AppLoader();
appLoader.loadSceneToStage("MainFXML.fxml", stage);
stage.setTitle("Gartenverwaltung");
stage.show();
}
public static void main(String[] args) {
launch();
}
}

View File

@ -8,6 +8,9 @@ import javafx.scene.image.ImageView;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/**
* Controller class for the Home.fxml file
*/
public class HomeController implements Initializable { public class HomeController implements Initializable {
@FXML @FXML
@ -34,6 +37,11 @@ public class HomeController implements Initializable {
setImages(imageViewPhilippe, ""); setImages(imageViewPhilippe, "");
} }
/**
* set image to image view
* @param imageView the imageView to update
* @param photoName the file name of the photo
*/
private void setImages(ImageView imageView, String photoName) { private void setImages(ImageView imageView, String photoName) {
Image img; Image img;
if (photoName.equals("")) { if (photoName.equals("")) {

View File

@ -0,0 +1,59 @@
package ch.zhaw.gartenverwaltung;
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
import ch.zhaw.gartenverwaltung.backgroundtasks.BackgroundTasks;
import ch.zhaw.gartenverwaltung.io.CropList;
import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.io.TaskList;
import ch.zhaw.gartenverwaltung.models.Garden;
import ch.zhaw.gartenverwaltung.types.Crop;
import javafx.application.Application;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Timer;
/**
* Main class of the Application
*/
public class Main extends Application {
Timer backGroundTaskTimer = new Timer();
BackgroundTasks backgroundTasks;
/**
* Method which is automatically called if Application is starting. It loads the scenes to stage and shows the stage.
* It creates a new Instance of BackgroundTasks and schedules them with a Timer instance to execute them every minute.
* @param stage Stage to show
* @throws IOException If loading Scenes can not access the fxml Resource File
*/
@Override
public void start(Stage stage) throws IOException {
AppLoader appLoader = new AppLoader();
appLoader.loadSceneToStage("MainFXML.fxml", stage);
stage.setTitle("Gartenverwaltung");
stage.show();
backgroundTasks = new BackgroundTasks((TaskList) appLoader.getAppDependency(TaskList.class),(CropList) appLoader.getAppDependency(CropList.class), (PlantList) appLoader.getAppDependency(PlantList.class));
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 60000);
}
/**
* Method which is automatically called when application is stopped.
* It cancels the timer to not execute the background tasks anymore.
*/
@Override
public void stop(){
backGroundTaskTimer.cancel();
}
/**
* The Main method launches the application
* @param args There are no arguments needed.
*/
public static void main(String[] args) {
launch();
}
}

View File

@ -16,9 +16,13 @@ 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;
/**
* Controller class for the MainFXML.fxml file
*/
public class MainFXMLController { public class MainFXMLController {
private static final Logger LOG = Logger.getLogger(MainFXMLController.class.getName()); private static final Logger LOG = Logger.getLogger(MainFXMLController.class.getName());
@ -52,7 +56,6 @@ public class MainFXMLController {
@FXML @FXML
void goToHome() { void goToHome() {
showPaneAsMainView("Home.fxml"); showPaneAsMainView("Home.fxml");
styleChangeButton(home_button);
} }
/** /**
@ -61,7 +64,6 @@ public class MainFXMLController {
@FXML @FXML
void goToMyPlants() { void goToMyPlants() {
showPaneAsMainView("MyGarden.fxml"); showPaneAsMainView("MyGarden.fxml");
styleChangeButton(myGarden_button);
} }
/** /**
@ -70,7 +72,6 @@ public class MainFXMLController {
@FXML @FXML
void goToMySchedule() { void goToMySchedule() {
showPaneAsMainView("MySchedule.fxml"); showPaneAsMainView("MySchedule.fxml");
styleChangeButton(mySchedule_button);
} }
/** /**
@ -86,6 +87,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);
@ -152,10 +157,6 @@ public class MainFXMLController {
appLoader.loadAndCacheFxml("Plants.fxml"); appLoader.loadAndCacheFxml("Plants.fxml");
} }
private void styleChangeButton(Button button) {
//ToDo changeStyle of the menu buttons
}
/** /**
* loads the default FXML File * loads the default FXML File
* {@inheritDoc} * {@inheritDoc}
@ -166,7 +167,6 @@ public class MainFXMLController {
try { try {
preloadPanes(); preloadPanes();
showPaneAsMainView("MyGarden.fxml"); showPaneAsMainView("MyGarden.fxml");
styleChangeButton(myGarden_button);
} catch (IOException e) { } catch (IOException e) {
LOG.log(Level.SEVERE, "Failed to load FXML-Pane!", e); LOG.log(Level.SEVERE, "Failed to load FXML-Pane!", e);
} }
@ -176,6 +176,10 @@ public class MainFXMLController {
tutorial_button.visibleProperty().bind(Settings.getInstance().getShowTutorialProperty()); tutorial_button.visibleProperty().bind(Settings.getInstance().getShowTutorialProperty());
} }
/**
* close Tutorial Window
* @param windowEvent event
*/
private void closeWindowHandler(WindowEvent windowEvent) { private void closeWindowHandler(WindowEvent windowEvent) {
tutorialModal.close(); tutorialModal.close();
} }

View File

@ -19,6 +19,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority; import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -27,6 +28,9 @@ import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* Controller class for the MyGarden.fxml file
*/
public class MyGardenController { public class MyGardenController {
private static final Logger LOG = Logger.getLogger(MyGardenController.class.getName()); private static final Logger LOG = Logger.getLogger(MyGardenController.class.getName());
@Inject @Inject
@ -96,7 +100,6 @@ public class MyGardenController {
* @throws IOException exception * @throws IOException exception
*/ */
private HBox createHBoxForListView(Crop crop) throws HardinessZoneNotSetException, IOException { private HBox createHBoxForListView(Crop crop) throws HardinessZoneNotSetException, IOException {
//ToDo add better design
Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get(); Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
HBox hBox = new HBox(10); HBox hBox = new HBox(10);
ImageView imageView = new ImageView(); ImageView imageView = new ImageView();
@ -109,17 +112,35 @@ public class MyGardenController {
} }
hBox.setMinHeight(100); hBox.setMinHeight(100);
Label label = new Label(plant.name()); Label label = new Label(plant.name());
label.setMaxWidth(2000); label.setMinWidth(100);
HBox.setHgrow(label, Priority.ALWAYS);
VBox vbox = new VBox(10);
HBox startDateHBox = new HBox(10);
Label startDateDescription = new Label("Start Date:");
startDateDescription.setMinWidth(75);
Label startDate = new Label(crop.getStartDate().toString());
startDateHBox.getChildren().addAll(startDateDescription, startDate);
HBox endDateHBox = new HBox(10);
Label endDateDescription = new Label("End Date:");
endDateDescription.setMinWidth(75);
Label endDate = new Label(crop.getStartDate().plusDays(plant.timeToHarvest(0)).toString());
endDateHBox.getChildren().addAll(endDateDescription, endDate);
vbox.getChildren().addAll(startDateHBox, endDateHBox);
vbox.setMaxWidth(2000);
HBox.setHgrow(vbox, Priority.ALWAYS);
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));
delete.setOnAction(getDeleteCropEvent(crop)); delete.setOnAction(getDeleteCropEvent(crop));
hBox.getChildren().addAll(imageView, label, details, delete); hBox.getChildren().addAll(imageView, label, vbox, details, delete);
return hBox; return hBox;
} }
@ -152,7 +173,6 @@ public class MyGardenController {
stage.setResizable(true); stage.setResizable(true);
stage.showAndWait(); stage.showAndWait();
} catch (IOException | PlantNotFoundException e) { } catch (IOException | PlantNotFoundException e) {
// TODO: show error alert
LOG.log(Level.SEVERE, "Could not load plant details.", e); LOG.log(Level.SEVERE, "Could not load plant details.", e);
} }
}; };
@ -183,6 +203,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.");
@ -192,7 +218,6 @@ public class MyGardenController {
try { try {
garden.removeCrop(crop); garden.removeCrop(crop);
} catch (IOException e) { } catch (IOException e) {
// TODO: Show error alert
LOG.log(Level.SEVERE, "Could not remove crop.", e); LOG.log(Level.SEVERE, "Could not remove crop.", e);
} }
} }

View File

@ -3,15 +3,17 @@ 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.event.ActionEvent;
import javafx.collections.FXCollections; import javafx.event.EventHandler;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
@ -22,12 +24,15 @@ 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;
/**
* Controller class for the MySchedule.fxml file
*/
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;
@ -47,22 +52,40 @@ 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("");
gardenSchedule.getTasksUpcomingWeek();
TaskList.TaskListObserver taskListObserver = newTaskList -> {
Platform.runLater(() -> {
try { try {
loadTaskList(); gardenSchedule.getTasksUpcomingWeek();
scheduledPlants_listview.getSelectionModel().clearSelection();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
} }
});
};
gardenSchedule.setTaskListObserver(taskListObserver);
} }
/**
* sort scheduler to selected crop
*/
private void lookForSelectedListEntries() { private void lookForSelectedListEntries() {
scheduledPlants_listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { scheduledPlants_listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
selectedCrop = newValue; selectedCrop = newValue;
@ -74,7 +97,12 @@ public class MyScheduleController {
}); });
} }
/**
* 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) {
@ -96,6 +124,9 @@ public class MyScheduleController {
}); });
} }
/**
* set CallFactory for the given Tasks
*/
private void setCellFactoryTaskListView() { private void setCellFactoryTaskListView() {
week_listView.setCellFactory(param -> new ListCell<>() { week_listView.setCellFactory(param -> new ListCell<>() {
@Override @Override
@ -103,8 +134,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()));
@ -113,17 +144,25 @@ public class MyScheduleController {
}); });
} }
/**
* update task list
* @throws IOException exception
*/
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);
} }
/**
* Create a {@link VBox} of the given TaskList.
* @param tasks List of {@link Task}s
* @param dayIndex index of the day
* @return {@link VBox} of the given Task of the day
*/
private VBox weekTaskVBox(List<Task> tasks, int dayIndex) { private VBox weekTaskVBox(List<Task> tasks, int dayIndex) {
VBox vBox = new VBox(10); VBox vBox = new VBox(10);
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
@ -144,14 +183,17 @@ public class MyScheduleController {
taskDescription.setMaxSize(600, Double.MAX_VALUE); taskDescription.setMaxSize(600, Double.MAX_VALUE);
Pane puffer = new Pane(); Pane puffer = new Pane();
HBox.setHgrow(puffer, Priority.ALWAYS); HBox.setHgrow(puffer, Priority.ALWAYS);
CheckBox checkBox = new CheckBox("Task completed?"); Button button = new Button("Task completed!");
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> { button.getStyleClass().add("button-class");
if (newValue) {
showConfirmation(task, checkBox); button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
showConfirmation(task);
} }
}); });
HBox.setHgrow(checkBox, Priority.NEVER); HBox.setHgrow(button, Priority.NEVER);
hBoxDescription.getChildren().addAll(taskDescription, puffer, checkBox); hBoxDescription.getChildren().addAll(taskDescription, puffer, button);
vBox.getChildren().addAll(hBox, hBoxDescription); vBox.getChildren().addAll(hBox, hBoxDescription);
} }
return vBox; return vBox;
@ -161,12 +203,18 @@ public class MyScheduleController {
* Alert to confirm that task has been completed. * Alert to confirm that task has been completed.
* @param task {@link Task} which is selected * @param task {@link Task} which is selected
*/ */
private void showConfirmation(Task task, CheckBox checkBox) { private void showConfirmation(Task task) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Task Completed?"); alert.setTitle("Task Completed?");
alert.setHeaderText("Are you sure you have completed this task?"); alert.setHeaderText("Are you sure you have completed this task?");
alert.setContentText("Confirming that you have completed the task will remove it from the schedule."); alert.setContentText("Confirming that you have completed the task will remove it from the schedule.");
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) {
@ -176,11 +224,8 @@ public class MyScheduleController {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else {
checkBox.setSelected(false);
} }
}); });
} }
} }

View File

@ -25,9 +25,13 @@ 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;
/**
* Controller class for the Plants.fxml file
*/
public class PlantsController { public class PlantsController {
private static final Logger LOG = Logger.getLogger(PlantsController.class.getName()); private static final Logger LOG = Logger.getLogger(PlantsController.class.getName());
@ -79,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);

View File

@ -8,6 +8,10 @@ import javafx.util.Callback;
import java.time.LocalDate; import java.time.LocalDate;
/**
* Controller class for the SelectSowDay.fxml file
* Gets opened with a dialog.
*/
public class SelectSowDayController { public class SelectSowDayController {
private Plant selectedPlant; private Plant selectedPlant;

View File

@ -1,14 +1,63 @@
package ch.zhaw.gartenverwaltung; package ch.zhaw.gartenverwaltung;
import ch.zhaw.gartenverwaltung.backgroundtasks.email.SmtpCredentials;
import ch.zhaw.gartenverwaltung.types.HardinessZone; import ch.zhaw.gartenverwaltung.types.HardinessZone;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
public class Settings { import java.util.List;
private HardinessZone currentHardinessZone = HardinessZone.ZONE_8A; import java.util.Objects;
private static Settings instance;
private final BooleanProperty showTutorial = new SimpleBooleanProperty(false);
/**
* Singleton Class to store default Settings and User Settings
*/
public class Settings {
/*
* The Class instance to use everywhere
*/
private static final Settings instance;
/**
* The current Hardiness zone initialized as default value Zone_8A
*/
private HardinessZone currentHardinessZone = HardinessZone.ZONE_8A;
/**
* Setting to show or hide the Tutorial in Main Menu
*/
private final BooleanProperty showTutorial = new SimpleBooleanProperty(false);
/**
* The SMTP Credentials which are used to send E-Mail Notifications
* The following Google Account is created for Testing:
* E-Mail Address: pm3.hs22.it21b.win.team1@gmail.com
* Account Password: Gartenverwaltung.PM3.2022
* SMTP Password: bisefhhjtrrhtoqr
*/
private SmtpCredentials smtpCredentials = new SmtpCredentials("imap.gmail.com", "587", "pm3.hs22.it21b.win.team1@gmail.com", "pm3.hs22.it21b.win.team1@gmail.com", "bisefhhjtrrhtoqr", true);
/**
* List of Receivers for E-Mailnotifications. Multiple E-Mailadresses can be separated by ";"
* Following Public E-mail address was used for Testing: pm3.hs22.it21b.win.team1@mailinator.com
* The E-Mail inbox of this address can be found here: https://www.mailinator.com/v4/public/inboxes.jsp?to=pm3.hs22.it21b.win.team1
*/
private String mailNotificationReceivers = "pm3.hs22.it21b.win.team1@mailinator.com";
/**
* String Template to create E-Mail Subject for Notifications
* Variables: Task Name
*/
private String mailNotificationSubjectTemplate = "Task %s is due!";
/**
* String Template to create E-Mail Text for Notifications
* Variables: Task Name, plant Name, nextExecution, Task description
*/
private String mailNotificationTextTemplate = "Dear user\nYour gardentask %s for plant %s is due at %tF. Don't forget to confirm in your application if the task is done.\nTask description:\n%s";
/**
* Location of the garden can be set by user (Used for Weather Service)
*/
private String location = "";
/*
Create Instance of Settings
*/
static { static {
instance = new Settings(); instance = new Settings();
} }
@ -17,14 +66,21 @@ public class Settings {
return Settings.instance; return Settings.instance;
} }
/**
* Private constructor to prevent Classes from creating more instances
*/
private Settings() {} private Settings() {}
public HardinessZone getCurrentHardinessZone() { public HardinessZone getCurrentHardinessZone() {
return currentHardinessZone; return currentHardinessZone;
} }
/**
* Method to set the current Hardiness Zone. If no Hardiness Zone is given the default zone (ZONE_8A) will be used.
* @param currentHardinessZone the new Hardiness Zone
*/
public void setCurrentHardinessZone(HardinessZone currentHardinessZone) { public void setCurrentHardinessZone(HardinessZone currentHardinessZone) {
this.currentHardinessZone = currentHardinessZone; this.currentHardinessZone = Objects.requireNonNullElse(currentHardinessZone, HardinessZone.ZONE_8A);
} }
public void setShowTutorial (boolean showTutorial) { public void setShowTutorial (boolean showTutorial) {
@ -38,4 +94,28 @@ public class Settings {
public boolean getShowTutorial() { public boolean getShowTutorial() {
return this.showTutorial.get(); return this.showTutorial.get();
} }
public void setLocation(String location) {
this.location = location;
}
public String getLocation() {
return this.location;
}
public SmtpCredentials getSmtpCredentials() {
return smtpCredentials;
}
public String getMailNotificationReceivers() {
return mailNotificationReceivers;
}
public String getMailNotificationSubjectTemplate() {
return mailNotificationSubjectTemplate;
}
public String getMailNotificationTextTemplate() {
return mailNotificationTextTemplate;
}
} }

View File

@ -1,23 +1,50 @@
package ch.zhaw.gartenverwaltung; package ch.zhaw.gartenverwaltung;
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
import ch.zhaw.gartenverwaltung.bootstrap.Inject;
import ch.zhaw.gartenverwaltung.types.HardinessZone; import ch.zhaw.gartenverwaltung.types.HardinessZone;
import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.control.CheckBox; import javafx.scene.control.*;
import javafx.scene.control.ComboBox; import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Objects;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/**
* Controller class for the Settings.fxml file
*/
public class SettingsController implements Initializable { public class SettingsController implements Initializable {
Settings settings = Settings.getInstance(); Settings settings = Settings.getInstance();
@Inject
AppLoader appLoader;
@FXML @FXML
private ComboBox<HardinessZone> selectHardinessZone_comboBox; private ComboBox<HardinessZone> selectHardinessZone_comboBox;
@FXML @FXML
private CheckBox showTutorial_checkBox; private CheckBox showTutorial_checkBox;
@FXML
private Button location_button;
@FXML
private Label location_label;
/**
* open dialog to set location
* @param event event
* @throws IOException exception
*/
@FXML
void setLocation(ActionEvent event) throws IOException {
openTextFieldDialog();
}
/** /**
* save selected values to {@link Settings} * save selected values to {@link Settings}
*/ */
@ -36,5 +63,54 @@ public class SettingsController implements Initializable {
showTutorial_checkBox.setSelected(settings.getShowTutorial()); showTutorial_checkBox.setSelected(settings.getShowTutorial());
selectHardinessZone_comboBox.getItems().addAll(HardinessZone.values()); selectHardinessZone_comboBox.getItems().addAll(HardinessZone.values());
selectHardinessZone_comboBox.setValue(settings.getCurrentHardinessZone()); selectHardinessZone_comboBox.setValue(settings.getCurrentHardinessZone());
setIconToButton(location_button, "locationIcon.png");
location_label.setText(settings.getLocation());
}
/**
* adds icon to button
* @param button the button which get the icon
* @param iconFileName file name of icon
*/
private void setIconToButton(Button button, String iconFileName) {
Image img = new Image(String.valueOf(getClass().getResource("icons/" + iconFileName)));
ImageView imageView = new ImageView(img);
imageView.setFitHeight(20);
imageView.setPreserveRatio(true);
button.setGraphic(imageView);
}
/**
* opens Dialog to set exception
* @throws IOException exception
*/
private void openTextFieldDialog() throws IOException {
Dialog<String> dialog = new Dialog<>();
dialog.setTitle("Set Location of your Garden");
dialog.setHeaderText("set Location of your Garden!");
dialog.setResizable(false);
DialogPane dialogPane = dialog.getDialogPane();
dialogPane.getStylesheets().add(
Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm());
dialogPane.getStyleClass().add("myDialog");
ButtonType save = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
dialogPane.getButtonTypes().addAll(save, ButtonType.CANCEL);
if (appLoader.loadPaneToDialog("TextFieldFormular.fxml", dialogPane) instanceof TextFieldFormularController controller) {
controller.setDescription_label("Set");
controller.setValueTextArea(settings.getLocation());
controller.initSaveButton((Button) dialogPane.lookupButton(save));
dialog.setResultConverter(button -> button.equals(save) ? controller.getValue() : null);
dialog.showAndWait()
.ifPresent(string -> {
settings.setLocation(string);
location_label.setText(settings.getLocation());
});
}
} }
} }

View File

@ -19,6 +19,9 @@ import java.net.URL;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/**
* Controller class for the TaskFormular.fxml file
*/
public class TaskFormularController implements Initializable { public class TaskFormularController implements Initializable {
private Crop crop; private Crop crop;
private Plant plant; private Plant plant;
@ -49,9 +52,14 @@ public class TaskFormularController implements Initializable {
@AfterInject @AfterInject
@SuppressWarnings("unused") @SuppressWarnings("unused")
/**
* returns the edited or added {@link Task}
* @param crop {@link Crop} which was selected
* @return {@link Task} which was edited or added
*/
public Task returnResult(Crop crop) { 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(),
@ -61,11 +69,21 @@ public class TaskFormularController implements Initializable {
return task; return task;
} }
/**
* set selected crop and get the plant from the crop.
* @param crop {@link Crop} which was selected
* @throws HardinessZoneNotSetException exception
* @throws IOException exception
*/
public void setCorp(Crop crop) throws HardinessZoneNotSetException, IOException { public void setCorp(Crop crop) throws HardinessZoneNotSetException, IOException {
this.crop = crop; this.crop = crop;
this.plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get(); this.plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
} }
/**
* set the values of task into the labels and datePicker.
* @param task {@link Task} which was given
*/
public void setTaskValue(Task task) { public void setTaskValue(Task task) {
this.task = task; this.task = task;
taskName_field.setText(task.getName()); taskName_field.setText(task.getName());
@ -79,6 +97,10 @@ public class TaskFormularController implements Initializable {
} }
} }
/**
* dayCellFactory of the start date
* @return {@link Callback} of the dayCellFactory
*/
private Callback<DatePicker, DateCell> getDayCellFactoryStartDate() { private Callback<DatePicker, DateCell> getDayCellFactoryStartDate() {
return (datePicker) -> new DateCell() { return (datePicker) -> new DateCell() {
@ -103,6 +125,10 @@ public class TaskFormularController implements Initializable {
}; };
} }
/**
* dayCellFactory of the end date
* @return {@link Callback} of the dayCellFactory
*/
private Callback<DatePicker, DateCell> getDayCellFactoryEndDate() { private Callback<DatePicker, DateCell> getDayCellFactoryEndDate() {
return (datePicker) -> new DateCell() { return (datePicker) -> new DateCell() {
@ -127,9 +153,13 @@ public class TaskFormularController implements Initializable {
}; };
} }
/**
* disable button until condition meet.
* @param button {@link Button} which was given
*/
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]", ""));
} }
}); });
@ -139,6 +169,16 @@ public class TaskFormularController implements Initializable {
.or(description_area.textProperty().isEmpty())); .or(description_area.textProperty().isEmpty()));
} }
/**
* initialize dayCellFactories
* @param location
* The location used to resolve relative paths for the root object, or
* {@code null} if the location is not known.
*
* @param resources
* The resources used to localize the root object, or {@code null} if
* the root object was not localized.
*/
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
start_datePicker.setDayCellFactory(getDayCellFactoryStartDate()); start_datePicker.setDayCellFactory(getDayCellFactoryStartDate());

View File

@ -5,6 +5,9 @@ import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
/**
* Controller class for the TexFieldFormular.fxml file
*/
public class TextFieldFormularController { public class TextFieldFormularController {
@FXML @FXML
@ -14,18 +17,34 @@ public class TextFieldFormularController {
private TextField text_area; private TextField text_area;
/**
* set description label
* @param string string of the description
*/
public void setDescription_label(String string) { public void setDescription_label(String string) {
description_label.setText(string); description_label.setText(string);
} }
/**
* set text area value
* @param string string of text area value
*/
public void setValueTextArea(String string) { public void setValueTextArea(String string) {
text_area.setText(string); text_area.setText(string);
} }
/**
* return value of text area
* @return string of the tex area
*/
public String getValue() { public String getValue() {
return text_area.getText(); return text_area.getText();
} }
/**
* Disable Button until condition meet
* @param button {@link Button} which is gets dissabled
*/
public void initSaveButton(Button button) { public void initSaveButton(Button button) {
text_area.textProperty().addListener((observable, oldValue, newValue) -> { text_area.textProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.matches("\\d*\\.?\\d*")) { if (newValue.matches("\\d*\\.?\\d*")) {

View File

@ -7,7 +7,11 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.stage.Stage; import javafx.stage.Stage;
import java.io.InputStream;
/**
* Controller class for the Tutorial.fxml file
*/
public class TutorialController { public class TutorialController {
@FXML @FXML
@ -19,6 +23,8 @@ public class TutorialController {
public ImageView imgAddNewPlant; public ImageView imgAddNewPlant;
public ImageView imgTaskList; public ImageView imgTaskList;
public ImageView imgSelectDate; public ImageView imgSelectDate;
public ImageView imgAddTaskButton;
public ImageView imgDetailDeleteButtons;
private int page = 0; private int page = 0;
@ -27,10 +33,27 @@ public class TutorialController {
switchViews(); switchViews();
setButtonAbilities(); setButtonAbilities();
Image placeholder = new Image(String.valueOf(PlantsController.class.getResource("placeholder.png"))); setImageView(imgAddNewPlant, "add-new-plant.png");
imgAddNewPlant.setImage(placeholder); setImageView(imgSelectDate, "select-sow-harvest.png");
imgSelectDate.setImage(placeholder); setImageView(imgDetailDeleteButtons, "details-delete.png");
imgTaskList.setImage(placeholder); setImageView(imgTaskList, "schedule.png");
setImageView(imgAddTaskButton, "add-task.png");
}
/**
* update the given image view with screenshot or placeholder image.
* @param imageView the image view to update
* @param fileName the file name of the source
*/
private void setImageView(ImageView imageView, String fileName) {
InputStream is = PlantsController.class.getResourceAsStream("screenshots/" + fileName);
Image image;
if (is != null) {
image = new Image(String.valueOf(PlantsController.class.getResource("screenshots/" + fileName)));
} else {
image = new Image(String.valueOf(PlantsController.class.getResource("placeholder.png")));
}
imageView.setImage(image);
} }
public void viewNextPage() { public void viewNextPage() {
@ -44,16 +67,25 @@ public class TutorialController {
setButtonAbilities(); setButtonAbilities();
} }
/**
* disable next or close button according to the location of button
*/
private void setButtonAbilities() { private void setButtonAbilities() {
previousPageButton.setDisable(page <= 0); previousPageButton.setDisable(page <= 0);
nextPageButton.setDisable(page >= tourPages.getChildren().size() - 1); nextPageButton.setDisable(page >= tourPages.getChildren().size() - 1);
} }
/**
* switch to next view
*/
private void switchViews() { private void switchViews() {
tourPages.getChildren().forEach(node -> node.setOpacity(0)); tourPages.getChildren().forEach(node -> node.setOpacity(0));
tourPages.getChildren().get(page).setOpacity(1); tourPages.getChildren().get(page).setOpacity(1);
} }
/**
* close Tutorial
*/
public void closeTutorial() { public void closeTutorial() {
Stage root = (Stage) tourPages.getScene().getWindow(); Stage root = (Stage) tourPages.getScene().getWindow();
root.close(); root.close();

View File

@ -0,0 +1,74 @@
package ch.zhaw.gartenverwaltung.backgroundtasks;
import ch.zhaw.gartenverwaltung.CropDetailController;
import ch.zhaw.gartenverwaltung.backgroundtasks.weather.WeatherGradenTaskPlanner;
import ch.zhaw.gartenverwaltung.io.CropList;
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.io.TaskList;
import ch.zhaw.gartenverwaltung.models.PlantNotFoundException;
import ch.zhaw.gartenverwaltung.types.Task;
import javax.mail.MessagingException;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class with tasks which must be executed periodic and not triggered by user. Method run must be called in a fix interval.
*/
public class BackgroundTasks extends TimerTask {
private static final Logger LOG = Logger.getLogger(CropDetailController.class.getName());
private final TaskList taskList;
private final Notifier notifier;
private final WeatherGradenTaskPlanner weatherGardenTaskPlaner;
public BackgroundTasks(TaskList taskList, CropList cropList, PlantList plantList) {
this.taskList = taskList;
notifier = new Notifier(taskList, plantList, cropList);
weatherGardenTaskPlaner = new WeatherGradenTaskPlanner(taskList, plantList, cropList);
}
/**
* Changes the field "nextExecution" of all tasks if it's in the past to the actual date as long as they are not done.
* @throws IOException if the taskList can't be read.
*/
private void movePastTasks() throws IOException {
List<Task> taskList = this.taskList.getTaskList(LocalDate.MIN.plusDays(1), LocalDate.now().minusDays(1));
for (Task task : taskList) {
if (!task.isDone()) {
task.setNextExecution(LocalDate.now());
this.taskList.saveTask(task);
}
}
}
/**
* Method to call if Tasks should be executed. It calls all Background tasks after each other.
*/
@Override
public void run() {
try {
movePastTasks();
} catch (IOException e) {
e.printStackTrace();
LOG.log(Level.WARNING, "Could not execute Background Task: move past Tasks ", e.getCause());
}
try {
weatherGardenTaskPlaner.refreshTasks();
} catch (IOException | HardinessZoneNotSetException | PlantNotFoundException e) {
e.printStackTrace();
LOG.log(Level.WARNING, "Could not execute Background Task: Refresh Tasks by WeatherGardenTaskPlaner ", e.getCause());
}
try {
notifier.sendNotifications();
} catch (IOException | MessagingException | HardinessZoneNotSetException e) {
e.printStackTrace();
LOG.log(Level.WARNING, "Could not execute Background Task: send Notification for due Tasks", e.getCause());
}
}
}

View File

@ -0,0 +1,66 @@
package ch.zhaw.gartenverwaltung.backgroundtasks;
import ch.zhaw.gartenverwaltung.Settings;
import ch.zhaw.gartenverwaltung.backgroundtasks.email.EMailSender;
import ch.zhaw.gartenverwaltung.io.CropList;
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.io.TaskList;
import ch.zhaw.gartenverwaltung.types.Crop;
import ch.zhaw.gartenverwaltung.types.Task;
import javax.mail.MessagingException;
import java.io.IOException;
import java.time.LocalDate;
/**
* Class to send Notifications to the user
*/
public class Notifier {
private final TaskList taskList;
private final CropList cropList;
private final PlantList plantList;
private final EMailSender eMailSender = new EMailSender();
public Notifier(TaskList taskList, PlantList plantList, CropList cropList) {
this.taskList = taskList;
this.cropList = cropList;
this.plantList = plantList;
}
/**
* Method to send a Notification to the user for e specific Task
* @param task The task to use for notification
* @throws IOException if tasklist can not be read
* @throws MessagingException if E-Mail can not be sent for any reason
* @throws HardinessZoneNotSetException if hardiness zone is not set in plant list.
*/
private void sendNotification(Task task) throws IOException, MessagingException, HardinessZoneNotSetException {
String plantName = "unkown plant";
if(cropList.getCropById((task.getCropId())).isPresent()){
Crop crop = cropList.getCropById(task.getCropId()).get();
if(plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).isPresent()) {
plantName = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get().name();
}
}
String messageSubject = String.format(Settings.getInstance().getMailNotificationSubjectTemplate(), task.getName());
String messageText = String.format(Settings.getInstance().getMailNotificationTextTemplate(), task.getName(), plantName, task.getNextExecution(), task.getDescription());
eMailSender.sendMails(Settings.getInstance().getMailNotificationReceivers(), messageSubject, messageText);
}
/**
* Sends a notification to the user for each task which is due and not done every day as long as it's not done.
* @throws IOException if tasklist can not be read
* @throws MessagingException if E-Mail can not be sent for any reason
* @throws HardinessZoneNotSetException if hardiness zone is not set in plant list.
*/
public void sendNotifications() throws IOException, MessagingException, HardinessZoneNotSetException {
for (Task task : taskList.getTaskList(LocalDate.MIN, LocalDate.MAX)) {
if (task.getNextNotification() != null && task.getNextNotification().isBefore(LocalDate.now().minusDays(1))) {
sendNotification(task);
task.setNextNotification(LocalDate.now().plusDays(1));
taskList.saveTask(task);
}
}
}
}

View File

@ -0,0 +1,44 @@
package ch.zhaw.gartenverwaltung.backgroundtasks.email;
import ch.zhaw.gartenverwaltung.Settings;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* Class to send E-Mails
*/
public class EMailSender {
/**
* Method to send E-Mail to one or multiple recipients
* @param recipients recipients E-Mail addresses separated by ";"
* @param subject Subject of the E-Mail
* @param text E-Mail message Text as rear text or html
* @throws MessagingException If sending the E-Mail fails for any reason
*/
public void sendMails(String recipients, String subject, String text) throws MessagingException {
printMail(recipients, subject, text);
MimeMessage message = new MimeMessage(Settings.getInstance().getSmtpCredentials().getSession());
message.addHeader("Content-type", "text/HTML; charset=UTF-8");
message.addHeader("format", "flowed");
message.addHeader("Content-Transfer-Encoding", "8bit");
message.setFrom(new InternetAddress(Settings.getInstance().getSmtpCredentials().fromAddress()));
message.setReplyTo(InternetAddress.parse(Settings.getInstance().getSmtpCredentials().fromAddress(), false));
message.setSubject(subject);
message.setText(text);
message.setSentDate(new Date());
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients, false));
Transport.send(message);
}
private void printMail(String receiver, String subject, String text){
System.out.printf("\nSending E-Mail:\nTo: %s\nSubject: %s\nMessage:\n%s\n", receiver, subject, text);
}
}

View File

@ -0,0 +1,54 @@
package ch.zhaw.gartenverwaltung.backgroundtasks.email;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import java.net.Authenticator;
import java.util.Properties;
/**
* Class to store SMTP Credentials to send E-Mails and create
* corresponding Session Object
*/
public record SmtpCredentials(
String host,
String port,
String fromAddress,
String username,
String password,
boolean startTLS
) {
/**
* Creates a Properties Object with SMTP Server Information
* @return the created Properties Object
*/
private Properties getProperties() {
Properties properties = new Properties();
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.port", port);
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.starttls.enable", startTLS ? "true" : "false");
return properties;
}
/**
* Creates a javax.mail.Authenticator Object with username and password for SMTP Server
* @return the created javax.mail.Authenticator Object
*/
private javax.mail.Authenticator getAuthenticator() {
return new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
};
}
/**
* Method to get the Session Instance with the given SMTP Credentials
* @return the Session Instance
*/
public Session getSession() {
return Session.getInstance(getProperties(), getAuthenticator());
}
}

View File

@ -0,0 +1,8 @@
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
/**
* Enum of possible Weather events
*/
public enum SevereWeather {
FROST,SNOW,HAIL,NO_SEVERE_WEATHER,RAIN
}

View File

@ -0,0 +1,162 @@
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
import ch.zhaw.gartenverwaltung.io.CropList;
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.io.TaskList;
import ch.zhaw.gartenverwaltung.models.PlantNotFoundException;
import ch.zhaw.gartenverwaltung.types.*;
import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* The WeatherGardenTaskPlanner creates Tasks based on weather events and the rain amount from the last days
*/
public class WeatherGradenTaskPlanner {
private final TaskList taskList;
private final PlantList plantList;
private final CropList cropList;
WeatherService weatherService;
private final LocalDate dateSevereWeather = LocalDate.now();
public WeatherGradenTaskPlanner(TaskList taskList, PlantList plantList, CropList cropList) {
this.taskList = taskList;
this.plantList = plantList;
this.cropList = cropList;
weatherService = new WeatherService();
}
/**
* Method to refresh watering tasks and severe weather tasks
* @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
*/
public void refreshTasks() throws IOException, HardinessZoneNotSetException, PlantNotFoundException {
getSevereWeatherEvents();
getRainAmount();
}
private void getSevereWeatherEvents() throws IOException {
SevereWeather actualWeather = weatherService.causeSevereWeather(1);
List<Crop> actualCrops = cropList.getCrops();
for (Crop crop : actualCrops) {
List<Task> actualCropTasks = taskList.getTaskForCrop(crop.getCropId().orElse(-1L));
if (SevereWeather.HAIL.equals(actualWeather)) {
createPreHailTask(crop, actualCropTasks);
} else if (SevereWeather.FROST.equals(actualWeather)) {
createPreFrostTask(crop, actualCropTasks);
} else if (SevereWeather.SNOW.equals(actualWeather)) {
createPreSnowTask(crop, actualCropTasks);
}
}
}
private void getRainAmount() throws IOException, HardinessZoneNotSetException, PlantNotFoundException {
int rainAmount = weatherService.causeRainAmount(3);
adjustWateringTask(rainAmount);
}
/**
* Method to create a PreHailTask and saves it in the tasklist
* @throws IOException If the database cannot be accessed
*/
private void createPreHailTask(Crop crop, List<Task> actualTasksForCrop) throws IOException {
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",
dateSevereWeather,dateSevereWeather.plusDays(1L),crop.getCropId().orElse(-1L));
List<Task> hailTasks = actualTasksForCrop.stream().filter(task -> task.getName().equals("Hail")).toList();
if(isNoSevereWeatherTaskAtDate(preHailTask, hailTasks) && hailTasks.isEmpty()){
taskList.saveTask(preHailTask);
}
}
/**
* Method to create a PreFrosttask and saves it in the tasklist
* @throws IOException If the database cannot be accessed
*/
private void createPreFrostTask(Crop crop, List<Task> actualTasksForCrop) throws IOException {
Task preFrostTask = new Task("Frost",
"The temperatur falls below zero degrees, cover especially the root with wool",
dateSevereWeather,dateSevereWeather.plusDays(1L),crop.getCropId().orElse(-1L));
List<Task> frostTasks = actualTasksForCrop.stream().filter(task -> task.getName().equals("Frost")).toList();
if(isNoSevereWeatherTaskAtDate(preFrostTask, frostTasks) && frostTasks.isEmpty()){
taskList.saveTask(preFrostTask);
}
}
/**
* Method to create a PreSnowTask and saves it in the tasklist
* @throws IOException If the database cannot be accessed
*/
private void createPreSnowTask(Crop crop, List<Task> actualTasksForCrop) throws IOException {
Task preSnowTask = new Task("Snow",
"The weather brings little snowfall. Cover your crops",
dateSevereWeather, dateSevereWeather.plusDays(1L), crop.getCropId().orElse(-1L));
List<Task> snowTasklist = actualTasksForCrop.stream().filter(task -> task.getName().equals("Snow")).toList();
if(isNoSevereWeatherTaskAtDate(preSnowTask, snowTasklist) && snowTasklist.isEmpty()){
taskList.saveTask(preSnowTask);
}
}
/**
* Method to create a PreSnowTask and saves it in the tasklist
* @param preSevereWeatherTask the Task which would be added if there is not already
* the same Type of severe weather task
* @param severeWeatherTasks List of severe weather tasks from e specific severe weather
* @return true If there is not already a severe weather task of the same type of preSevereWeatherTask
* task at the date of the preSevereWeatherTask
*/
private boolean isNoSevereWeatherTaskAtDate(Task preSevereWeatherTask, List<Task> severeWeatherTasks) {
List<Task> severeWeatherTasksAtDate = new ArrayList<>();
for (Task task : severeWeatherTasks) {
if (task.getStartDate() == preSevereWeatherTask.getStartDate()) {
severeWeatherTasksAtDate.add(task);
}
}
return severeWeatherTasksAtDate.isEmpty();
}
/**
* Method to adjust the water plant tasks
* @param rainAmount Amount of rain from the last 7 days
* @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 adjustWateringTask(int rainAmount) throws HardinessZoneNotSetException, IOException, PlantNotFoundException {
for (Crop crop : cropList.getCrops()) {
Plant plant = plantList.getPlantById(HardinessZone.ZONE_8A,crop.getPlantId()).orElseThrow(PlantNotFoundException::new);
if(plant.wateringCycle().litersPerSqM() < rainAmount){
adjustNextExecutionOfWateringTasks(taskList.getTaskList(LocalDate.now(), LocalDate.now().plusDays(7)));
}
}
}
/**
* Method to set next execution date of the water plant tasks
* @param cropTaskList List with tasks from crops
*/
private void adjustNextExecutionOfWateringTasks(List<Task> cropTaskList){
for(Task task : cropTaskList){
if(task.getName().equals("water plant")){
task.setNextExecution(task.getNextExecution().plusDays(task.getInterval().orElse(1)));
}
}
}
}

View File

@ -0,0 +1,41 @@
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
/**
* The WeatherService is a class to cause weather events for the WeatherGardenTaskPlanner
*/
public class WeatherService {
private static final int NO_RAIN = 0;
private static final int LITTLE_RAIN = 15;
private static final int RAIN = 25;
private static final int HEAVY_RAIN = 50;
/**
* Method to simmulate a Weather Service for testing
* @param randomWeather random int. Range: 1-3
* @return the selected SevereWeather
*/
public SevereWeather causeSevereWeather(int randomWeather) {
return switch (randomWeather) {
case 1 -> SevereWeather.HAIL;
case 2 -> SevereWeather.SNOW;
case 3 -> SevereWeather.FROST;
default -> null;
};
}
/**
* Method to simulate a Weather Service for testing
* @param randomRainAmount random int. Range: 1-4
* @return the selected rain amount
*/
public int causeRainAmount(int randomRainAmount) {
return switch (randomRainAmount) {
case 1 -> NO_RAIN;
case 2 -> LITTLE_RAIN;
case 3 -> RAIN;
case 4 -> HEAVY_RAIN;
default -> -1;
};
}
}

View File

@ -1,12 +1,8 @@
package ch.zhaw.gartenverwaltung.bootstrap; package ch.zhaw.gartenverwaltung.bootstrap;
import ch.zhaw.gartenverwaltung.HelloApplication; import ch.zhaw.gartenverwaltung.CropDetailController;
import ch.zhaw.gartenverwaltung.io.CropList; import ch.zhaw.gartenverwaltung.Main;
import ch.zhaw.gartenverwaltung.io.JsonCropList; import ch.zhaw.gartenverwaltung.io.*;
import ch.zhaw.gartenverwaltung.io.JsonPlantList;
import ch.zhaw.gartenverwaltung.io.JsonTaskList;
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.models.GardenSchedule; import ch.zhaw.gartenverwaltung.models.GardenSchedule;
import ch.zhaw.gartenverwaltung.models.PlantListModel; import ch.zhaw.gartenverwaltung.models.PlantListModel;
@ -22,12 +18,15 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Class responsible for bootstrapping the application wide dependencies * Class responsible for bootstrapping the application wide dependencies
* and injecting them into JavaFX Controllers. * and injecting them into JavaFX Controllers.
*/ */
public class AppLoader { public class AppLoader {
private static final Logger LOG = Logger.getLogger(CropDetailController.class.getName());
/** /**
* Caching the panes * Caching the panes
*/ */
@ -82,7 +81,7 @@ public class AppLoader {
* @throws IOException if the file could not be loaded * @throws IOException if the file could not be loaded
*/ */
public Object loadSceneToStage(String fxmlFile, Stage appendee) throws IOException { public Object loadSceneToStage(String fxmlFile, Stage appendee) throws IOException {
FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile))); FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(Main.class.getResource(fxmlFile)));
Pane root = loader.load(); Pane root = loader.load();
Scene scene = new Scene(root); Scene scene = new Scene(root);
String css = Objects.requireNonNull(this.getClass().getResource("styles.css")).toExternalForm(); String css = Objects.requireNonNull(this.getClass().getResource("styles.css")).toExternalForm();
@ -104,7 +103,7 @@ public class AppLoader {
* @throws IOException if the file could not be loaded * @throws IOException if the file could not be loaded
*/ */
public Object loadPaneToDialog(String fxmlFile, DialogPane appendee) throws IOException { public Object loadPaneToDialog(String fxmlFile, DialogPane appendee) throws IOException {
FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile))); FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(Main.class.getResource(fxmlFile)));
appendee.setContent(loader.load()); appendee.setContent(loader.load());
Object controller = loader.getController(); Object controller = loader.getController();
annotationInject(controller); annotationInject(controller);
@ -119,7 +118,7 @@ public class AppLoader {
* @throws IOException if the file could not be loaded * @throws IOException if the file could not be loaded
*/ */
public void loadAndCacheFxml(String fxmlFile) throws IOException { public void loadAndCacheFxml(String fxmlFile) throws IOException {
FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile))); FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(Main.class.getResource(fxmlFile)));
Pane pane = loader.load(); Pane pane = loader.load();
panes.put(fxmlFile, pane); panes.put(fxmlFile, pane);
annotationInject(loader.getController()); annotationInject(loader.getController());
@ -151,13 +150,18 @@ public class AppLoader {
try { try {
afterInjectMethod.invoke(controller); afterInjectMethod.invoke(controller);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO: Log LOG.log(Level.SEVERE, "Could not invoke afterInjectMethod", e.getCause());
e.printStackTrace(); e.printStackTrace();
} }
}); });
} }
private Object getAppDependency(Class<?> type) { /**
* Method to get any AppDependency
* @param type Class of Dependency
* @return the App dependency
*/
public Object getAppDependency(Class<?> type) {
return dependencies.get(type.getSimpleName()); return dependencies.get(type.getSimpleName());
} }
} }

View File

@ -1,5 +1,8 @@
package ch.zhaw.gartenverwaltung.io; package ch.zhaw.gartenverwaltung.io;
/**
* Exceptionm which is thrown if Hardiness zone is not set in plant list.
*/
public class HardinessZoneNotSetException extends Exception { public class HardinessZoneNotSetException extends Exception {
public HardinessZoneNotSetException() { public HardinessZoneNotSetException() {
super("HardinessZone must be set to retrieve plants!"); super("HardinessZone must be set to retrieve plants!");

View File

@ -2,6 +2,9 @@ package ch.zhaw.gartenverwaltung.io;
import java.io.IOException; import java.io.IOException;
/**
* Excption which is thrown if a JSON file has a invalid File format.
*/
class InvalidJsonException extends IOException { class InvalidJsonException extends IOException {
public InvalidJsonException(String reason) { public InvalidJsonException(String reason) {
super(reason); super(reason);

View File

@ -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());
} }

View File

@ -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;
} }
} }

View File

@ -50,8 +50,6 @@ public class Garden {
*/ */
public void plantAsCrop(Plant plant, LocalDate plantingDate) throws IOException, HardinessZoneNotSetException, PlantNotFoundException { public void plantAsCrop(Plant plant, LocalDate plantingDate) throws IOException, HardinessZoneNotSetException, PlantNotFoundException {
Crop crop = new Crop(plant.id(), plantingDate); Crop crop = new Crop(plant.id(), plantingDate);
//TODO Add Area to Plant
//crop.withArea(0);
cropList.saveCrop(crop); cropList.saveCrop(crop);
gardenSchedule.planTasksForCrop(crop); gardenSchedule.planTasksForCrop(crop);
plantedCrops.clear(); plantedCrops.clear();

View File

@ -3,13 +3,16 @@ 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;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class GardenSchedule { public class GardenSchedule {
@ -21,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
@ -49,6 +65,10 @@ public class GardenSchedule {
public void planTasksForCrop(Crop crop) throws PlantNotFoundException, HardinessZoneNotSetException, IOException { public void planTasksForCrop(Crop crop) throws PlantNotFoundException, HardinessZoneNotSetException, IOException {
Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).orElseThrow(PlantNotFoundException::new); Plant plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).orElseThrow(PlantNotFoundException::new);
int growPhaseGroup = plant.getGrowphaseGroupForDate(crop.getStartDate()); int growPhaseGroup = plant.getGrowphaseGroupForDate(crop.getStartDate());
addTask(new Task("watering Task", "pour water over the plant circa : "+ plant.wateringCycle().litersPerSqM() +" per square meter",
crop.getStartDate(), crop.getStartDate().plusDays(plant.timeToHarvest(0)),
plant.wateringCycle().interval(), crop.getCropId().orElse(0L)));
for (GrowthPhase growthPhase : plant.lifecycleForGroup(growPhaseGroup)) { for (GrowthPhase growthPhase : plant.lifecycleForGroup(growPhaseGroup)) {
for (TaskTemplate taskTemplate : growthPhase.taskTemplates()) { for (TaskTemplate taskTemplate : growthPhase.taskTemplates()) {
addTask(taskTemplate.generateTask(crop.getStartDate(), crop.getCropId().orElse(0L))); addTask(taskTemplate.generateTask(crop.getStartDate(), crop.getCropId().orElse(0L)));
@ -146,32 +166,32 @@ public class GardenSchedule {
dayTaskList.add(new ArrayList<>()); dayTaskList.add(new ArrayList<>());
final int finalI = i; final int finalI = i;
weekTasks.forEach(task -> { weekTasks.forEach(task -> {
if (task.getNextExecution() == null) { if(task.getNextExecution() != null) {
task.isDone();
} else {
LocalDate checkDate = task.getNextExecution(); LocalDate checkDate = task.getNextExecution();
do { do {
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) { if (date.equals(task.getNextExecution()) || (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN)))) {
dayTaskList.get(finalI).add(task); dayTaskList.get(finalI).add(task);
break;
} }
checkDate = checkDate.plusDays(task.getInterval().orElse(0)); checkDate = checkDate.plusDays(task.getInterval().orElse(0));
} while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength))); } while (!(task.getInterval().orElse(0) == 0) && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
} }
}); });
} }
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);
} }
/** /**

View File

@ -1,5 +1,6 @@
package ch.zhaw.gartenverwaltung.models; package ch.zhaw.gartenverwaltung.models;
import ch.zhaw.gartenverwaltung.Settings;
import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException; import ch.zhaw.gartenverwaltung.io.HardinessZoneNotSetException;
import ch.zhaw.gartenverwaltung.io.PlantList; import ch.zhaw.gartenverwaltung.io.PlantList;
import ch.zhaw.gartenverwaltung.types.GrowthPhaseType; import ch.zhaw.gartenverwaltung.types.GrowthPhaseType;
@ -16,7 +17,6 @@ import java.util.stream.Collectors;
public class PlantListModel { public class PlantListModel {
private final PlantList plantList; private final PlantList plantList;
private HardinessZone currentZone;
/** /**
* Comparators to create sorted Plant List * Comparators to create sorted Plant List
@ -33,15 +33,15 @@ public class PlantListModel {
} }
private void setDefaultZone() { private void setDefaultZone() {
currentZone = HardinessZone.ZONE_8A; // TODO: get Default Zone from Settings Settings.getInstance().setCurrentHardinessZone(null);
} }
public void setCurrentZone(HardinessZone currentZone) { public void setCurrentZone(HardinessZone currentZone) {
this.currentZone = currentZone; Settings.getInstance().setCurrentHardinessZone(currentZone);
} }
public HardinessZone getCurrentZone() { public HardinessZone getCurrentZone() {
return currentZone; return Settings.getInstance().getCurrentHardinessZone();
} }
/** /**

View File

@ -1,5 +1,8 @@
package ch.zhaw.gartenverwaltung.models; package ch.zhaw.gartenverwaltung.models;
/**
* Exception which is thrown if there is no plant in plant Database with the given id.
*/
public class PlantNotFoundException extends Exception { public class PlantNotFoundException extends Exception {
public PlantNotFoundException() { public PlantNotFoundException() {
super("The selected Plant was not found in Database!"); super("The selected Plant was not found in Database!");

View File

@ -4,6 +4,9 @@ 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;
@ -37,7 +40,6 @@ public class Crop {
public Optional<Long> getCropId() { public Optional<Long> getCropId() {
return Optional.ofNullable(cropId); return Optional.ofNullable(cropId);
} }
public long getPlantId() { return plantId; } public long getPlantId() { return plantId; }
public LocalDate getStartDate() { return startDate; } public LocalDate getStartDate() { return startDate; }
public double getArea() { return area; } public double getArea() { return area; }

View File

@ -7,12 +7,23 @@ 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,
int group, int group,
WateringCycle wateringCycle,
@JsonDeserialize(using = GrowthPhaseTypeDeserializer.class) GrowthPhaseType type, @JsonDeserialize(using = GrowthPhaseTypeDeserializer.class) GrowthPhaseType type,
@JsonDeserialize(using = HardinessZoneDeserializer.class) HardinessZone zone, @JsonDeserialize(using = HardinessZoneDeserializer.class) HardinessZone zone,
List<TaskTemplate> taskTemplates) { List<TaskTemplate> taskTemplates) {

View File

@ -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
} }

View File

@ -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) {
} }

View File

@ -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,
@ -18,6 +32,7 @@ public record Plant(
int light, int light,
String soil, String soil,
List<Pest> pests, List<Pest> pests,
WateringCycle wateringCycle,
List<GrowthPhase> lifecycle) { List<GrowthPhase> lifecycle) {
/** /**
@ -29,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()
@ -39,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());
@ -46,20 +68,22 @@ public record Plant(
return growthPhase.group(); return growthPhase.group();
} }
} }
return 0; // TODO implement return 0;
} }
/** /**
* 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
*/ */
@ -78,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) &&

View File

@ -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"),

View File

@ -1,11 +1,12 @@
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;
/** /**
* 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 +19,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 +32,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;
@ -41,6 +49,33 @@ public class Task {
this.cropId = cropId; this.cropId = cropId;
} }
/**
* 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, long cropId) {
this.name = name;
this.description = description;
this.startDate = startDate;
nextExecution = startDate;
this.endDate = endDate;
this.cropId = cropId;
}
/**
* 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;
@ -65,18 +100,31 @@ 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.plusDays(1)) && nextExecution.isAfter(searchStartDate.minusDays(1))));
} }
/**
* 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);
nextNotification = nextExecution;
} else { } else {
nextExecution = null; nextExecution = null;
nextNotification = null;
} }
} }
@JsonIgnore
public boolean isDone(){ public boolean isDone(){
return nextExecution == null; return nextExecution == null;
} }
@ -105,6 +153,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();

View File

@ -4,6 +4,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDate; import java.time.LocalDate;
/**
* Class which represents a Task if the start and enddate is not known yet.
*/
public class TaskTemplate { public class TaskTemplate {
@JsonProperty @JsonProperty
private final String name; private final String name;
@ -41,6 +44,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;

View File

@ -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,

View File

@ -5,6 +5,8 @@ module ch.zhaw.gartenverwaltung {
requires com.fasterxml.jackson.datatype.jsr310; requires com.fasterxml.jackson.datatype.jsr310;
requires com.fasterxml.jackson.datatype.jdk8; requires com.fasterxml.jackson.datatype.jdk8;
requires java.logging; requires java.logging;
requires java.mail;
opens ch.zhaw.gartenverwaltung to javafx.fxml; opens ch.zhaw.gartenverwaltung to javafx.fxml;
opens ch.zhaw.gartenverwaltung.types to com.fasterxml.jackson.databind; opens ch.zhaw.gartenverwaltung.types to com.fasterxml.jackson.databind;
@ -13,4 +15,8 @@ module ch.zhaw.gartenverwaltung {
exports ch.zhaw.gartenverwaltung.types; exports ch.zhaw.gartenverwaltung.types;
exports ch.zhaw.gartenverwaltung.models; exports ch.zhaw.gartenverwaltung.models;
exports ch.zhaw.gartenverwaltung.json; exports ch.zhaw.gartenverwaltung.json;
exports ch.zhaw.gartenverwaltung.backgroundtasks;
opens ch.zhaw.gartenverwaltung.backgroundtasks to javafx.fxml;
exports ch.zhaw.gartenverwaltung.backgroundtasks.email;
opens ch.zhaw.gartenverwaltung.backgroundtasks.email to javafx.fxml;
} }

View File

@ -15,35 +15,32 @@
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="785.0" prefWidth="899.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.CropDetailController"> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="785.0" prefWidth="899.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.CropDetailController">
<children> <children>
<ScrollPane fitToWidth="true" prefHeight="759.0" prefWidth="664.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="759.0" prefWidth="664.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content> <content>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0"> <VBox fx:id="cropDetailVBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="781.0" prefWidth="897.0" spacing="5.0">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<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 prefHeight="265.0" prefWidth="879.0"> <HBox maxHeight="1.7976931348623157E308" prefHeight="268.0" prefWidth="855.0" spacing="10.0" VBox.vgrow="NEVER">
<children> <children>
<GridPane maxWidth="1.7976931348623157E308" prefHeight="296.0" prefWidth="577.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" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="149.66665903727215" minHeight="10.0" prefHeight="149.66665903727215" valignment="TOP" vgrow="SOMETIMES" /> <RowConstraints maxHeight="149.66665903727215" minHeight="10.0" prefHeight="126.33328501383463" valignment="TOP" vgrow="SOMETIMES" />
<RowConstraints maxHeight="187.9999647140503" minHeight="10.0" prefHeight="51.00000762939453" vgrow="SOMETIMES" /> <RowConstraints maxHeight="187.9999647140503" minHeight="10.0" prefHeight="45.00002034505208" vgrow="SOMETIMES" />
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="54.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="46.33331298828125" vgrow="SOMETIMES" />
<RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="46.66666666666666" vgrow="SOMETIMES" /> <RowConstraints maxHeight="105.66662597656247" minHeight="10.0" prefHeight="45.66668701171875" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Label prefHeight="17.0" prefWidth="65.0" text="Description:"> <Label prefHeight="17.0" prefWidth="65.0" text="Description:">
@ -75,32 +72,35 @@
</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="300.0" fitWidth="300.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>
</HBox> </HBox>
<Label text="Tasks:"> <Label text="Tasks:">
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<ListView fx:id="taskList_listView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="877.0" VBox.vgrow="ALWAYS"> <ListView fx:id="taskList_listView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" prefHeight="100.0" prefWidth="869.0" VBox.vgrow="ALWAYS">
<VBox.margin> <VBox.margin>
<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"> <Button styleClass="button-class" fx:id="addTask_button" mnemonicParsing="false" onAction="#addTask" prefHeight="25.0" prefWidth="120.0" VBox.vgrow="NEVER" text="Add Task">
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Button> </Button>
<Label text="Pests:" /> <Label text="Pests:" VBox.vgrow="NEVER" />
<ListView fx:id="pests_listView" maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS"> <ListView fx:id="pests_listView" maxHeight="1.7976931348623157E308" minHeight="-Infinity" prefHeight="100.0" prefWidth="855.0" VBox.vgrow="SOMETIMES">
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</ListView> </ListView>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" VBox.vgrow="NEVER"> <HBox alignment="CENTER_LEFT" prefHeight="27.0" prefWidth="869.0" VBox.vgrow="NEVER">
<children> <children>
<Label text="Area:"> <Label text="Area:">
<HBox.margin> <HBox.margin>
@ -112,30 +112,18 @@
<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 bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="719.0" prefHeight="100.0" prefWidth="200.0" VBox.vgrow="NEVER">
<children>
<Label text="Location:">
<HBox.margin>
<Insets right="40.0" />
</HBox.margin>
</Label>
<Label fx:id="location_label" minHeight="-Infinity" prefWidth="50.0" text="Label">
<HBox.margin>
<Insets right="10.0" />
</HBox.margin>
</Label>
<Button fx:id="location_button" mnemonicParsing="false" onAction="#setLocation" prefHeight="25.0" prefWidth="115.0" text="Set Location" />
</children>
</HBox>
</children> </children>
</VBox> </VBox>
</content> </content>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</ScrollPane> </ScrollPane>
</children> </children>
</AnchorPane> </AnchorPane>

View File

@ -6,26 +6,24 @@
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1091.0" prefWidth="1060.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.HomeController"> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1091.0" prefWidth="1060.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.HomeController">
<children> <children>
<ScrollPane fitToWidth="true" prefHeight="1157.0" prefWidth="1060.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <ScrollPane fitToWidth="true" prefHeight="1157.0" prefWidth="1060.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
<content> <content>
<VBox prefHeight="1091.0" prefWidth="1058.0"> <VBox fx:id="homeVBox" prefHeight="1047.0" prefWidth="1019.0" spacing="10.0">
<children> <children>
<Pane prefHeight="1085.0" prefWidth="1018.0"> <Label styleClass="page-title" text="Garden Management">
<children>
<VBox prefHeight="1047.0" prefWidth="1019.0">
<children>
<Label text="Garden Management">
<font> <font>
<Font size="34.0" /> <Font size="34.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="30.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<Label alignment="TOP_LEFT" prefHeight="22.0" prefWidth="1039.0" text="This Application was created to help the user manage his or her garden. For this the Application has many functionalities:" wrapText="true"> <Label alignment="TOP_LEFT" prefHeight="22.0" prefWidth="1039.0" text="This Application was created to help the user manage his or her garden. For this the Application has many functionalities:" wrapText="true">
@ -33,9 +31,11 @@
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
<children>
<Label text="Base Functionalities:"> <Label text="Base Functionalities:">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
@ -46,86 +46,107 @@
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="62.0" text="- The user can filter the plants according to seasons, hardiness zone and search query"> <Label text="- The user can filter the plants according to seasons, hardiness zone and search query">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="62.0" text="- The user can select the harverst or sow date. "> <Label text="- The user can select the harverst or sow date. ">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="102.0" text="- The user can get a detailed information of the plant he wants to harvest."> <Label text="- The user can get a detailed information of the plant he wants to harvest.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="122.0" text="- The user can get view the task list of the given plant."> <Label text="- The user can get view the task list of the given plant.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="142.0" text="- The user can get the tasks of the next seven days in the scheduler."> <Label text="- The user can get the tasks of the next seven days in the scheduler.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<Label layoutX="10.0" layoutY="42.0" text="Advanced Functionalities:"> </children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
<children>
<Label text="Advanced Functionalities:">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="62.0" text="- The user can edit the task list and add custom tasks."> <Label text="- The user can edit the task list and add custom tasks.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="212.0" text="- The user can set the area (sqare meter) for the plants."> <Label text="- The user can set the area (sqare meter) for the plants.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="232.0" text="- The user can set the location (PLZ) for the plants."> <Label text="- The user can set the location (PLZ) for the plants.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="162.0" text="- The user can set the pesticide which will be used, which will create additonal tasks."> <Label text="- The user can set the pesticide which will be used, which will create additonal tasks.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<Label layoutX="10.0" layoutY="192.0" text="Weather Forcast:"> </children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
<children>
<Label text="Weather Forcast:">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="212.0" text="- According to the location the weather forcast will crate or delete tasks."> <Label text="- According to the location the weather forcast will crate or delete tasks.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
</Label> </Label>
<Label layoutX="10.0" layoutY="272.0" text="- The user receives notifications that aditional tasks werde created or some tasks were deleted."> <Label text="- The user receives notifications that aditional tasks werde created or some tasks were deleted.">
<font> <font>
<Font size="14.0" /> <Font size="14.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
<VBox styleClass="vbox" prefHeight="200.0" prefWidth="100.0" spacing="15.0">
<children>
<Label text="Created by:"> <Label text="Created by:">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
@ -135,11 +156,16 @@
<Insets right="30.0" /> <Insets right="30.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label text="Elias Csomor" /> <Label minWidth="150.0" text="Elias Csomor" />
<Label minWidth="200.0" text="csomoeli@students.zhaw.ch" />
<Label text="Assistent Project Lead/Developer" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="15.0" /> <Insets />
</VBox.margin> </VBox.margin>
<padding>
<Insets left="50.0" />
</padding>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
<children> <children>
@ -148,11 +174,16 @@
<Insets right="30.0" /> <Insets right="30.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label text="Philippe Giavarini" /> <Label minWidth="150.0" text="Philippe Giavarini" />
<Label minWidth="200.0" text="giavaphi@students.zhaw.ch" />
<Label text="Project Lead/Developer" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="15.0" /> <Insets />
</VBox.margin> </VBox.margin>
<padding>
<Insets left="50.0" />
</padding>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
<children> <children>
@ -161,11 +192,16 @@
<Insets right="30.0" /> <Insets right="30.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label text="David Guler" /> <Label minWidth="150.0" text="David Guler" />
<Label minWidth="200.0" text="gulerdav@students.zhaw.ch" />
<Label text="Developer" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="15.0" /> <Insets />
</VBox.margin> </VBox.margin>
<padding>
<Insets left="50.0" />
</padding>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
<children> <children>
@ -174,11 +210,16 @@
<Insets right="30.0" /> <Insets right="30.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label text="Gian-Andrea Hutter" /> <Label minWidth="150.0" text="Gian-Andrea Hutter" />
<Label minWidth="200.0" text="huttergia@students.zhaw.ch" />
<Label text="Developer" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="15.0" /> <Insets />
</VBox.margin> </VBox.margin>
<padding>
<Insets left="50.0" />
</padding>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0"> <HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0">
<children> <children>
@ -187,24 +228,24 @@
<Insets right="30.0" /> <Insets right="30.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label text="Roman Schenk" /> <Label minWidth="150.0" text="Roman Schenk" />
<Label minWidth="200.0" text="schrom01@students.zhaw.ch" />
<Label text="Developer" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="15.0" /> <Insets />
</VBox.margin> </VBox.margin>
<padding>
<Insets left="50.0" />
</padding>
</HBox> </HBox>
</children> </children>
</VBox>
</children>
<VBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</Pane>
</children>
<padding> <padding>
<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>
</children>
</VBox>
</content> </content>
</ScrollPane> </ScrollPane>
</children> </children>

View File

@ -10,26 +10,26 @@
<AnchorPane fx:id="myGardenRoot" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="655.0" prefWidth="1175.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyGardenController"> <AnchorPane fx:id="myGardenRoot" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="655.0" prefWidth="1175.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyGardenController">
<children> <children>
<VBox layoutY="49.0" prefHeight="655.0" prefWidth="1175.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <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>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" /> <Insets />
</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 top="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Button> </Button>
</children> </children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox> </VBox>
</children> </children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</AnchorPane> </AnchorPane>

View File

@ -1,50 +1,62 @@
<?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?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="572.0" prefWidth="867.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyScheduleController"> <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="572.0" prefWidth="867.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.MyScheduleController">
<children> <children>
<Label layoutX="14.0" layoutY="14.0" text="MySchedule"> <VBox prefHeight="200.0" prefWidth="100.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label styleClass="page-title" text="MySchedule" VBox.vgrow="NEVER">
<font> <font>
<Font size="24.0" /> <Font size="24.0" />
</font> </font>
</Label> </Label>
<HBox layoutY="31.0" prefHeight="541.0" prefWidth="867.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0"> <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 bottom="10.0" left="10.0" right="10.0" top="10.0" /> <ListView fx:id="scheduledPlants_listview" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="522.0" prefWidth="271.0" VBox.vgrow="ALWAYS" />
</HBox.margin></ListView> <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#showAllTasks" styleClass="button-class" text="Show All Tasks" VBox.vgrow="NEVER" />
<VBox maxWidth="1.7976931348623157E308" prefHeight="537.0" prefWidth="650.0" HBox.hgrow="ALWAYS"> </children>
</VBox>
<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">
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</ListView> </ListView>
<Pane prefHeight="131.0" prefWidth="593.0" 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" layoutX="14.0" layoutY="14.0" prefHeight="17.0" prefWidth="550.0" text="Importants Information:" wrapText="true"> <Label alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="17.0" prefWidth="558.0" text="Importants Information:" wrapText="true" VBox.vgrow="NEVER">
<font> <font>
<Font name="System Bold" size="12.0" /> <Font name="System Bold" size="12.0" />
</font> </font>
</Label> </Label>
<Label fx:id="information_label" alignment="TOP_LEFT" layoutX="14.0" layoutY="31.0" maxWidth="1.7976931348623157E308" prefHeight="82.0" prefWidth="550.0" text="Label" wrapText="true" /> <Label fx:id="information_label" alignment="TOP_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="73.0" prefWidth="550.0" text="Label" wrapText="true" VBox.vgrow="ALWAYS" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</Pane> <padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
</children> </children>
</VBox> </VBox>
</children> </children>
</HBox> </HBox>
</children> </children>
</VBox>
</children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</AnchorPane> </AnchorPane>

View File

@ -4,59 +4,72 @@
<?import javafx.scene.control.Button?> <?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.control.SplitPane?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?> <?import javafx.scene.control.TitledPane?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="1000.0" prefHeight="853.0" <AnchorPane fx:id="plantsRoot" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="1000.0" prefHeight="853.0" prefWidth="1219.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.PlantsController">
prefWidth="1219.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ch.zhaw.gartenverwaltung.PlantsController"
fx:id="plantsRoot">
<children> <children>
<SplitPane dividerPositions="0.7377363661277062" layoutX="539.0" layoutY="266.0" prefHeight="853.0" prefWidth="1219.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <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">
<items>
<AnchorPane maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children> <children>
<VBox maxWidth="1.7976931348623157E308" prefHeight="850.6666666666666" prefWidth="894.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <Label styleClass="page-title" prefHeight="45.0" prefWidth="903.0" text="Plants" VBox.vgrow="NEVER">
<children>
<Label prefHeight="45.0" prefWidth="903.0" text="Plants">
<font> <font>
<Font name="System Bold" size="30.0" /> <Font name="System Bold" size="30.0" />
</font> </font>
</Label> </Label>
<TextField fx:id="search_plants" promptText="Search for Plant Name" /> <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="100.0" prefWidth="200.0" spacing="10.0" VBox.vgrow="ALWAYS">
<HBox alignment="CENTER_LEFT" prefHeight="480.0" prefWidth="881.0" VBox.vgrow="ALWAYS"> <children>
<AnchorPane maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" HBox.hgrow="ALWAYS">
<children>
<VBox maxWidth="1.7976931348623157E308" prefHeight="850.6666666666666" prefWidth="894.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<TextField fx:id="search_plants" promptText="Search for Plant Name" VBox.vgrow="NEVER" />
<HBox alignment="CENTER_LEFT" minHeight="300.0" prefHeight="480.0" prefWidth="881.0" spacing="10.0" VBox.vgrow="ALWAYS">
<children> <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" />
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" 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>
<ImageView fx:id="img_plant" fitWidth="300" pickOnBounds="true" preserveRatio="true" />
</children>
</Pane>
</children> </children>
</HBox> </HBox>
<Label prefHeight="33.0" prefWidth="919.0" text="Plant Information:"> <VBox styleClass="vbox" maxHeight="1.7976931348623157E308" prefHeight="237.0" prefWidth="879.0" VBox.vgrow="ALWAYS">
<children>
<Label maxHeight="1.7976931348623157E308" prefHeight="33.0" prefWidth="919.0" text="Plant Information:" VBox.vgrow="NEVER">
<font> <font>
<Font name="System Bold" size="12.0" /> <Font name="System Bold" size="12.0" />
</font> </font>
<padding>
<Insets top="15.0" />
</padding>
</Label> </Label>
<Label fx:id="description_plant" alignment="TOP_LEFT" maxWidth="1.7976931348623157E308" prefHeight="194.0" prefWidth="893.0" text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." textAlignment="JUSTIFY" wrapText="true"> <Label fx:id="description_plant" alignment="TOP_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="96.0" prefWidth="879.0" text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." textAlignment="JUSTIFY" wrapText="true" VBox.vgrow="ALWAYS">
<padding> <padding>
<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" /> <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>
<VBox.margin>
<Insets />
</VBox.margin>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
</children> </children>
</VBox> </VBox>
</children> </children>
<HBox.margin>
<Insets />
</HBox.margin>
</AnchorPane> </AnchorPane>
<AnchorPane maxWidth="300.0" minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0"> <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" 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>
<Label text="Filter"> <Label text="Filter">
<font> <font>
@ -65,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>
@ -74,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>
@ -84,11 +97,16 @@
</children> </children>
</VBox> </VBox>
</children> </children>
</AnchorPane>
</items>
<padding> <padding>
<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>
</SplitPane> </AnchorPane>
</children> </children>
</HBox>
</children>
</VBox>
</children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</AnchorPane> </AnchorPane>

View File

@ -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.CheckBox?> <?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
@ -8,10 +9,9 @@
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="117.0" prefWidth="374.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.SettingsController">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="80.0" prefWidth="374.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.SettingsController">
<children> <children>
<VBox layoutX="14.0" layoutY="14.0" prefHeight="73.0" prefWidth="374.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <VBox layoutX="14.0" layoutY="14.0" prefHeight="73.0" prefWidth="374.0" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
<HBox prefHeight="23.0" prefWidth="334.0"> <HBox prefHeight="23.0" prefWidth="334.0">
<children> <children>
@ -19,7 +19,7 @@
<CheckBox fx:id="showTutorial_checkBox" mnemonicParsing="false" /> <CheckBox fx:id="showTutorial_checkBox" mnemonicParsing="false" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets left="10.0" right="10.0" top="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="20.0" prefHeight="23.0" prefWidth="334.0"> <HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="20.0" prefHeight="23.0" prefWidth="334.0">
@ -28,10 +28,20 @@
<ComboBox fx:id="selectHardinessZone_comboBox" prefWidth="150.0" promptText="Hardniness Zone" /> <ComboBox fx:id="selectHardinessZone_comboBox" prefWidth="150.0" promptText="Hardniness Zone" />
</children> </children>
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <Insets />
</VBox.margin> </VBox.margin>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" layoutX="20.0" layoutY="53.0" prefHeight="23.0" prefWidth="334.0" spacing="5.0">
<children>
<Label maxWidth="1.7976931348623157E308" text="Set Location" HBox.hgrow="ALWAYS" />
<Label fx:id="location_label" />
<Button fx:id="location_button" mnemonicParsing="false" onAction="#setLocation" />
</children> </children>
</HBox>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox> </VBox>
</children> </children>
</AnchorPane> </AnchorPane>

View File

@ -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 cancelButton="true" contentDisplay="CENTER" graphicTextGap="5.0" mnemonicParsing="false" onAction="#closeTutorial" styleClass="button-class" text="Close" />
<Button fx:id="previousPageButton" mnemonicParsing="false" text="Previous" onAction="#viewPreviousPage"/> <Button fx:id="previousPageButton" mnemonicParsing="false" onAction="#viewPreviousPage" styleClass="button-class" text="Previous" />
<Button fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" text="Next" onAction="#viewNextPage" /> <Button fx:id="nextPageButton" defaultButton="true" mnemonicParsing="false" onAction="#viewNextPage" styleClass="button-class" text="Next" />
</buttons> </buttons>
</ButtonBar> </ButtonBar>
</children> </children>
@ -38,7 +38,7 @@
<children> <children>
<VBox layoutX="30.0" layoutY="26.0" opacity="0.0" prefHeight="200.0" prefWidth="100.0"> <VBox layoutX="30.0" layoutY="26.0" opacity="0.0" prefHeight="200.0" prefWidth="100.0">
<children> <children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Managing Your Crops"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Adding Crops">
<font> <font>
<Font size="24.0" /> <Font size="24.0" />
</font> </font>
@ -75,7 +75,7 @@
</children> </children>
</TextFlow> </TextFlow>
<Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" /> <Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" />
<ImageView fx:id="imgSelectDate" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fx:id="imgSelectDate" fitHeight="150.0" fitWidth="400.0" pickOnBounds="true" preserveRatio="true" />
</children> </children>
</HBox> </HBox>
</children> </children>
@ -83,7 +83,50 @@
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
</VBox> </VBox>
<VBox prefHeight="200.0" prefWidth="100.0"> <VBox layoutX="30.0" layoutY="30.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Managing Your Crops">
<font>
<Font size="24.0" />
</font>
</Text>
<Separator prefWidth="200.0">
<VBox.margin>
<Insets bottom="15.0" top="10.0" />
</VBox.margin>
</Separator>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Once you've added a crop to your garden, it will be displayed in the &quot;My Garden&quot; tab.">
<VBox.margin>
<Insets bottom="20.0" />
</VBox.margin>
</Text>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextFlow lineSpacing="4.0" prefHeight="200.0" prefWidth="500.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="On the right hand side of the listing, you'll see two buttons.&#10;&#10;Button with the &quot;trash can&quot; icon lets you remove a crop from your garden plan. This will also delete all associated tasks.&#10;&#10;The button on the left will display the details of the crop in a new window." />
</children>
</TextFlow>
<Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" />
<ImageView fitHeight="70.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" fx:id="imgDetailDeleteButtons"/>
</children></HBox>
<HBox layoutX="10.0" layoutY="105.0" prefHeight="100.0" prefWidth="200.0">
<children>
<TextFlow lineSpacing="4.0" prefHeight="200.0" prefWidth="500.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Here, you can also add your own custom tasks, by clicking the &quot;Add Task&quot; button.&#10;In the subsequently shown dialog, you can enter the corresponding details.&#10;&#10;Note: If you want to make a task recurring, you need to set both an interval (in days) AND an end date, so the task won't repeat for all eternity." />
</children>
</TextFlow>
<Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" />
<ImageView fitHeight="150.0" fitWidth="400.0" pickOnBounds="true" preserveRatio="true" fx:id="imgAddTaskButton"/>
</children>
</HBox>
</children>
<opaqueInsets>
<Insets />
</opaqueInsets>
</VBox>
<VBox opacity="0.0" prefHeight="200.0" prefWidth="100.0">
<children> <children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Managing Your Tasks"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Managing Your Tasks">
<font> <font>
@ -111,19 +154,9 @@
</HBox.margin> </HBox.margin>
</TextFlow> </TextFlow>
<Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" /> <Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" />
<ImageView fx:id="imgTaskList" fitHeight="98.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fx:id="imgTaskList" fitHeight="200.0" fitWidth="400.0" pickOnBounds="true" preserveRatio="true" />
</children> </children>
</HBox> </HBox>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextFlow lineSpacing="4.0" prefHeight="200.0" prefWidth="500.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="You can also add your own custom tasks, by clicking the &quot;Add Task&quot; button.&#10;In the subsequently shown dialog, you can enter the corresponding details.&#10;&#10;Note: If you want to make a task recurring, you need to set both an interval (in days) AND an end date, so the task won't repeat for all eternity." />
</children>
</TextFlow>
<Separator prefWidth="200.0" visible="false" HBox.hgrow="ALWAYS" />
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
</children></HBox>
</children> </children>
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />

View File

@ -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;
}

View File

@ -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, .split-pane { .root, .scroll-pane, #homeVBox, #cropDetailVBox {
-fx-background-color: linear-gradient(green 0%, lawngreen 33%, lightgreen 66%, #eee 100%); -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;
}

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
fx:controller="ch.zhaw.gartenverwaltung.HelloController">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label fx:id="welcomeText"/>
<Button text="Hello!" onAction="#onHelloButtonClick"/>
</VBox>

View File

@ -14,6 +14,11 @@
"measures": "Less water." "measures": "Less water."
} }
], ],
"wateringCycle": {
"litersPerSqM": 25,
"interval": null,
"notes": []
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "03-10", "startDate": "03-10",
@ -21,11 +26,6 @@
"type": "SOW", "type": "SOW",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Germinate", "name": "Germinate",
@ -42,11 +42,6 @@
"type": "PLANT", "type": "PLANT",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 7,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -63,11 +58,6 @@
"type": "HARVEST", "type": "HARVEST",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvest", "name": "Harvest",
@ -85,6 +75,11 @@
"name": "Early Carrot", "name": "Early Carrot",
"description": "Carrot, (Daucus carota), herbaceous, generally biennial plant of the Apiaceae family that produces an edible taproot. Among common varieties root shapes range from globular to long, with lower ends blunt to pointed. Besides the orange-coloured roots, white-, yellow-, and purple-fleshed varieties are known.", "description": "Carrot, (Daucus carota), herbaceous, generally biennial plant of the Apiaceae family that produces an edible taproot. Among common varieties root shapes range from globular to long, with lower ends blunt to pointed. Besides the orange-coloured roots, white-, yellow-, and purple-fleshed varieties are known.",
"image": "carrot.jpg", "image": "carrot.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 3,
"notes": []
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "02-20", "startDate": "02-20",
@ -92,11 +87,7 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "SOW", "type": "SOW",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 15,
"interval": 3,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -113,13 +104,6 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "PLANT", "type": "PLANT",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 3,
"notes": [
"Be careful not to pour water over the leaves, as this will lead to sunburn."
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -136,11 +120,6 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "HARVEST", "type": "HARVEST",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvesting", "name": "Harvesting",
@ -167,6 +146,12 @@
"name": "Summertime Onion", "name": "Summertime Onion",
"description": "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.", "description": "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.",
"image": "onion.jpg", "image": "onion.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "03-15", "startDate": "03-15",
@ -174,12 +159,6 @@
"type": "SOW", "type": "SOW",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Plant Sets", "name": "Plant Sets",
@ -196,13 +175,6 @@
"type": "PLANT", "type": "PLANT",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 3,
"notes": [
""
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -219,12 +191,6 @@
"type": "HARVEST", "type": "HARVEST",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": [
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvesting", "name": "Harvesting",
@ -261,18 +227,19 @@
"measures": "Less water." "measures": "Less water."
} }
], ],
"lifecycle": [
{
"startDate": "12-01",
"endDate": "12-02",
"type": "SOW",
"zone": "ZONE_8A",
"group": 0,
"wateringCycle": { "wateringCycle": {
"litersPerSqM": 0, "litersPerSqM": 0,
"interval": null, "interval": null,
"notes": [] "notes": []
}, },
"lifecycle": [
{
"startDate": "12-01",
"endDate": "12-19",
"type": "SOW",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Germinate", "name": "Germinate",
@ -285,15 +252,10 @@
}, },
{ {
"startDate": "12-03", "startDate": "12-03",
"endDate": "12-15", "endDate": "12-22",
"type": "PLANT", "type": "PLANT",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 7,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -306,15 +268,10 @@
}, },
{ {
"startDate": "12-16", "startDate": "12-16",
"endDate": "12-18", "endDate": "12-30",
"type": "HARVEST", "type": "HARVEST",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvest", "name": "Harvest",

View File

@ -14,10 +14,10 @@
"id": 2, "id": 2,
"name": "water plant", "name": "water plant",
"description": "water the plant, so that the soil is wet around the plant.", "description": "water the plant, so that the soil is wet around the plant.",
"startDate": "2022-05-01", "startDate": "2022-10-29",
"nextExecution": "2022-05-01", "nextExecution": "2022-11-30",
"nextNotification": "2022-05-01", "nextNotification": "2022-05-01",
"endDate": "2022-09-01", "endDate": "2022-12-31",
"interval": 2, "interval": 2,
"cropId": 0 "cropId": 0
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -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(),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());
}
}

View File

@ -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));
@ -130,7 +169,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 {
@ -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);
}
} }
} }

View File

@ -49,11 +49,12 @@ public class GardenPlanModelTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()), new WateringCycle(15, 0, null),
new GrowthPhase(MonthDay.of(4, 3), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()), List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()),
new GrowthPhase(MonthDay.of(8, 5), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, 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(2, 8), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), 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(10, 2), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), 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(2023, 3, 1)) exampleCropOnion = new Crop(examplePlantOnion.id(), LocalDate.of(2023, 3, 1))
.withId(3); .withId(3);
@ -66,7 +67,8 @@ public class GardenPlanModelTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
List.of(new GrowthPhase(MonthDay.of(4, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()))); new WateringCycle(25, 0, null),
List.of(new GrowthPhase(MonthDay.of(4, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())));
exampleCropCarrot = new Crop(examplePlantCarrot.id(), LocalDate.now()) exampleCropCarrot = new Crop(examplePlantCarrot.id(), LocalDate.now())
.withId(5); .withId(5);

View File

@ -3,12 +3,21 @@ 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;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.MonthDay; import java.time.MonthDay;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@ -23,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();
@ -88,14 +112,19 @@ class GardenScheduleTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
new WateringCycle(15, 0, null),
List.of( List.of(
new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, List.of(
new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, List.of(
exampleTaskTemplateList.get(0), exampleTaskTemplateList.get(0),
exampleTaskTemplateList.get(1) exampleTaskTemplateList.get(1)
)), )),
new GrowthPhase(MonthDay.of(4, 3), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, List.of( new GrowthPhase(MonthDay.of(4, 3), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, List.of(
exampleTaskTemplateList.get(2), exampleTaskTemplateList.get(2),
exampleTaskTemplateList.get(3) exampleTaskTemplateList.get(3)
)),
new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.SOW, HardinessZone.ZONE_8A, List.of(
)) ))
))); )));
} }
@ -187,8 +216,7 @@ class GardenScheduleTest {
} }
@Test @Test
void planTasksForCrop() throws HardinessZoneNotSetException, PlantNotFoundException, IOException { void planTasksForCrop() throws HardinessZoneNotSetException, PlantNotFoundException, IOException, URISyntaxException {
assertThrows(PlantNotFoundException.class,()-> model.planTasksForCrop(new Crop()));
model.planTasksForCrop(new Crop(20, exampleStartDate).withId(30)); model.planTasksForCrop(new Crop(20, exampleStartDate).withId(30));
verify(exampleTaskTemplateList.get(0), times(1)).generateTask(exampleStartDate, 30); verify(exampleTaskTemplateList.get(0), times(1)).generateTask(exampleStartDate, 30);
verify(exampleTaskTemplateList.get(1), times(1)).generateTask(exampleStartDate, 30); verify(exampleTaskTemplateList.get(1), times(1)).generateTask(exampleStartDate, 30);
@ -198,5 +226,21 @@ class GardenScheduleTest {
verify(taskList, times(1)).saveTask(exampleTaskList.get(1)); verify(taskList, times(1)).saveTask(exampleTaskList.get(1));
verify(taskList, times(1)).saveTask(exampleTaskList.get(2)); verify(taskList, times(1)).saveTask(exampleTaskList.get(2));
verify(taskList, times(1)).saveTask(exampleTaskList.get(3)); verify(taskList, times(1)).saveTask(exampleTaskList.get(3));
final URL dbDataSource = this.getClass().getResource("test-taskdb.json");
final URL testFile = this.getClass().getResource("template-taskdb.json");
Files.copy(Path.of(testFile.toURI()), Path.of(dbDataSource.toURI()), StandardCopyOption.REPLACE_EXISTING);
JsonTaskList testTaskList = new JsonTaskList(dbDataSource);
model = spy(new GardenSchedule(testTaskList,plantList));
model.planTasksForCrop(new Crop(20, exampleStartDate).withId(30));
assertEquals(5,testTaskList.getTaskList(LocalDate.MIN,LocalDate.MAX).size());
testTaskList.getTaskList(LocalDate.MIN,LocalDate.MAX).get(0);
}
@Test
void testPlantNotFoundException() throws HardinessZoneNotSetException, IOException {
assertThrowsExactly(PlantNotFoundException.class, () -> { model.planTasksForCrop(new Crop(0, exampleStartDate)); });
} }
} }

View File

@ -49,11 +49,12 @@ class PlantListModelTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()), new WateringCycle(25, 0, null),
new GrowthPhase(MonthDay.of(4, 3), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()), List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()),
new GrowthPhase(MonthDay.of(8, 5), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, 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(2, 8), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), 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(10, 2), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), 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<>())))
); );
examplePlantList.add(new Plant( examplePlantList.add(new Plant(
0, 0,
@ -64,8 +65,9 @@ class PlantListModelTest {
6, 6,
"sandy", "sandy",
new ArrayList<>(), new ArrayList<>(),
List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()), new WateringCycle(0, 0, null),
new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()))) List.of(new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()),
new GrowthPhase(MonthDay.of(6, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())))
); );
examplePlantList.add(new Plant( examplePlantList.add(new Plant(
1, 1,
@ -76,7 +78,8 @@ class PlantListModelTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
List.of(new GrowthPhase(MonthDay.of(4, 4), MonthDay.of(12, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()))) new WateringCycle(25, 0, null),
List.of(new GrowthPhase(MonthDay.of(4, 4), MonthDay.of(12, 4), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())))
); );
} }
@ -98,7 +101,7 @@ class PlantListModelTest {
@Test @Test
void setCurrentZone() { void setCurrentZone() {
checkCurrentZone(HardinessZone.ZONE_8A); // TODO change to get default zone from config checkCurrentZone(HardinessZone.ZONE_8A);
model.setCurrentZone(HardinessZone.ZONE_1A); model.setCurrentZone(HardinessZone.ZONE_1A);
checkCurrentZone(HardinessZone.ZONE_1A); checkCurrentZone(HardinessZone.ZONE_1A);
model.setCurrentZone(HardinessZone.ZONE_8A); model.setCurrentZone(HardinessZone.ZONE_8A);

View File

@ -20,16 +20,16 @@ class PlantTest {
@BeforeEach @BeforeEach
void setUp() { void setUp() {
List<GrowthPhase> growthPhases = new ArrayList<>(); List<GrowthPhase> growthPhases = new ArrayList<>();
growthPhases.add(new GrowthPhase(MonthDay.of(2, 1), MonthDay.of(4, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(2, 1), MonthDay.of(4, 4), 0, GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(4, 2), MonthDay.of(6, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(4, 2), MonthDay.of(6, 5), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(6, 3), MonthDay.of(8, 6), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(6, 3), MonthDay.of(8, 6), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(3, 1), MonthDay.of(5, 4), 1, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(3, 1), MonthDay.of(5, 4), 1, GrowthPhaseType.SOW, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(5, 2), MonthDay.of(7, 5), 1, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(5, 2), MonthDay.of(7, 5), 1, GrowthPhaseType.PLANT, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(7, 3), MonthDay.of(9, 6), 1, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(7, 3), MonthDay.of(9, 6), 1, GrowthPhaseType.HARVEST, HardinessZone.ZONE_8A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(4, 1), MonthDay.of(6, 4), 0, new WateringCycle(0, 0, null), GrowthPhaseType.SOW, HardinessZone.ZONE_1A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(4, 1), MonthDay.of(6, 4), 0, GrowthPhaseType.SOW, HardinessZone.ZONE_1A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(6, 2), MonthDay.of(8, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(6, 2), MonthDay.of(8, 5), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(7, 2), MonthDay.of(9, 5), 0, new WateringCycle(0, 0, null), GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(7, 2), MonthDay.of(9, 5), 0, GrowthPhaseType.PLANT, HardinessZone.ZONE_1A, new ArrayList<>()));
growthPhases.add(new GrowthPhase(MonthDay.of(8, 3), MonthDay.of(10, 6), 0, new WateringCycle(0, 0, null), GrowthPhaseType.HARVEST, HardinessZone.ZONE_1A, new ArrayList<>())); growthPhases.add(new GrowthPhase(MonthDay.of(8, 3), MonthDay.of(10, 6), 0, GrowthPhaseType.HARVEST, HardinessZone.ZONE_1A, new ArrayList<>()));
testPlant = new Plant( testPlant = new Plant(
20, 20,
@ -40,6 +40,7 @@ class PlantTest {
0, 0,
"sandy to loamy, loose soil, free of stones", "sandy to loamy, loose soil, free of stones",
new ArrayList<>(), new ArrayList<>(),
new WateringCycle(25, 0, null),
growthPhases); growthPhases);
} }

View File

@ -0,0 +1,215 @@
[
{
"id": 0,
"name": "Potato",
"description": "The potato is a tuber, round or oval, with small white roots called 'eyes', that are growth buds. The size varies depending on the variety; the colour of the skin can be white, yellow or even purple.",
"light": 6,
"spacing": "35",
"soil": "sandy",
"image": "potato.jpg",
"pests": [
{
"name": "Rot",
"description": "Rot, any of several plant diseases, caused by any of hundreds of species of soil-borne bacteria, fungi, and funguslike organisms (Oomycota). Rot diseases are characterized by plant decomposition and putrefaction. The decay may be hard, dry, spongy, watery, mushy, or slimy and may affect any plant part.",
"measures": "Less water."
}
],
"wateringCycle": {
"litersPerSqM": 25,
"interval": null,
"notes": []
},
"lifecycle": [
{
"startDate": "03-10",
"endDate": "04-10",
"type": "SOW",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "Germinate",
"relativeStartDate": -14,
"relativeEndDate": null,
"description": "Take an egg carton and fill it with soil. Put the seedling deep enough so its half covered with soil. Keep it in 10-15 * Celsius with lots of light.",
"interval": null
}
]
},
{
"startDate": "04-10",
"endDate": "07-10",
"type": "PLANT",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "hilling",
"relativeStartDate": 0,
"relativeEndDate": null,
"description": "When the plants are 20 cm tall, begin hilling the potatoes by gently mounding the soil from the center of your rows around the stems of the plant. Mound up the soil around the plant until just the top few leaves show above the soil. Two weeks later, hill up the soil again when the plants grow another 20 cm.",
"interval": 21
}
]
},
{
"startDate": "06-10",
"endDate": "08-10",
"type": "HARVEST",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "Harvest",
"relativeStartDate": 0,
"relativeEndDate": null,
"description": "Once the foliage has wilted and dried completely, harvest on a dry day. Store in a dark and cool location.",
"interval": null
}
]
}
]
},
{
"id": 1,
"name": "Early Carrot",
"description": "Carrot, (Daucus carota), herbaceous, generally biennial plant of the Apiaceae family that produces an edible taproot. Among common varieties root shapes range from globular to long, with lower ends blunt to pointed. Besides the orange-coloured roots, white-, yellow-, and purple-fleshed varieties are known.",
"image": "carrot.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 3,
"notes": []
},
"lifecycle": [
{
"startDate": "02-20",
"endDate": "03-10",
"zone": "ZONE_8A",
"type": "SOW",
"group": 0,
"taskTemplates": [
{
"name": "hilling",
"relativeStartDate": 0,
"relativeEndDate": 0,
"description": "Mound up the soil around the plant until just the top few leaves show above the soil. ",
"interval": null
}
]
},
{
"startDate": "03-10",
"endDate": "05-10",
"zone": "ZONE_8A",
"type": "PLANT",
"group": 0,
"taskTemplates": [
{
"name": "hilling",
"relativeStartDate": 0,
"relativeEndDate": null,
"description": "Mound up the soil around the plant until just the top few leaves show above the soil. ",
"interval": 15
}
]
},
{
"startDate": "05-10",
"endDate": "05-20",
"zone": "ZONE_8A",
"type": "HARVEST",
"group": 0,
"taskTemplates": [
{
"name": "Harvesting",
"relativeStartDate": 0,
"relativeEndDate": 14,
"description": "When the leaves turn to a yellowish brown. Do not harvest earlier. The plant will show when it's ready.",
"interval": null
}
]
}
],
"soil": "sandy to loamy, loose soil, free of stones",
"spacing": "5,35,2.5",
"pests": [
{
"name": "Rot",
"description": "rot, any of several plant diseases, caused by any of hundreds of species of soil-borne bacteria, fungi, and funguslike organisms (Oomycota). Rot diseases are characterized by plant decomposition and putrefaction. The decay may be hard, dry, spongy, watery, mushy, or slimy and may affect any plant part.",
"measures": "less water"
}
]
},
{
"id": 2,
"name": "Summertime Onion",
"description": "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.",
"image": "onion.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"lifecycle": [
{
"startDate": "03-15",
"endDate": "04-10",
"type": "SOW",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "Plant Sets",
"relativeStartDate": 0,
"relativeEndDate": 0,
"description": "Plant the sets about 5cm deep into the soil.",
"interval": null
}
]
},
{
"startDate": "04-10",
"endDate": "07-10",
"type": "PLANT",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "hilling",
"relativeStartDate": 0,
"relativeEndDate": null,
"description": "Mound up the soil around the plant until just the top few leaves show above the soil. ",
"interval": 15
}
]
},
{
"startDate": "07-10",
"endDate": "09-20",
"type": "HARVEST",
"zone": "ZONE_8A",
"group": 0,
"taskTemplates": [
{
"name": "Harvesting",
"relativeStartDate": 0,
"relativeEndDate": 14,
"description": "When ready for harvest, the leaves on your onion plants will start to flop over. This happens at the \"neck\" of the onion and it signals that the plant has stopped growing and is ready for storage. Onions should be harvested soon thereafter",
"interval": null
}
]
}
],
"soil": "sandy to loamy, loose soil, free of stones",
"spacing": "15,30,2",
"pests": [
{
"name": "Rot",
"description": "rot, any of several plant diseases, caused by any of hundreds of species of soil-borne bacteria, fungi, and funguslike organisms (Oomycota). Rot diseases are characterized by plant decomposition and putrefaction. The decay may be hard, dry, spongy, watery, mushy, or slimy and may affect any plant part.",
"measures": "less water"
}
]
}
]

View File

@ -4,6 +4,8 @@
"name" : "sow plant", "name" : "sow plant",
"description": "Plant the seeds, crops in de bed.", "description": "Plant the seeds, crops in de bed.",
"startDate" : "2022-05-01", "startDate" : "2022-05-01",
"nextExecution": "2022-05-01",
"nextNotification": "2022-05-01",
"endDate" : "2022-05-01", "endDate" : "2022-05-01",
"interval" : 0, "interval" : 0,
"cropId" : 0 "cropId" : 0
@ -13,6 +15,8 @@
"name" : "water plant", "name" : "water plant",
"description": "water the plant, so that the soil is wet around the plant.", "description": "water the plant, so that the soil is wet around the plant.",
"startDate" : "2022-05-01", "startDate" : "2022-05-01",
"nextExecution": "2022-05-01",
"nextNotification": "2022-05-01",
"endDate" : "2022-09-01", "endDate" : "2022-09-01",
"interval" : 2, "interval" : 2,
"cropId" : 0 "cropId" : 0
@ -22,6 +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-06-01",
"nextNotification": "2022-06-01",
"endDate" : "2022-08-01", "endDate" : "2022-08-01",
"interval" : 28, "interval" : 28,
"cropId" : 0 "cropId" : 0
@ -31,6 +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-07-01",
"nextNotification": "2022-07-01",
"endDate" : "2022-07-01", "endDate" : "2022-07-01",
"interval" : 0, "interval" : 0,
"cropId" : 0 "cropId" : 0
@ -40,6 +48,8 @@
"name" : "look after plant", "name" : "look after plant",
"description": "Look for pest or illness at the leaves of the plant. Check the soil around the plant, if the roots are enough covered with soil", "description": "Look for pest or illness at the leaves of the plant. Check the soil around the plant, if the roots are enough covered with soil",
"startDate" : "2022-05-01", "startDate" : "2022-05-01",
"nextExecution": "2022-05-01",
"nextNotification": "2022-05-01",
"endDate" : "2022-09-01", "endDate" : "2022-09-01",
"interval" : 5, "interval" : 5,
"cropId" : 0 "cropId" : 0
@ -49,8 +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-09-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
} }
] ]

View File

@ -14,6 +14,11 @@
"measures": "Less water." "measures": "Less water."
} }
], ],
"wateringCycle": {
"litersPerSqM": 25,
"interval": null,
"notes": []
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "03-10", "startDate": "03-10",
@ -21,11 +26,6 @@
"type": "SOW", "type": "SOW",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Germinate", "name": "Germinate",
@ -42,11 +42,6 @@
"type": "PLANT", "type": "PLANT",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 7,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -63,11 +58,6 @@
"type": "HARVEST", "type": "HARVEST",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvest", "name": "Harvest",
@ -85,6 +75,11 @@
"name": "Early Carrot", "name": "Early Carrot",
"description": "Carrot, (Daucus carota), herbaceous, generally biennial plant of the Apiaceae family that produces an edible taproot. Among common varieties root shapes range from globular to long, with lower ends blunt to pointed. Besides the orange-coloured roots, white-, yellow-, and purple-fleshed varieties are known.", "description": "Carrot, (Daucus carota), herbaceous, generally biennial plant of the Apiaceae family that produces an edible taproot. Among common varieties root shapes range from globular to long, with lower ends blunt to pointed. Besides the orange-coloured roots, white-, yellow-, and purple-fleshed varieties are known.",
"image": "carrot.jpg", "image": "carrot.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 3,
"notes": []
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "02-20", "startDate": "02-20",
@ -92,11 +87,7 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "SOW", "type": "SOW",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 15,
"interval": 3,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -113,13 +104,6 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "PLANT", "type": "PLANT",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 3,
"notes": [
"Be careful not to pour water over the leaves, as this will lead to sunburn."
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -136,11 +120,6 @@
"zone": "ZONE_8A", "zone": "ZONE_8A",
"type": "HARVEST", "type": "HARVEST",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": []
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvesting", "name": "Harvesting",
@ -167,6 +146,12 @@
"name": "Summertime Onion", "name": "Summertime Onion",
"description": "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.", "description": "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.",
"image": "onion.jpg", "image": "onion.jpg",
"wateringCycle": {
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"lifecycle": [ "lifecycle": [
{ {
"startDate": "03-15", "startDate": "03-15",
@ -174,19 +159,12 @@
"type": "SOW", "type": "SOW",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 15,
"interval": 4,
"notes": [
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "Plant Sets",
"relativeStartDate": 0, "relativeStartDate": 0,
"relativeEndDate": 0, "relativeEndDate": 0,
"description": "Mound up the soil around the plant until just the top few leaves show above the soil. ", "description": "Plant the sets about 5cm deep into the soil.",
"interval": null "interval": null
} }
] ]
@ -197,13 +175,6 @@
"type": "PLANT", "type": "PLANT",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 25,
"interval": 3,
"notes": [
""
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "hilling", "name": "hilling",
@ -220,13 +191,6 @@
"type": "HARVEST", "type": "HARVEST",
"zone": "ZONE_8A", "zone": "ZONE_8A",
"group": 0, "group": 0,
"wateringCycle": {
"litersPerSqM": 0,
"interval": null,
"notes": [
]
},
"taskTemplates": [ "taskTemplates": [
{ {
"name": "Harvesting", "name": "Harvesting",

View File

@ -0,0 +1,2 @@
[
]