|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.iface.ui.JPropertiesManager
public abstract class JPropertiesManager
An abstarct class for managing the properties and preferences of an
application. Provides lots of generically useful things for
property management, including running an editor to change
properties.
Abstract methods are:
setDefaultProperties(Properties props)
makePreferencesDialog()
This used to be part of the application whose properties are to be
managed; it was moved to de-clutter the application and to make
mechanisms available to other applications.
JPropertyManagers manage Properties for PropertyApplications. If
the Properties are user editable, they work together with
PropertyEditors like the JPreferenceDialogs. Here is how these
classes split the work:
Properties hold all values under the keys. Provided by Java.
PropertyManagers look after Properties, their default values,
loading/saving properties, and initiating updates to the
application to make the properties take effect, and updates from
the application to make sure current settings are saved. The
PropertyMangers also provide links between all property-related classes.
PropertyEditors, e.g. JPreferencesDialogue, build the editor
window, let the user change property values (providing help where
available), let the user load, save, use defaults, apply, etc.
PropertyApplications get changed by the values of the properties.
{\bf How to make this work:}
Make your application implement the PropertiesApplication interface and
write the setProperty and getProperty methods; the former sets a given
property in the application which should update the application, the latter
determines the current setting of the property from the application. The
application name is used to work out what the default property file should
be (./
Field Summary
protected PropertiesApplication
application
java.util.HashSet
noEditComponents
protected JPreferencesDialog
preferencesDialog
protected java.util.Properties
properties
Constructor Summary
JPropertiesManager(PropertiesApplication application)
Method Summary
void
editPreferences()
JPreferencesDialog
ensurePreferencesDialog()
java.io.File
getDefaultPropertiesFile()
Uses the application name to build a preferences file name in the
current directory.
java.util.Properties
getProperties()
java.io.File
getPropertiesFile()
Specify the name of the properties file to use;
set to getDefaultPropertiesFile() if you don't care.
java.lang.String
getProperty(java.lang.String key)
void
initProperties()
Sets up default properties, then loads the properties from file
and passes them to the application.
static boolean
isBooleanProperty(java.lang.String key,
java.lang.String value)
boolean
isEditable(java.lang.String key)
java.util.Properties
loadProperties()
java.util.Properties
loadProperties(java.util.Properties props)
abstract JPreferencesDialog
makePreferencesDialog()
void
noteNoEditable(java.lang.String property)
If there are properties that cannot be edited here, mark them as such.
void
saveApplicationProperties()
void
saveProperties()
void
saveProperties(java.util.Properties properties)
abstract void
setDefaultProperties(java.util.Properties props)
Sets the default properties for the application into the given
properties object; application specific.
void
setProperty(java.lang.String key,
java.lang.String value)
void
updateApplicationFromProperties()
void
updateApplicationFromProperties(PropertiesApplication app)
void
updatePropertiesFromApplication()
void
updatePropertiesFromApplication(PropertiesApplication app)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
application
protected PropertiesApplication application
properties
protected java.util.Properties properties
preferencesDialog
protected JPreferencesDialog preferencesDialog
noEditComponents
public java.util.HashSet noEditComponents
Constructor Detail
JPropertiesManager
public JPropertiesManager(PropertiesApplication application)
Method Detail
setDefaultProperties
public abstract void setDefaultProperties(java.util.Properties props)
makePreferencesDialog
public abstract JPreferencesDialog makePreferencesDialog()
noteNoEditable
public void noteNoEditable(java.lang.String property)
isEditable
public boolean isEditable(java.lang.String key)
getPropertiesFile
public java.io.File getPropertiesFile()
getProperties
public java.util.Properties getProperties()
getProperty
public java.lang.String getProperty(java.lang.String key)
setProperty
public void setProperty(java.lang.String key,
java.lang.String value)
editPreferences
public void editPreferences()
ensurePreferencesDialog
public JPreferencesDialog ensurePreferencesDialog()
getDefaultPropertiesFile
public java.io.File getDefaultPropertiesFile()
initProperties
public void initProperties()
saveProperties
public void saveProperties()
saveProperties
public void saveProperties(java.util.Properties properties)
loadProperties
public java.util.Properties loadProperties()
loadProperties
public java.util.Properties loadProperties(java.util.Properties props)
saveApplicationProperties
public void saveApplicationProperties()
updateApplicationFromProperties
public void updateApplicationFromProperties()
updateApplicationFromProperties
public void updateApplicationFromProperties(PropertiesApplication app)
updatePropertiesFromApplication
public void updatePropertiesFromApplication()
updatePropertiesFromApplication
public void updatePropertiesFromApplication(PropertiesApplication app)
isBooleanProperty
public static boolean isBooleanProperty(java.lang.String key,
java.lang.String value)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD