Javadocs and code cleanup
This commit is contained in:
parent
7741569659
commit
6aeda395c3
|
@ -6,21 +6,58 @@ import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton Class to store default Settings and User Settings
|
||||||
|
*/
|
||||||
public class Settings {
|
public class Settings {
|
||||||
private static final Settings instance;
|
/*
|
||||||
private HardinessZone currentHardinessZone = HardinessZone.ZONE_8A;
|
* The Class instance to use everywhere
|
||||||
private final BooleanProperty showTutorial = new SimpleBooleanProperty(false);
|
*/
|
||||||
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);
|
|
||||||
// Gmail Address: pm3.hs22.it21b.win.team1@gmail.com
|
|
||||||
// Gmail Passwort: Gartenverwaltung.PM3.2022
|
|
||||||
// E-Mail Inbox: https://www.mailinator.com/v4/public/inboxes.jsp?to=pm3.hs22.it21b.win.team1
|
|
||||||
private String mailNotificationReceivers = "pm3.hs22.it21b.win.team1@mailinator.com";
|
|
||||||
private String mailNotificationSubjectTemplate = "Task %s is due!"; // {0} = Task Name
|
|
||||||
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"; // {0} = Task Name, {1} = plantname, {2} = nextExecution, {3} = Task description
|
|
||||||
|
|
||||||
|
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 = "";
|
private String location = "";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Create Instance of Settings
|
||||||
|
*/
|
||||||
static {
|
static {
|
||||||
instance = new Settings();
|
instance = new Settings();
|
||||||
}
|
}
|
||||||
|
@ -29,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) {
|
||||||
|
|
Loading…
Reference in New Issue