diff options
| author | Paul Buetow <paul@buetow.org> | 2008-08-15 04:09:42 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-08-15 04:09:42 +0000 |
| commit | afed274c10a93957f82a009824cafe8d83aa68a8 (patch) | |
| tree | 4a4d3980a3d9eb32bf7be443a83afe4c21dcdf55 /VS-Sim-Sources/sources/prefs | |
new branches
Diffstat (limited to 'VS-Sim-Sources/sources/prefs')
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/VSDefaultPrefs.java | 276 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/VSPrefs.java | 1190 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/VSPrefsRestriction.java | 157 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/VSSerializablePrefs.java | 60 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/.VSEditorFrame.java.swp | bin | 0 -> 16384 bytes | |||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSAbstractBetterEditor.java | 140 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSAbstractEditor.java | 1047 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSColorChooser.java | 78 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSEditorFrame.java | 117 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSEditorTable.java | 314 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSProcessEditor.java | 131 | ||||
| -rw-r--r-- | VS-Sim-Sources/sources/prefs/editors/VSSimulatorEditor.java | 143 |
12 files changed, 3653 insertions, 0 deletions
diff --git a/VS-Sim-Sources/sources/prefs/VSDefaultPrefs.java b/VS-Sim-Sources/sources/prefs/VSDefaultPrefs.java new file mode 100644 index 0000000..2cc7e39 --- /dev/null +++ b/VS-Sim-Sources/sources/prefs/VSDefaultPrefs.java @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * All icons of the icons/ folder are under a Creative Commons + * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. + * + * The icon's homepage is http://code.google.com/p/ultimate-gnome/ + */ + +package prefs; + +import java.awt.Color; +import java.awt.event.KeyEvent; + +/** + * The class VSDefaultPrefs, makes sure that the simulator has its default + * configuration values. (Btw: This is the only class which is allowed to have + * code lines which are longer than 80 chars!) + * + * @author Paul C. Buetow + */ +public class VSDefaultPrefs extends VSSerializablePrefs { + /** The serial version uid */ + private static final long serialVersionUID = 1L; + + /** + * Inits a prefs object with default values. + * + * @return the lang.process.removeprefs + */ + public static VSPrefs init() { + VSDefaultPrefs prefs = new VSDefaultPrefs(); + prefs.fillWithDefaults(); + return prefs; + } + + /** + * Fill everything with ts defaults. + */ + public void fillWithDefaults() { + super.clear(); + addWithDefaults(); + } + + /** + * Adds default values if not existent. + */ + public void addWithDefaults() { + fillDefaultBooleans(); + fillDefaultColors(); + fillDefaultFloats(); + fillDefaultIntegers(); + fillDefaultLongs(); + fillDefaultStrings(); + } + + /** + * Fill with default strings. + */ + public void fillDefaultStrings() { + initString("lang.about", "About"); + initString("lang.about.info", "Dieses Programm wurde von Paul Bütow im Rahmen der Diplomarbeit \"Objektorientierte Entwicklung eines GUI-basierten Tools für die ereignisbasierte Simulator verteilter Systeme\" bei Prof. Dr.-Ing. Oßmann als 1. Prüfer sowie Betreuer und Prof. Dr. rer. nat. Fassbender als 2. Prüfer erstellt. Bei Fehlern bitte eine kurze Mail mit Fehlerbeschreibung an vs@paul.buetow.org schicken!"); + initString("lang.activate", "aktivieren"); + initString("lang.activated", "aktiviert"); + initString("lang.actualize", "Aktualisieren"); + initString("lang.all", "Alle"); + initString("lang.antialiasing", "Anti-Aliasing"); + initString("lang.cancel", "Abbrechen"); + initString("lang.client", "Client"); + initString("lang.clientrequest.start", "Clientanfrage starten"); + initString("lang.close", "Schliessen"); + initString("lang.colorchooser", "Farbauswahl"); + initString("lang.colorchooser2", "Bitte Farbe auswählen"); + initString("lang.copy", "Kopieren"); + initString("lang.crashed", "Abgestürzt"); + initString("lang.dat", "Simulation (.dat)"); + initString("lang.deactivate", "deaktivieren"); + initString("lang.deactivated", "deaktiviert"); + initString("lang.default", "Defaults"); + initString("lang.edit", "Editieren"); + initString("lang.editor", "Editor"); + initString("lang.event", "Ereignis"); + initString("lang.event.add.global", "Globales Ereignis einfügen"); + initString("lang.event.add.local", "Lokales Ereignis einfügen"); + initString("lang.event.add.time", "bei"); + initString("lang.events", "Ereignisse"); + initString("lang.events.process", "Prozessereignisse"); + initString("lang.file", "Datei"); + initString("lang.filter", "Filter"); + initString("lang.loging.active", "Logging"); + initString("lang.loging.clear", "Loggs löschen"); + initString("lang.message", "Nachricht"); + initString("lang.message.recv", "Nachricht erhalten"); + initString("lang.message.sent", "Nachricht versendet"); + initString("lang.mode.expert", "Expertenmodus"); + initString("lang.name", "VS-Simulator 1.0"); + initString("lang.ok", "OK"); + initString("lang.open", "Öffnen"); + initString("lang.pause", "Pausieren"); + initString("lang.prefs", "Einstellungen"); + initString("lang.prefs.color", "Farbeinstellungen"); + initString("lang.prefs.diverse", "Diverse Einstellungen"); + initString("lang.prefs.ext", "Erweiterte Einstellungen"); + initString("lang.prefs.message", "Nachrichteneinstellungen"); + initString("lang.prefs.message.defaults", "Nachrichteneinstellungen für neue Prozesse"); + initString("lang.prefs.more", "Mehr Einstellungen"); + initString("lang.prefs.process", "Prozesseinstellungen"); + initString("lang.prefs.process", "Prozessstandardeinstellungen"); + initString("lang.prefs.process.defaults", "Einstellungen für neue Prozesse"); + initString("lang.prefs.process.ext", "Erweiterte Prozesseinstellungen"); + initString("lang.prefs.protocols", "Protokolleinstellungen"); + initString("lang.prefs.simulator", "Simulationseinstellungen"); + initString("lang.process", "Prozess"); + initString("lang.process.add.new", "Neuen Prozess hinzufügen"); + initString("lang.process.crash", "Prozess abstürzen"); + initString("lang.process.edit", "Prozess editieren"); + initString("lang.process.id", "PID"); + initString("lang.process.new", "Neuer Prozess"); + initString("lang.process.not.selected", "Kein Prozess ausgewählt"); + initString("lang.process.recover", "Prozess wiederbeleben"); + initString("lang.process.remove", "Prozess entfernen"); + initString("lang.process.selected", "Aktuell ausgewählter Prozess"); + initString("lang.process.time.local", "Lokale Zeit"); + initString("lang.processes.all", "Alle Prozesse"); + initString("lang.protocol", "Protokoll"); + initString("lang.protocol.client", "Clientseite"); + initString("lang.protocol.editor", "Protokolleditor"); + initString("lang.protocol.server", "Serverseite"); + initString("lang.protocol.tasks.activation", "Client-/Serverprotokoll Aktivierung"); + initString("lang.protocol.tasks.client", "Client Task-Manager (Clientanfragen)"); + initString("lang.protocols", "Protokolle"); + initString("lang.quit", "Beenden"); + initString("lang.recovered", "Wiederbelebt"); + initString("lang.remove", "Entfernen"); + initString("lang.replay", "Wiederholen"); + initString("lang.reset", "Reset"); + initString("lang.save", "Speichern"); + initString("lang.saveas", "Speichern unter"); + initString("lang.server", "Server"); + initString("lang.serverrequest.start", "Serveranfrage starten"); + initString("lang.simulator", "Simulator"); + initString("lang.simulator.close", "Simulation schliessen"); + initString("lang.simulator.finished", "Simulation beendet"); + initString("lang.simulator.new", "Neue Simulation"); + initString("lang.simulator.paused", "Simulation pausiert"); + initString("lang.simulator.resetted", "Simulation zurückgesetzt"); + initString("lang.simulator.started", "Simulation gestartet"); + initString("lang.start", "Starten"); + initString("lang.stop", "Stoppen"); + initString("lang.takeover", "Übernehmen"); + initString("lang.task", "Aufgabe"); + initString("lang.task.manager", "Ereigniseditor"); + initString("lang.tasks.fullfilled", "Abgelaufene Aufgaben"); + initString("lang.tasks.global", "Globale Aufgaben"); + initString("lang.tasks.local", "Lokale Aufgaben"); + initString("lang.time", "Zeit"); + initString("lang.time.lamport", "Lamportzeit"); + initString("lang.time.vector", "Vektorzeit"); + initString("lang.timed.global", "Globale Ereignisse"); + initString("lang.timed.local", "Lokale Ereignisse"); + initString("lang.type", "Typ"); + initString("lang.value", "Wert"); + initString("lang.variable", "Variable"); + initString("lang.variables", "Variablen"); + initString("lang.variables.global", "Globale Variablen"); + initString("lang.window.close", "Fenster schliessen"); + initString("lang.window.new", "Neues Fenster"); + } + + /** + * Fill with default integers. + */ + public void fillDefaultIntegers() { + /* Simulator prefs */ + initInteger("sim.process.num", 3, "Anzahl der Prozesse", 1, 6); + initInteger("message.prob.outage", 0, "Nachrichtenverlustw'keit", 0, 100, "%"); + initInteger("process.prob.crash", 0, "Prozessausfallw'keit", 0, 100, "%"); + initInteger("sim.seconds", 15, "Dauer der Simulation", 5, 120, "s"); + + /* Internal prefs */ + initInteger("keyevent.about", KeyEvent.VK_A, null, 0, 100); + initInteger("keyevent.cancel", KeyEvent.VK_A, null, 0, 100); + initInteger("keyevent.close", KeyEvent.VK_C, null, 0, 100); + initInteger("keyevent.default", KeyEvent.VK_F, null, 0, 100); + initInteger("keyevent.edit", KeyEvent.VK_E, null, 0, 100); + initInteger("keyevent.file", KeyEvent.VK_D, null, 0, 100); + initInteger("keyevent.new", KeyEvent.VK_N, null, 0, 100); + initInteger("keyevent.actualize", KeyEvent.VK_A, null, 0, 100); + initInteger("keyevent.takeover", KeyEvent.VK_B, null, 0, 100); + initInteger("keyevent.ok", KeyEvent.VK_O, null, 0, 100); + initInteger("keyevent.open", KeyEvent.VK_O, null, 0, 100); + initInteger("keyevent.pause", KeyEvent.VK_P, null, 0, 100); + initInteger("keyevent.prefs", KeyEvent.VK_P, null, 0, 100); + initInteger("keyevent.prefs.ext", KeyEvent.VK_E, null, 0, 100); + initInteger("keyevent.quit", KeyEvent.VK_B, null, 0, 100); + initInteger("keyevent.replay", KeyEvent.VK_W, null, 0, 100); + initInteger("keyevent.reset", KeyEvent.VK_R, null, 0, 100); + initInteger("keyevent.save", KeyEvent.VK_S, null, 0, 100); + initInteger("keyevent.saveas", KeyEvent.VK_V, null, 0, 100); + initInteger("keyevent.simulator", KeyEvent.VK_S, null, 0, 100); + initInteger("keyevent.start", KeyEvent.VK_S, null, 0, 100); + initInteger("keyevent.stop", KeyEvent.VK_P, null, 0, 100); + + initInteger("div.window.prefs.xsize", 400, "Einstellungsfenster X-Achse", 550, 3200, "px"); + initInteger("div.window.prefs.ysize", 400, "Einstellungsfenster Y-Achse", 640, 2400, "px"); + initInteger("div.window.logsize", 300, "Loggfenster Y-Achse", 100, 1000, "px"); + initInteger("div.window.splitsize", 320, "Toolbar X-Achse", 100, 1000, "px"); + initInteger("div.window.xsize", 1024, "Hauptfenster X-Achse", 750, 3200, "px"); + initInteger("div.window.ysize", 768, "Hauptfenster Y-Achse", 600, 2400, "px"); + } + + /** + * Fill with default floats. + */ + public void fillDefaultFloats() { + /* Simulator prefs */ + initFloat("process.clock.variance", 0, "Uhrabweichung"); + initFloat("sim.clock.speed", 0.5f, "Abspielgeschwindigkeit der Simulation"); + } + + /** + * Fill default longs. + */ + public void fillDefaultLongs() { + /* Simulator prefs */ + initLong("message.sendingtime.min", 500, "Minimale Übertragungszeit", "ms"); + initLong("message.sendingtime.max", 2000, "Maximale Übertragungszeit", "ms"); + } + + /** + * Fill with default colors. + */ + public void fillDefaultColors() { + /* Internal prefs */ + initColor("col.background", new Color(0xFF, 0xFF, 0xFF)); + initColor("col.process.default", new Color(0x00, 0x00, 0x00)); + initColor("col.process.running", new Color(0x0D, 0xD8, 0x09)); + initColor("col.process.crashed", new Color(0xff, 0x00, 0x00)); + initColor("col.process.highlight", new Color(0xff, 0xA5, 0x00)); + initColor("col.process.line", new Color(0x00, 0x00, 0x00)); + initColor("col.process.secondline", new Color(0xAA, 0xAA, 0xAA)); + initColor("col.process.sepline", new Color(0xff, 0x00, 0x00)); + initColor("col.process.stopped", new Color(0x00, 0x00, 0x00)); + initColor("col.message.arrived", new Color(0x00, 0x85, 0xD2)); + initColor("col.message.sending", new Color(0x0D, 0xD8, 0x09)); + initColor("col.message.lost", new Color(0xFF, 0x00, 0x00)); + } + + /** + * Fill with default booleans. + */ + public void fillDefaultBooleans() { + initBoolean("sim.mode.expert", false, "Expertenmodus aktivieren"); + initBoolean("sim.message.own.recv", false, "Prozesse empfangen eigene Nachrichten"); + initBoolean("sim.message.prob.mean", true, "Mittelwerte der Nachrichtverlustw'k. bilden"); + initBoolean("sim.message.sendingtime.mean", true, "Mittelwerte der Übertragungszeiten bilden"); + initBoolean("sim.messages.relevant", true, "Nur relevante Nachrichten anzeigen"); + initBoolean("sim.periodic", false, "Simulation periodisch wiederholen"); + initBoolean("sim.update.lamporttime.all", false, "Lamportzeiten betreffen alle Ereignisse"); + initBoolean("sim.update.vectortime.all", false, "Vektorzeiten betreffen alle Ereignisse"); + } +} diff --git a/VS-Sim-Sources/sources/prefs/VSPrefs.java b/VS-Sim-Sources/sources/prefs/VSPrefs.java new file mode 100644 index 0000000..f5e68f3 --- /dev/null +++ b/VS-Sim-Sources/sources/prefs/VSPrefs.java @@ -0,0 +1,1190 @@ +/* + * Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * All icons of the icons/ folder are under a Creative Commons + * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. + * + * The icon's homepage is http://code.google.com/p/ultimate-gnome/ + */ + +package prefs; + +import java.awt.Color; +import java.io.*; +import java.util.*; + +import serialize.*; + +/** + * The class VSPrefs, this class is for dynamic data storage. It can hold + * various different types such as Boolean, Floats, Integers, Strings, Colors. + * + * @author Paul C. Buetow + */ +public class VSPrefs { + /** The Constant BOOLEAN_PREFIX. */ + public static final String BOOLEAN_PREFIX = "Boolean: "; + + /** The Constant COLOR_PREFIX. */ + public static final String COLOR_PREFIX = "Color: "; + + /** The Constant FLOAT_PREFIX. */ + public static final String FLOAT_PREFIX = "Float: "; + + /** The Constant INTEGER_PREFIX. */ + public static final String INTEGER_PREFIX = "Integer: "; + + /** The Constant VECTOR_PREFIX. */ + public static final String VECTOR_PREFIX = "Vector: "; + + /** The Constant LONG_PREFIX. */ + public static final String LONG_PREFIX = "Long: "; + + /** The Constant STRING_PREFIX. */ + public static final String STRING_PREFIX = "String: "; + + /** The color prefs. */ + private HashMap<String,Color> colorPrefs; + + /** The float prefs. */ + private HashMap<String,Float> floatPrefs; + + /** The integer prefs. */ + private HashMap<String,Integer> integerPrefs; + + /** The integer vector prefs. */ + private HashMap<String,Vector<Integer>> vectorPrefs; + + /** The long prefs. */ + private HashMap<String,Long> longPrefs; + + /** The setting restriction prefs. */ + private HashMap<String,VSPrefsRestriction> restrictions; + + /** The description prefs. */ + private HashMap<String,String> descriptionPrefs; + + /** The string prefs. */ + private HashMap<String,String> stringPrefs; + + /** The boolean prefs. */ + private HashMap<String,Boolean> booleanPrefs; + + /** The object prefs. */ + private HashMap<String,Object> objectPrefs; + + /** The units. */ + private HashMap<String,String> units; + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4L; + + /** The id counter. */ + private static int idCounter; + + /** The id. */ + protected int id; + + /** + * Instantiates a new lang.process.removeprefs. + */ + public VSPrefs() { + colorPrefs = new HashMap<String,Color>(); + descriptionPrefs = new HashMap<String,String>(); + floatPrefs = new HashMap<String,Float>(); + integerPrefs = new HashMap<String,Integer>(); + vectorPrefs = new HashMap<String,Vector<Integer>>(); + longPrefs = new HashMap<String,Long>(); + restrictions = new HashMap<String,VSPrefsRestriction>(); + stringPrefs = new HashMap<String,String>(); + booleanPrefs = new HashMap<String,Boolean>(); + objectPrefs = new HashMap<String,Object>(); + units = new HashMap<String,String>(); + id = ++idCounter; + } + + /** + * Clear. + */ + protected synchronized void clear() { + colorPrefs.clear(); + floatPrefs.clear(); + integerPrefs.clear(); + vectorPrefs.clear(); + longPrefs.clear(); + stringPrefs.clear(); + booleanPrefs.clear(); + objectPrefs.clear(); + descriptionPrefs.clear(); + restrictions.clear(); + } + + /* Unit methods */ + + /** + * Gets the unit. + * + * @param fullKey the full key + * + * @return the unit + */ + public synchronized String getUnit(String fullKey) { + return units.get(fullKey); + } + + /** + * Sets the unit. + * + * @param key the key + * @param unit the unit + */ + public synchronized void initUnit(String key, String unit) { + if (unit == null /*|| units.containsKey(key)*/) + return; + units.put(key, unit); + } + + /* Description methods */ + /** + * Sets the description if unset. + * + * @param key the key + * @param descr the descr + */ + public synchronized void initDescription(String key, String descr) { + if (descr == null /*|| descriptionPrefs.containsKey(key)*/) + return; + descriptionPrefs.put(key, descr); + } + + /** + * Gets the description. + * + * @param fullKey the full key + * + * @return the description + */ + public synchronized String getDescription(String fullKey) { + return descriptionPrefs.get(fullKey); + } + + /* Restriction methods */ + + /** + * Gets the restriction. + * + * @param fullKey the full key + * + * @return the restriction + */ + public synchronized VSPrefsRestriction getRestriction(String fullKey) { + return restrictions.get(fullKey); + } + + /** + * Sets the restriction. + * + * @param key the key + * @param settingRestriction the setting restriction + */ + public synchronized void initRestriction(String key, + VSPrefsRestriction settingRestriction) { + restrictions.put(key, settingRestriction); + } + + /* Object methods */ + + /** + * Object exists. + * + * @param key the key + * + * @return true, if successful + */ + public synchronized boolean objectExists(String key) { + return null != objectPrefs.get(key); + } + + /** + * Gets the object. + * + * @param key the key + * + * @return the object + */ + public synchronized Object getObject(String key) { + Object val = objectPrefs.get(key); + + if (val == null) { + System.err.println("Fatal: No such object config value \"" + + key + "\""); + System.exit(1); + } + + return val; + } + + /** + * Removes the object. + * + * @param key the key + */ + public synchronized void removeObject(String key) { + objectPrefs.remove(key); + } + + /** + * Sets the object. + * + * @param key the key + * @param val the val + */ + public synchronized void setObject(String key, Object val) { + objectPrefs.put(key, val); + } + + /* Boolean methods */ + + /** + * Gets the boolean. + * + * @param key the key + * + * @return the boolean + */ + public boolean getBoolean(String key) { + return getBooleanObj(key).booleanValue(); + } + + /** + * Gets the boolean key set. + * + * @return the boolean key set + */ + public synchronized Set<String> getBooleanKeySet() { + return booleanPrefs.keySet(); + } + + /** + * Gets the boolean obj. + * + * @param key the key + * + * @return the boolean obj + */ + public synchronized Boolean getBooleanObj(String key) { + Boolean val = booleanPrefs.get(key); + + if (val == null) + return new Boolean(false); + + return val; + } + + /** + * Inits the boolean. + * + * @param key the key + * @param val the val + */ + public synchronized void initBoolean(String key, Boolean val) { + if (!booleanPrefs.containsKey(key)) + booleanPrefs.put(key, val); + } + + /** + * Inits the boolean. + * + * @param key the key + * @param val the val + */ + public void initBoolean(String key, boolean val) { + initBoolean(key, new Boolean(val)); + } + + /** + * Inits the boolean. + * + * @param key the key + * @param val the val + * @param descr the descr + */ + public void initBoolean(String key, boolean val, String descr) { + initBoolean(key, val); + initDescription(BOOLEAN_PREFIX + key, descr); + } + + /** + * Sets the boolean. + * + * @param key the key + * @param val the val + */ + public synchronized void setBoolean(String key, Boolean val) { + booleanPrefs.put(key, val); + } + + /** + * Sets the boolean. + * + * @param key the key + * @param val the val + */ + public void setBoolean(String key, boolean val) { + setBoolean(key, new Boolean(val)); + } + + /* Color methods */ + + /** + * Gets the color. + * + * @param key the key + * + * @return the color + */ + public synchronized Color getColor(String key) { + Color color = colorPrefs.get(key); + + if (color == null) { + System.err.println("Fatal: No such color config value \"" + + key + "\""); + System.exit(1); + } + + return color; + } + + /** + * Gets the color key set. + * + * @return the color key set + */ + public synchronized Set<String> getColorKeySet() { + return colorPrefs.keySet(); + } + + /** + * Inits the color. + * + * @param key the key + * @param color the color + */ + public synchronized void initColor(String key, Color color) { + if (!colorPrefs.containsKey(key)) + colorPrefs.put(key, color); + } + + /** + * Inits the color. + * + * @param key the key + * @param val the val + * @param descr the descr + */ + public void initColor(String key, Color val, String descr) { + initColor(key, val); + initDescription(COLOR_PREFIX + key, descr); + } + + /** + * Sets the color. + * + * @param key the key + * @param color the color + */ + public synchronized void setColor(String key, Color color) { + colorPrefs.put(key, color); + } + + /* Float methods */ + + /** + * Gets the float. + * + * @param key the key + * + * @return the float + */ + public float getFloat(String key) { + return getFloatObj(key).floatValue(); + } + + /** + * Gets the float key set. + * + * @return the float key set + */ + public synchronized Set<String> getFloatKeySet() { + return floatPrefs.keySet(); + } + + /** + * Gets the float obj. + * + * @param key the key + * + * @return the float obj + */ + public synchronized Float getFloatObj(String key) { + Float val = floatPrefs.get(key); + + if (val == null) { + System.err.println("Fatal: No such float config value \"" + + key + "\""); + System.exit(1); + } + + return val; + } + + /** + * Inits the float. + * + * @param key the key + * @param val the val + */ + public synchronized void initFloat(String key, Float val) { + if (!floatPrefs.containsKey(key)) + floatPrefs.put(key, val); + } + + /** + * Inits the float. + * + * @param key the key + * @param val the val + */ + public void initFloat(String key, float val) { + initFloat(key, new Float(val)); + } + + /** + * Inits the float. + * + * @param key the key + * @param val the val + * @param descr the descr + */ + public void initFloat(String key, float val, String descr) { + initFloat(key, val); + initDescription(FLOAT_PREFIX + key, descr); + } + + /** + * Inits the float plus unit. + * + * @param key the key + * @param val the val + * @param descr the descr + * @param unit the unit + */ + public void initFloat(String key, float val, String descr, String unit) { + initFloat(key, val, descr); + initUnit(FLOAT_PREFIX + key, unit); + } + + /** + * Sets the float. + * + * @param key the key + * @param val the val + */ + public synchronized void setFloat(String key, Float val) { + floatPrefs.put(key, val); + } + + /** + * Sets the float. + * + * @param key the key + * @param val the val + */ + public void setFloat(String key, float val) { + setFloat(key, new Float(val)); + } + + /* Integer methods */ + + /** + * Gets the integer. + * + * @param key the key + * + * @return the integer + */ + public int getInteger(String key) { + return getIntegerObj(key).intValue(); + } + + /** + * Gets the integer key set. + * + * @return the integer key set + */ + public synchronized Set<String> getIntegerKeySet() { + return integerPrefs.keySet(); + } + + /** + * Gets the integer obj. + * + * @param key the key + * + * @return the integer obj + */ + public synchronized Integer getIntegerObj(String key) { + Integer val = integerPrefs.get(key); + + if (val == null) { + System.err.println("Fatal: No such integer config value \"" + + key + "\""); + System.exit(1); + } + + return val; + } + + /** + * Inits the integer. + * + * @param key the key + * @param val the val + */ + public void initInteger(String key, int val) { + if (!integerPrefs.containsKey(key)) + setInteger(key, new Integer(val)); + } + + /** + * Inits the integer. + * + * @param key the key + * @param val the val + * @param descr the descr + */ + public void initInteger(String key, int val, String descr) { + initInteger(key, val); + initDescription(INTEGER_PREFIX + key, descr); + } + + /** + * Inits the integer. + * + * @param key the key + * @param val the val + * @param descr the descr + * @param r the restriction + */ + public void initInteger(String key, int val, String descr, + VSPrefsRestriction.VSIntegerPrefsRestriction r) { + initInteger(key, val, descr); + initRestriction(INTEGER_PREFIX + key, r); + } + + /** + * Inits the integer. + * + * @param key the key + * @param val the val + * @param descr the descr + * @param r the restriction + */ + public void initInteger(String key, int val, String descr, + VSPrefsRestriction.VSIntegerPrefsRestriction r, + String unit) { + initInteger(key, val, descr, r); + initUnit(INTEGER_PREFIX + key, unit); + } + + /** + * Inits the integer. + * + * @param key the key + * @param val the val + * @param descr the descr + * @param minValue the min value + * @param maxValue the max value + */ + public void initInteger(String key, int val, String descr, int minValue, + int maxValue) { + initInteger(key, val, descr, + new VSPrefsRestriction.VSIntegerPrefsRestriction( + minValue, maxValue)); + } + + /** + * Inits the integer plus unit. + * + * @param key the key + * @param val the val + * @param descr the descr + * @param minValue the min value + * @param maxValue the max value + * @param unit the unit + */ + public void initInteger(String key, int val, String descr, int minValue, + int maxValue, String unit) { + initInteger(key, val, descr, minValue, maxValue); + initUnit(INTEGER_PREFIX + key, unit); + } + + /** + * Sets the integer. + * + * @param key the key + * @param val the val + */ + public synchronized void setInteger(String key, Integer val) { + integerPrefs.put(key, val); + } + + /** + * Sets the integer. + * + * @param key the key + * @param val the val + */ + public void setInteger(String key, int val) { + setInteger(key, new Integer(val)); + } + + /* Integer vector methods */ + + /** + * Gets the integer key set. + * + * @return the integer key set + */ + public synchronized Set<String> getVectorKeySet() { + return vectorPrefs.keySet(); + } + + /** + * Gets the integer obj. + * + * @param key the key + * + * @return the integer obj + */ + public synchronized Vector<Integer> getVector(String key) { + Vector<Integer> val = vectorPrefs.get(key); + + if (val == null) { + System.err.println("Fatal: No such integer config value \"" + + key + "\""); + System.exit(1); + } + + return val; + } + + /** + * Inits |
