com.partnersoft.system
Class PreferenceManager

java.lang.Object
  extended by com.partnersoft.system.PreferenceManager

public class PreferenceManager
extends java.lang.Object

Lots of convenience methods for storing and retrieving user preferences.

Author:
Paul Reavis Copyright 2004 Partner Software, Inc.

Constructor Summary
PreferenceManager()
           
 
Method Summary
 void clearPartnerPreferences()
          Blows away all com/partnersoft preferences.
 java.lang.Object deserialize(java.util.prefs.Preferences prefs)
           
 java.lang.Object deserialize(java.lang.String path)
           
 java.util.prefs.Preferences getNode(java.lang.String path)
          Deprecated.  
 java.util.prefs.Preferences getRootNode()
           
 void manage(Preferential preferential)
          Registers and manages the given Preferential.
 void manageJSplitPanePreferences(java.lang.String name, javax.swing.JSplitPane pane)
          Keeps track of the divider position in a JSplitPane.
 void manageWindowPreferences(java.lang.String name, java.awt.Window window)
          Keeps track of the configured size and location of the window, using the given name as a key.
 java.util.prefs.Preferences nodeFor(Path path)
          Returns a preference node for the given sub-path.
 java.util.prefs.Preferences nodeFor(java.lang.String path)
          Returns a preference node for the given sub-path.
 Cog retrieveCog(java.util.prefs.Preferences node)
           
 Cog retrieveCog(java.lang.String path)
           
 void serialize(java.util.prefs.Preferences prefs, java.lang.Object whatnot)
           
 void serialize(java.lang.String path, java.lang.Object whatnot)
           
static PreferenceManager singleton()
           
 void storeCog(java.util.prefs.Preferences node, Cog cog)
           
 void storeCog(java.lang.String path, Cog cog)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceManager

public PreferenceManager()
Method Detail

singleton

public static PreferenceManager singleton()

getRootNode

public java.util.prefs.Preferences getRootNode()

getNode

public java.util.prefs.Preferences getNode(java.lang.String path)
Deprecated. 

Returns a preference node for the given sub-path. Separate sub-paths with slashes (/).


nodeFor

public java.util.prefs.Preferences nodeFor(java.lang.String path)
Returns a preference node for the given sub-path. Separate sub-paths with slashes (/).


nodeFor

public java.util.prefs.Preferences nodeFor(Path path)
Returns a preference node for the given sub-path.


clearPartnerPreferences

public void clearPartnerPreferences()
Blows away all com/partnersoft preferences.


manageWindowPreferences

public void manageWindowPreferences(java.lang.String name,
                                    java.awt.Window window)
Keeps track of the configured size and location of the window, using the given name as a key. If a preference is already stored, sets up the window to match. As the window is moved and sized, stores that info for next time. Set the window for the default size before passing it in.


manageJSplitPanePreferences

public void manageJSplitPanePreferences(java.lang.String name,
                                        javax.swing.JSplitPane pane)
Keeps track of the divider position in a JSplitPane.


storeCog

public void storeCog(java.lang.String path,
                     Cog cog)

storeCog

public void storeCog(java.util.prefs.Preferences node,
                     Cog cog)

retrieveCog

public Cog retrieveCog(java.lang.String path)

retrieveCog

public Cog retrieveCog(java.util.prefs.Preferences node)

serialize

public void serialize(java.lang.String path,
                      java.lang.Object whatnot)

deserialize

public java.lang.Object deserialize(java.lang.String path)

serialize

public void serialize(java.util.prefs.Preferences prefs,
                      java.lang.Object whatnot)

deserialize

public java.lang.Object deserialize(java.util.prefs.Preferences prefs)

manage

public void manage(Preferential preferential)
Registers and manages the given Preferential. This causes the Preferential's state to be loaded from Preferences, and also causes it to be saved during the Partner system shutdown process.

Parameters:
preferential -