|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectix.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 |
---|
protected PropertiesApplication application
protected java.util.Properties properties
protected JPreferencesDialog preferencesDialog
public java.util.HashSet noEditComponents
Constructor Detail |
---|
public JPropertiesManager(PropertiesApplication application)
Method Detail |
---|
public abstract void setDefaultProperties(java.util.Properties props)
public abstract JPreferencesDialog makePreferencesDialog()
public void noteNoEditable(java.lang.String property)
public boolean isEditable(java.lang.String key)
public java.io.File getPropertiesFile()
public java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String key)
public void setProperty(java.lang.String key, java.lang.String value)
public void editPreferences()
public JPreferencesDialog ensurePreferencesDialog()
public java.io.File getDefaultPropertiesFile()
public void initProperties()
public void saveProperties()
public void saveProperties(java.util.Properties properties)
public java.util.Properties loadProperties()
public java.util.Properties loadProperties(java.util.Properties props)
public void saveApplicationProperties()
public void updateApplicationFromProperties()
public void updateApplicationFromProperties(PropertiesApplication app)
public void updatePropertiesFromApplication()
public void updatePropertiesFromApplication(PropertiesApplication app)
public static boolean isBooleanProperty(java.lang.String key, java.lang.String value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |