Add model test
This commit is contained in:
@@ -15,8 +15,8 @@ import javafx.scene.Scene;
|
||||
public class Model {
|
||||
private static boolean fileIsSaved;
|
||||
private static Optional<Path> activeFilePath;
|
||||
private static Optional<Path> currentProjectPath;
|
||||
private static ProgrammingLanguage currentProgrammingLanguage;
|
||||
private static Optional<Path> activeProjectPath;
|
||||
private static ProgrammingLanguage activeProgrammingLanguage;
|
||||
private static String theme;
|
||||
private static Scene scene;
|
||||
private static SettingsProvider settings;
|
||||
@@ -26,19 +26,23 @@ public class Model {
|
||||
}
|
||||
|
||||
public static void setActiveFilePath(Optional<Path> path) {
|
||||
if (path == null)
|
||||
throw new IllegalArgumentException("path can not be null");
|
||||
Model.activeFilePath = path;
|
||||
}
|
||||
|
||||
public static Optional<Path> getProjectPath() {
|
||||
return currentProjectPath;
|
||||
return activeProjectPath;
|
||||
}
|
||||
|
||||
public static void setProjectPath(Optional<Path> path) {
|
||||
Model.currentProjectPath = path;
|
||||
if (path == null)
|
||||
throw new IllegalArgumentException("path can not be null");
|
||||
Model.activeProjectPath = path;
|
||||
}
|
||||
|
||||
public static ProgrammingLanguage getLanguage() {
|
||||
return currentProgrammingLanguage;
|
||||
return activeProgrammingLanguage;
|
||||
}
|
||||
|
||||
public static Scene getScene() {
|
||||
@@ -58,14 +62,20 @@ public class Model {
|
||||
}
|
||||
|
||||
public static void setTheme(String theme) {
|
||||
if (theme == null)
|
||||
throw new IllegalArgumentException("theme can not be null");
|
||||
Model.theme = theme;
|
||||
}
|
||||
|
||||
public static void setLanguage(ProgrammingLanguage language) {
|
||||
Model.currentProgrammingLanguage = language;
|
||||
if (language == null)
|
||||
throw new IllegalArgumentException("language can not be null");
|
||||
Model.activeProgrammingLanguage = language;
|
||||
}
|
||||
|
||||
public static void setScene(Scene scene) {
|
||||
if (scene == null)
|
||||
throw new IllegalArgumentException("scene can not be null");
|
||||
Model.scene = scene;
|
||||
}
|
||||
|
||||
@@ -74,6 +84,8 @@ public class Model {
|
||||
}
|
||||
|
||||
public static void setSettingsProvider(SettingsProvider settings) {
|
||||
if (settings == null)
|
||||
throw new IllegalArgumentException("settings can not be null");
|
||||
Model.settings = settings;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user