org.jppf.ui.options.factory
Class OptionsHandler

java.lang.Object
  extended by org.jppf.ui.options.factory.OptionsHandler

public final class OptionsHandler
extends Object

This class handles the persistence of the dynamic UI com

Author:
Laurent Cohen

Nested Class Summary
static class OptionsHandler.OptionNode
          A graph of the persistent options.
 
Constructor Summary
OptionsHandler()
           
 
Method Summary
static OptionElement addPage(OptionElement page)
          Add a page to the list of pages managed by this handler.
static OptionElement addPageFromURL(String xmlPath, String baseName)
          Add a page built from an xml document.
static OptionElement addPageFromXml(String xmlPath)
          Add a page built from an xml document.
static OptionsHandler.OptionNode buildPersistenceGraph(OptionElement elt)
          Build a graph of the persistent elements.
static OptionsPageBuilder getBuilder()
          Get the page builder used to instantiate pages from XML descriptors.
static JFrame getMainWindow()
          Get the main window of the application.
static OptionElement getPage(String name)
          Retrieve a page from its name.
static List<OptionElement> getPageList()
          Get the list of option pages managed by this handler.
static Preferences getPreferences()
          Get the root of the preferences subtree in which the chart configurations are saved.
static void loadFrameAttributes(Frame frame, Preferences pref)
          Load the specified frame state from the preferences store.
static void loadMainWindowAttributes(Preferences pref)
          Load the application's main window state from the preferences store.
static OptionElement loadPageFromURL(String xmlPath, String baseName)
          Load a page built from an xml document.
static OptionElement loadPageFromXml(String xmlPath)
          Load a page built from an xml document.
static void loadPreferences()
          Load the value of all persistent options in the preferences store.
static void loadPreferences(OptionsHandler.OptionNode node, Preferences prefs)
          Save the value of all persistent options in the preferences store.
static void removePage(OptionsPage page)
          Remove a page from the list of pages managed by this handler.
static void saveFrameAttributes(Frame frame, Preferences pref)
          Save the specified frame state to the preferences store.
static void saveMainWindowAttributes(Preferences pref)
          Save the application's main window state to the preferences store.
static void savePreferences()
          Save the value of all persistent options in the preferences store.
static void savePreferences(OptionsHandler.OptionNode node, Preferences prefs)
          Save the value of all persistent options in the preferences store.
static void setMainWindow(JFrame mainWindow)
          Set the main window of the application.
static void setPreferences(Preferences preferences)
          Set the root of the preferences subtree in which the chart configurations are saved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionsHandler

public OptionsHandler()
Method Detail

getPageList

public static List<OptionElement> getPageList()
Get the list of option pages managed by this handler.

Returns:
a list of OptionsPage instances.

getPage

public static OptionElement getPage(String name)
Retrieve a page from its name.

Parameters:
name - the name of the page to retrieve.
Returns:
an OptionsPage instance.

addPage

public static OptionElement addPage(OptionElement page)
Add a page to the list of pages managed by this handler.

Parameters:
page - an OptionsPage instance.
Returns:
the page that was added.

removePage

public static void removePage(OptionsPage page)
Remove a page from the list of pages managed by this handler.

Parameters:
page - an OptionsPage instance.

loadPageFromXml

public static OptionElement loadPageFromXml(String xmlPath)
Load a page built from an xml document.

Parameters:
xmlPath - the path to the xml document.
Returns:
the page that was added.

addPageFromXml

public static OptionElement addPageFromXml(String xmlPath)
Add a page built from an xml document.

Parameters:
xmlPath - the path to the xml document.
Returns:
the page that was added.

loadPageFromURL

public static OptionElement loadPageFromURL(String xmlPath,
                                            String baseName)
Load a page built from an xml document.

Parameters:
xmlPath - the path to the xml document.
baseName - base name for resource bundle lookup.
Returns:
the page that was added.

addPageFromURL

public static OptionElement addPageFromURL(String xmlPath,
                                           String baseName)
Add a page built from an xml document.

Parameters:
xmlPath - the path to the xml document.
baseName - base name for resource bundle lookup.
Returns:
the page that was added.

savePreferences

public static void savePreferences()
Save the value of all persistent options in the preferences store.


savePreferences

public static void savePreferences(OptionsHandler.OptionNode node,
                                   Preferences prefs)
Save the value of all persistent options in the preferences store.

Parameters:
node - the root of the options subtree to save.
prefs - the preferences node in which to save the vaues.

loadPreferences

public static void loadPreferences()
Load the value of all persistent options in the preferences store.


loadPreferences

public static void loadPreferences(OptionsHandler.OptionNode node,
                                   Preferences prefs)
Save the value of all persistent options in the preferences store.

Parameters:
node - the root of the options subtree to save.
prefs - the preferences node in which to save the vaues.

getBuilder

public static OptionsPageBuilder getBuilder()
Get the page builder used to instantiate pages from XML descriptors.

Returns:
an OptionsPageBuilder instance.

buildPersistenceGraph

public static OptionsHandler.OptionNode buildPersistenceGraph(OptionElement elt)
Build a graph of the persistent elements.

Parameters:
elt - the root of the current subgraph.
Returns:
an OptionNode instance.

getPreferences

public static Preferences getPreferences()
Get the root of the preferences subtree in which the chart configurations are saved.

Returns:
a Preferences instance.

setPreferences

public static void setPreferences(Preferences preferences)
Set the root of the preferences subtree in which the chart configurations are saved.

Parameters:
preferences - a Preferences instance.

loadMainWindowAttributes

public static void loadMainWindowAttributes(Preferences pref)
Load the application's main window state from the preferences store.

Parameters:
pref - the preferences node from where the attributes are loaded.

saveMainWindowAttributes

public static void saveMainWindowAttributes(Preferences pref)
Save the application's main window state to the preferences store.

Parameters:
pref - the preferences node where the attributes are saved.

loadFrameAttributes

public static void loadFrameAttributes(Frame frame,
                                       Preferences pref)
Load the specified frame state from the preferences store.

Parameters:
frame - the frame for which the attributes are retieved.
pref - the preferences node from where the attributes are loaded.

saveFrameAttributes

public static void saveFrameAttributes(Frame frame,
                                       Preferences pref)
Save the specified frame state to the preferences store.

Parameters:
frame - the frame for which the attributes are saved.
pref - the preferences node where the attributes are saved.

getMainWindow

public static JFrame getMainWindow()
Get the main window of the application.

Returns:
a JFrame instance.

setMainWindow

public static void setMainWindow(JFrame mainWindow)
Set the main window of the application.

Parameters:
mainWindow - a JFrame instance.


Copyright © 2005-2010 JPPF Team.