Package adams.gui.core
Class UISettings
- java.lang.Object
-
- adams.gui.core.UISettings
-
public class UISettings extends Object
Class for keeping track of parameters for panels, like divider locations. Uses the class (or class of the object) and the property to generate a key.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe filename.protected static booleanm_Modifiedwhether settings are not yet saved.protected static Propertiesm_Propertiesthe properties.protected static DelayedActionRunnablem_SaveRunnablefor delaying the saving.protected static Threadm_SaveThreadthe threading for saving.static intSECONDS_WAITthe seconds to wait before saving the settings.
-
Constructor Summary
Constructors Constructor Description UISettings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static StringcreateKey(Class cls, String property)Assembles the key.protected static voidflagModified()Flags as modified and queues saving.static booleanget(Class cls, String property, boolean defValue)Returns the Boolean value.static doubleget(Class cls, String property, double defValue)Returns the Double value.static intget(Class cls, String property, int defValue)Returns the Integer value.static longget(Class cls, String property, long defValue)Returns the Long value.static BasePasswordget(Class cls, String property, BasePassword defValue)Returns the Password value.static DateTimeget(Class cls, String property, DateTime defValue)Returns the DateTime value.static Timeget(Class cls, String property, Time defValue)Returns the Time value.static Colorget(Class cls, String property, Color defValue)Returns the Color value.static Dimensionget(Class cls, String property, Dimension defValue)Returns the Dimension value.static Stringget(Class cls, String property, String defValue)Returns the String value.static Dateget(Class cls, String property, Date defValue)Returns the Date value.static booleanget(Object obj, String property, boolean defValue)Returns the Boolean value.static doubleget(Object obj, String property, double defValue)Returns the Double value.static intget(Object obj, String property, int defValue)Returns the Integer value.static longget(Object obj, String property, long defValue)Returns the Long value.static BasePasswordget(Object obj, String property, BasePassword defValue)Returns the Password value.static DateTimeget(Object obj, String property, DateTime defValue)Returns the DateTime value.static Timeget(Object obj, String property, Time defValue)Returns the Time value.static Colorget(Object obj, String property, Color defValue)Returns the Color value.static Stringget(Object obj, String property, String defValue)Returns the String value.static Dateget(Object obj, String property, Date defValue)Returns the Date value.protected static PropertiesgetProperties()Returns the properties in use.static booleanhas(Class cls, String property)Returns whether the value is present.static booleanhas(Object obj, String property)Returns whether the value is present.protected static voidinitializeProperties()Initializes the properties if necessary.static booleanisModified()Returns whether the settings are currently unsaved.static voidqueueSave()Queues saving the settings afterSECONDS_WAITseconds.static Stringsave()Stores the settings.static voidset(Class cls, String property, BasePassword value)Sets the BasePassword value for the class.static voidset(Class cls, String property, DateTime value)Sets the DateTime value for the class.static voidset(Class cls, String property, Time value)Sets the Time value for the class.static voidset(Class cls, String property, Color value)Sets the Color value for the class.static voidset(Class cls, String property, Dimension value)Sets the Dimension value for the class.static voidset(Class cls, String property, Boolean value)Sets the Boolean value for the class.static voidset(Class cls, String property, Double value)Sets the Double value for the class.static voidset(Class cls, String property, Integer value)Sets the Integer value for the class.static voidset(Class cls, String property, Long value)Sets the Long value for the class.static voidset(Class cls, String property, Date value)Sets the Date value for the class.static voidset(Object obj, String property, BasePassword value)Sets the BasePassword value for the object.static voidset(Object obj, String property, DateTime value)Sets the DateTime value for the object.static voidset(Object obj, String property, Time value)Sets the Time value for the object.static voidset(Object obj, String property, Color value)Sets the Color value for the object.static voidset(Object obj, String property, Dimension value)Sets the Dimension value for the object.static voidset(Object obj, String property, Boolean value)Sets the Boolean value for the object.static voidset(Object obj, String property, Double value)Sets the Double value for the object.static voidset(Object obj, String property, Integer value)Sets the Integer value for the object.static voidset(Object obj, String property, Long value)Sets the Long value for the object.static voidset(Object obj, String property, Date value)Sets the Date value for the object.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the filename.- See Also:
- Constant Field Values
-
SECONDS_WAIT
public static final int SECONDS_WAIT
the seconds to wait before saving the settings.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
m_SaveRunnable
protected static DelayedActionRunnable m_SaveRunnable
for delaying the saving.
-
m_SaveThread
protected static Thread m_SaveThread
the threading for saving.
-
m_Modified
protected static boolean m_Modified
whether settings are not yet saved.
-
-
Method Detail
-
initializeProperties
protected static void initializeProperties()
Initializes the properties if necessary.
-
getProperties
protected static Properties getProperties()
Returns the properties in use.- Returns:
- the properties
-
createKey
protected static String createKey(Class cls, String property)
Assembles the key.- Parameters:
cls- the classproperty- the property- Returns:
- the key
-
set
public static void set(Object obj, String property, Integer value)
Sets the Integer value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Integer value)
Sets the Integer value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Long value)
Sets the Long value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Long value)
Sets the Long value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Double value)
Sets the Double value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Double value)
Sets the Double value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Boolean value)
Sets the Boolean value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Boolean value)
Sets the Boolean value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Time value)
Sets the Time value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Time value)
Sets the Time value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, DateTime value)
Sets the DateTime value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, DateTime value)
Sets the DateTime value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Date value)
Sets the Date value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Date value)
Sets the Date value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Color value)
Sets the Color value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Color value)
Sets the Color value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, BasePassword value)
Sets the BasePassword value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, BasePassword value)
Sets the BasePassword value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Object obj, String property, Dimension value)
Sets the Dimension value for the object.- Parameters:
obj- the object to set the value forproperty- the property to setvalue- the value to set
-
set
public static void set(Class cls, String property, Dimension value)
Sets the Dimension value for the class.- Parameters:
cls- the class to set the value forproperty- the property to setvalue- the value to set
-
flagModified
protected static void flagModified()
Flags as modified and queues saving.
-
get
public static boolean get(Object obj, String property, boolean defValue)
Returns the Boolean value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static boolean get(Class cls, String property, boolean defValue)
Returns the Boolean value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static int get(Object obj, String property, int defValue)
Returns the Integer value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static int get(Class cls, String property, int defValue)
Returns the Integer value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static long get(Object obj, String property, long defValue)
Returns the Long value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static long get(Class cls, String property, long defValue)
Returns the Long value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static double get(Object obj, String property, double defValue)
Returns the Double value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static double get(Class cls, String property, double defValue)
Returns the Double value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Time get(Object obj, String property, Time defValue)
Returns the Time value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Time get(Class cls, String property, Time defValue)
Returns the Time value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Date get(Object obj, String property, Date defValue)
Returns the Date value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Date get(Class cls, String property, Date defValue)
Returns the Date value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static DateTime get(Object obj, String property, DateTime defValue)
Returns the DateTime value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static DateTime get(Class cls, String property, DateTime defValue)
Returns the DateTime value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Color get(Object obj, String property, Color defValue)
Returns the Color value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Color get(Class cls, String property, Color defValue)
Returns the Color value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static BasePassword get(Object obj, String property, BasePassword defValue)
Returns the Password value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static BasePassword get(Class cls, String property, BasePassword defValue)
Returns the Password value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static String get(Object obj, String property, String defValue)
Returns the String value.- Parameters:
obj- the objectproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static String get(Class cls, String property, String defValue)
Returns the String value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
get
public static Dimension get(Class cls, String property, Dimension defValue)
Returns the Dimension value.- Parameters:
cls- the classproperty- the propertydefValue- the default value- Returns:
- the stored value or the default value
-
has
public static boolean has(Object obj, String property)
Returns whether the value is present.- Parameters:
obj- the objectproperty- the property- Returns:
- true if available
-
has
public static boolean has(Class cls, String property)
Returns whether the value is present.- Parameters:
cls- the classproperty- the property- Returns:
- true if available
-
isModified
public static boolean isModified()
Returns whether the settings are currently unsaved.- Returns:
- true if not yet saved
-
queueSave
public static void queueSave()
Queues saving the settings afterSECONDS_WAITseconds.
-
save
public static String save()
Stores the settings.- Returns:
- null if successful, otherwise error message
-
-