Class OptionsHandler

java.lang.Object
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
  • Constructor Details

    • OptionsHandler

      public OptionsHandler()
  • Method Details

    • 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.
    • getTopPage

      public static OptionElement getTopPage()
      Retrieve the first loaded page.
      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(OptionContainer 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 values.
    • 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 values.
    • 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 retrieved.
      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 Frame getMainWindow()
      Get the main window of the application.
      Returns:
      a Frame instance.
    • setMainWindow

      public static void setMainWindow(Frame mainWindow)
      Set the main window of the application.
      Parameters:
      mainWindow - a Frame instance.
    • findOptionWithName

      public static OptionElement findOptionWithName(OptionElement searchRoot, String name)
      Parameters:
      searchRoot - the root option to search from.
      name - the name of the option to search.
      Returns:
      the first option found with the specified name.
    • getPluggableViewHandler

      public static PluggableViewHandler getPluggableViewHandler()
      Get the object which handles user-defined pluggable views.
      Returns:
      a PluggableViewHandler instance.
    • exportSettings

      public static void exportSettings(String path)
      Export the UI settings to an XML file.
      Parameters:
      path - the path of the XML file to save to.
    • importSettings

      public static void importSettings(String path)
      Export the UI settings to an XML file.
      Parameters:
      path - the path of the XML file to save to.