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 String
FILENAME
the filename.protected static boolean
m_Modified
whether settings are not yet saved.protected static Properties
m_Properties
the properties.protected static DelayedActionRunnable
m_SaveRunnable
for delaying the saving.protected static Thread
m_SaveThread
the threading for saving.static int
SECONDS_WAIT
the 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 String
createKey(Class cls, String property)
Assembles the key.protected static void
flagModified()
Flags as modified and queues saving.static boolean
get(Class cls, String property, boolean defValue)
Returns the Boolean value.static double
get(Class cls, String property, double defValue)
Returns the Double value.static int
get(Class cls, String property, int defValue)
Returns the Integer value.static long
get(Class cls, String property, long defValue)
Returns the Long value.static BasePassword
get(Class cls, String property, BasePassword defValue)
Returns the Password value.static DateTime
get(Class cls, String property, DateTime defValue)
Returns the DateTime value.static Time
get(Class cls, String property, Time defValue)
Returns the Time value.static Color
get(Class cls, String property, Color defValue)
Returns the Color value.static Dimension
get(Class cls, String property, Dimension defValue)
Returns the Dimension value.static String
get(Class cls, String property, String defValue)
Returns the String value.static Date
get(Class cls, String property, Date defValue)
Returns the Date value.static boolean
get(Object obj, String property, boolean defValue)
Returns the Boolean value.static double
get(Object obj, String property, double defValue)
Returns the Double value.static int
get(Object obj, String property, int defValue)
Returns the Integer value.static long
get(Object obj, String property, long defValue)
Returns the Long value.static BasePassword
get(Object obj, String property, BasePassword defValue)
Returns the Password value.static DateTime
get(Object obj, String property, DateTime defValue)
Returns the DateTime value.static Time
get(Object obj, String property, Time defValue)
Returns the Time value.static Color
get(Object obj, String property, Color defValue)
Returns the Color value.static String
get(Object obj, String property, String defValue)
Returns the String value.static Date
get(Object obj, String property, Date defValue)
Returns the Date value.protected static Properties
getProperties()
Returns the properties in use.static boolean
has(Class cls, String property)
Returns the whether the value is present.static boolean
has(Object obj, String property)
Returns the whether the value is present.protected static void
initializeProperties()
Initializes the properties if necessary.static boolean
isModified()
Returns whether the settings are currently unsaved.static void
queueSave()
Queues saving the settings afterSECONDS_WAIT
seconds.static String
save()
Stores the settings.static void
set(Class cls, String property, BasePassword value)
Sets the BasePassword value for the class.static void
set(Class cls, String property, DateTime value)
Sets the DateTime value for the class.static void
set(Class cls, String property, Time value)
Sets the Time value for the class.static void
set(Class cls, String property, Color value)
Sets the Color value for the class.static void
set(Class cls, String property, Dimension value)
Sets the Dimension value for the class.static void
set(Class cls, String property, Boolean value)
Sets the Boolean value for the class.static void
set(Class cls, String property, Double value)
Sets the Double value for the class.static void
set(Class cls, String property, Integer value)
Sets the Integer value for the class.static void
set(Class cls, String property, Long value)
Sets the Long value for the class.static void
set(Class cls, String property, Date value)
Sets the Date value for the class.static void
set(Object obj, String property, BasePassword value)
Sets the BasePassword value for the object.static void
set(Object obj, String property, DateTime value)
Sets the DateTime value for the object.static void
set(Object obj, String property, Time value)
Sets the Time value for the object.static void
set(Object obj, String property, Color value)
Sets the Color value for the object.static void
set(Object obj, String property, Dimension value)
Sets the Dimension value for the object.static void
set(Object obj, String property, Boolean value)
Sets the Boolean value for the object.static void
set(Object obj, String property, Double value)
Sets the Double value for the object.static void
set(Object obj, String property, Integer value)
Sets the Integer value for the object.static void
set(Object obj, String property, Long value)
Sets the Long value for the object.static void
set(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 the 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 the 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_WAIT
seconds.
-
save
public static String save()
Stores the settings.- Returns:
- null if successful, otherwise error message
-
-