You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
package data;
|
|
|
|
import java.util.prefs.Preferences;
|
|
import data.Const;
|
|
|
|
public class Options {
|
|
private Preferences store;
|
|
private boolean wasEmpty;
|
|
private static final String DEF_OPTS_PATH = "";
|
|
|
|
public Options() {
|
|
//store = Preferences.userRoot();
|
|
//wasEmpty = store.nodeExists(Const.PROGRAM_NAME);
|
|
//store = store.node(Const.PROGRAM_NAME);
|
|
//if (wasEmpty) {
|
|
// //load default opts from resource
|
|
// importDefPreferences();
|
|
//}
|
|
}
|
|
|
|
public Options(String pathname) {
|
|
store = Preferences.userRoot().node(pathname);
|
|
}
|
|
|
|
public Options getSection(String section) {
|
|
//String path = Const.PROGRAM_NAME + "/" + section;
|
|
//Options result = new Options(path);
|
|
//return result;
|
|
return null;
|
|
}
|
|
|
|
public void imoprtPreferences(String xmlpath) {
|
|
//XXX
|
|
System.out.println("Loaded preference from: "
|
|
+ xmlpath);
|
|
}
|
|
|
|
public void imoprtDefPreferences(String xmlpath) {
|
|
//XXX
|
|
System.out.println("Loaded default preference: ");
|
|
}
|
|
|
|
public void exportPreferences(String xmlpath) {
|
|
//XXX
|
|
System.out.println("Exported preference from: "
|
|
+ xmlpath);
|
|
}
|
|
|
|
public void destroy() {
|
|
//XXX
|
|
// Clear config if requested or config was empty
|
|
// and is not saving
|
|
//if ((getBool(EMPTY) && getBool(NO_SAVE))
|
|
// || getBool(CLEAR)) {
|
|
// this.store.clear();
|
|
// }
|
|
}
|
|
|
|
// Default all false bool pref to be safe
|
|
// Default should be imported by constructor regardless
|
|
public boolean getBool(String key) {
|
|
return this.store.getBoolean(key, false);
|
|
}
|
|
|
|
// Default all empty string pref to be safe
|
|
// Default should be imported by constructor regardless
|
|
public String getString(String key) {
|
|
return this.store.get(key, "");
|
|
}
|
|
|
|
public void parseArgs(String[] args) {
|
|
//XXX
|
|
}
|
|
|
|
}
|