Package adams.gui.core
Class GUIPrompt
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.gui.core.GUIPrompt
-
- All Implemented Interfaces:
LoggingSupporter,SizeOfHandler,Serializable
public class GUIPrompt extends LoggingObject
Helper class for GUI prompts that require updating values, e.g., only displaying a warning dialog once.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe name of the props file.protected Propertiesm_Propertiesthe properties.protected static GUIPromptm_Singletonthe singleton.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGUIPrompt()Initializes the class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(String key, boolean defValue)Returns the stored value or, if not present, the default value.DoublegetDouble(String key, Double defValue)Returns the stored value or, if not present, the default value.IntegergetInteger(String key, Integer defValue)Returns the stored value or, if not present, the default value.static GUIPromptgetSingleton()Returns the singleton instance.protected voidinitialize()Loads the properties.voidsetBoolean(String key, boolean value)Sets the boolean value and stores the properties.voidsetDouble(String key, Double value)Sets the Double value and stores the properties.voidsetInteger(String key, Integer value)Sets the Integer value and stores the properties.protected voidupdate()Stores the properties on disk.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
m_Properties
protected Properties m_Properties
the properties.
-
m_Singleton
protected static GUIPrompt m_Singleton
the singleton.
-
-
Method Detail
-
initialize
protected void initialize()
Loads the properties.
-
update
protected void update()
Stores the properties on disk.
-
getBoolean
public boolean getBoolean(String key, boolean defValue)
Returns the stored value or, if not present, the default value.- Parameters:
key- the property key to read the boolean fromdefValue- the default value to use if absent- Returns:
- the stored value or the default value (if absent)
-
setBoolean
public void setBoolean(String key, boolean value)
Sets the boolean value and stores the properties.- Parameters:
key- the property to store the value undervalue- the value to store
-
getInteger
public Integer getInteger(String key, Integer defValue)
Returns the stored value or, if not present, the default value.- Parameters:
key- the property key to read the Integer fromdefValue- the default value to use if absent- Returns:
- the stored value or the default value (if absent)
-
setInteger
public void setInteger(String key, Integer value)
Sets the Integer value and stores the properties.- Parameters:
key- the property to store the value undervalue- the value to store
-
getDouble
public Double getDouble(String key, Double defValue)
Returns the stored value or, if not present, the default value.- Parameters:
key- the property key to read the Double fromdefValue- the default value to use if absent- Returns:
- the stored value or the default value (if absent)
-
setDouble
public void setDouble(String key, Double value)
Sets the Double value and stores the properties.- Parameters:
key- the property to store the value undervalue- the value to store
-
getSingleton
public static GUIPrompt getSingleton()
Returns the singleton instance.- Returns:
- the instance
-
-