com.borland.primetime.properties
Class GlobalProperty

java.lang.Object
  |
  +--com.borland.primetime.properties.Property
        |
        +--com.borland.primetime.properties.GlobalProperty
Direct Known Subclasses:
EditorOption, GlobalBooleanProperty, GlobalFloatProperty, GlobalIntegerProperty

public class GlobalProperty
extends Property

Instances of GlobalProperty are used to represent global settings under the user's control. Property values are represented as strings and stored in a "user.properties" file.


Field Summary
protected  java.lang.String defaultValue
           
 
Fields inherited from class com.borland.primetime.properties.Property
category, name
 
Constructor Summary
GlobalProperty(java.lang.String category, java.lang.String name)
          Create a new GlobalProperty with the specified category and property name.
GlobalProperty(java.lang.String category, java.lang.String name, java.lang.String defaultValue)
          Create a new GlobalProperty with the specified category, property name and default value.
 
Method Summary
 void addPropertyListener(GlobalPropertyListener listener)
          Adds a GlobalPropertyListener to the list of listeners that receive events.
 void firePropertyChange(java.lang.String oldValue, java.lang.String newValue)
          Notifies all registered GlobalPropertyListeners that the value of the property has been changed.
 java.lang.String getValue()
           
static long getVersion()
           
static void readProperties()
          Reads the state of all GlobalProperty settings defined by the file "user.preferences" in the property settings directory.
static void readProperties(java.io.InputStream input)
          Reads the state of all GlobalProperty settings from the stream provided.
 void removePropertyListener(GlobalPropertyListener listener)
          Removes a GlobalPropertyListener from the list of listeners that receive events.
 boolean setValue(java.lang.String value)
           
static void writeProperties()
          Writes the state of all non-default GlobalProperty settings to the file "user.preferences" in the property settings directory.
static void writeProperties(java.io.OutputStream output)
          Writes the current state of all non-default GlobalProperty settings to the stream provided.
 
Methods inherited from class com.borland.primetime.properties.Property
compareTo, equals, getPropertyCategory, getPropertyName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultValue

protected java.lang.String defaultValue
Constructor Detail

GlobalProperty

public GlobalProperty(java.lang.String category,
                      java.lang.String name)
Create a new GlobalProperty with the specified category and property name. Assumes the property's default value is null.

GlobalProperty

public GlobalProperty(java.lang.String category,
                      java.lang.String name,
                      java.lang.String defaultValue)
Create a new GlobalProperty with the specified category, property name and default value.
Method Detail

setValue

public boolean setValue(java.lang.String value)
Parameters:
value - The desired parameter value, or null if the value should be reset to its default.

getValue

public java.lang.String getValue()
Returns:
The stored parameter value, or the GlobalProperty's default value if no value has been stored.

addPropertyListener

public void addPropertyListener(GlobalPropertyListener listener)
Adds a GlobalPropertyListener to the list of listeners that receive events.
Parameters:
listener - The listener.

removePropertyListener

public void removePropertyListener(GlobalPropertyListener listener)
Removes a GlobalPropertyListener from the list of listeners that receive events.
Parameters:
listener - The listener.

firePropertyChange

public void firePropertyChange(java.lang.String oldValue,
                               java.lang.String newValue)
Notifies all registered GlobalPropertyListeners that the value of the property has been changed.

getVersion

public static long getVersion()
Returns:
A running total of the number of times a GlobalProperty value has been altered.

readProperties

public static void readProperties()
Reads the state of all GlobalProperty settings defined by the file "user.preferences" in the property settings directory.

Note that while this process discards all existing GlobalProperty values and reads a new set of value, it does not fire change events. Typically this occurs only once during the initialization of the property system, and all registered PropertyGroup instances are notified via the PropertyGroup method initializeProperties.


writeProperties

public static void writeProperties()
Writes the state of all non-default GlobalProperty settings to the file "user.preferences" in the property settings directory.

readProperties

public static void readProperties(java.io.InputStream input)
Reads the state of all GlobalProperty settings from the stream provided.

Note that while this process discards all existing GlobalProperty values and reads a new set of value, it does not fire change events. Typically this occurs only once during the initialization of the property system, and all registered PropertyGroup instances are notified via the PropertyGroup method initializeProperties.

Parameters:
input - An open InputStream.

writeProperties

public static void writeProperties(java.io.OutputStream output)
Writes the current state of all non-default GlobalProperty settings to the stream provided.
Parameters:
output - An open OutputStream.