Merged Notification Branch with Weather Branch
This commit is contained in:
parent
1faf1c10de
commit
fd28ca7cc2
|
@ -26,7 +26,7 @@ tasks.withType(JavaCompile) {
|
|||
|
||||
application {
|
||||
mainModule = 'ch.zhaw.gartenverwaltung'
|
||||
mainClass = 'ch.zhaw.gartenverwaltung.HelloApplication'
|
||||
mainClass = 'ch.zhaw.gartenverwaltung.Main'
|
||||
}
|
||||
|
||||
javafx {
|
||||
|
|
|
@ -2,13 +2,16 @@ package ch.zhaw.gartenverwaltung;
|
|||
|
||||
import ch.zhaw.gartenverwaltung.bootstrap.AppLoader;
|
||||
import ch.zhaw.gartenverwaltung.backgroundtasks.BackgroundTasks;
|
||||
import ch.zhaw.gartenverwaltung.io.PlantList;
|
||||
import ch.zhaw.gartenverwaltung.io.TaskList;
|
||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
|
||||
public class HelloApplication extends Application {
|
||||
public class Main extends Application {
|
||||
Timer backGroundTaskTimer = new Timer();
|
||||
BackgroundTasks backgroundTasks;
|
||||
|
||||
|
@ -16,7 +19,7 @@ public class HelloApplication extends Application {
|
|||
public void start(Stage stage) throws IOException {
|
||||
AppLoader appLoader = new AppLoader();
|
||||
|
||||
backgroundTasks = new BackgroundTasks(appLoader.getTaskList(), appLoader.getGarden(), appLoader.getPlantList());
|
||||
backgroundTasks = new BackgroundTasks((TaskList) appLoader.getAppDependency(TaskList.class),(Garden) appLoader.getAppDependency(Garden.class), (PlantList) appLoader.getAppDependency(PlantList.class));
|
||||
backGroundTaskTimer.scheduleAtFixedRate(backgroundTasks, 0, 1000);
|
||||
|
||||
appLoader.loadSceneToStage("MainFXML.fxml", stage);
|
|
@ -1,4 +1,4 @@
|
|||
package ch.zhaw.gartenverwaltung.io;
|
||||
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
|
||||
|
||||
public enum SevereWeather {
|
||||
FROST,SNOW,HAIL,NO_SEVERE_WEATHER,RAIN
|
|
@ -1,5 +1,9 @@
|
|||
package ch.zhaw.gartenverwaltung.io;
|
||||
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.*;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ch.zhaw.gartenverwaltung.io;
|
||||
package ch.zhaw.gartenverwaltung.backgroundtasks.weather;
|
||||
|
||||
public class WeatherService {
|
||||
private static final int NO_RAIN = 0;
|
|
@ -1,6 +1,6 @@
|
|||
package ch.zhaw.gartenverwaltung.bootstrap;
|
||||
|
||||
import ch.zhaw.gartenverwaltung.HelloApplication;
|
||||
import ch.zhaw.gartenverwaltung.Main;
|
||||
import ch.zhaw.gartenverwaltung.io.*;
|
||||
import ch.zhaw.gartenverwaltung.models.Garden;
|
||||
import ch.zhaw.gartenverwaltung.models.GardenSchedule;
|
||||
|
@ -77,7 +77,7 @@ public class AppLoader {
|
|||
* @throws IOException if the file could not be loaded
|
||||
*/
|
||||
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();
|
||||
Scene scene = new Scene(root);
|
||||
String css = Objects.requireNonNull(this.getClass().getResource("styles.css")).toExternalForm();
|
||||
|
@ -99,7 +99,7 @@ public class AppLoader {
|
|||
* @throws IOException if the file could not be loaded
|
||||
*/
|
||||
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());
|
||||
Object controller = loader.getController();
|
||||
annotationInject(controller);
|
||||
|
@ -114,7 +114,7 @@ public class AppLoader {
|
|||
* @throws IOException if the file could not be loaded
|
||||
*/
|
||||
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();
|
||||
panes.put(fxmlFile, pane);
|
||||
annotationInject(loader.getController());
|
||||
|
@ -152,7 +152,7 @@ public class AppLoader {
|
|||
});
|
||||
}
|
||||
|
||||
private Object getAppDependency(Class<?> type) {
|
||||
public Object getAppDependency(Class<?> type) {
|
||||
return dependencies.get(type.getSimpleName());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue