com.limegroup.gnutella.gui.options
Class OptionsMediator

java.lang.Object
  extended bycom.limegroup.gnutella.gui.options.OptionsMediator
All Implemented Interfaces:
ThemeObserver

public final class OptionsMediator
extends java.lang.Object
implements ThemeObserver

This class acts as a mediator for the different components of the options window. This class maintains references to the OptionsTreeManager and OptionsPaneManager, the two primary classes that it delegates to.


Field Summary
static java.lang.String ROOT_NODE_KEY
          Constant for the key for the root node in the tree.
 
Method Summary
 void applyOptions()
          Applies the current settings in the options windows, storing them to disk.
 javax.swing.ImageIcon getImage(java.lang.String imageName)
          Returns the specified image.
 javax.swing.JDialog getMainOptionsComponent()
          Returns the main JDialog instance for the options window, allowing other components to position themselves accordingly.
 boolean getSaveDirectoryChanged()
          Returns whether or not the save directory has changed since the last time settings were stored.
 java.lang.String getString(java.lang.String key)
          Returns a locale-specific String from the GUIMediator class.
 void handleSelection(java.lang.String key)
          Handles the selection of a new panel as the currently visible panel.
static OptionsMediator instance()
          Singleton accessor for this class.
 boolean isOptionsVisible()
          Returns if the Options Box is visible.
 void setOptionsVisible(boolean visible)
          Makes the options window either visible or not visible depending on the boolean argument.
 void setSaveDirectoryChanged(boolean directoryChanged)
          Sets whether or not the save directory has changed since the last time that the settings were applied.
 void updateTheme()
          Update any required theme settings, such as colors or images.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_NODE_KEY

public static final java.lang.String ROOT_NODE_KEY
Constant for the key for the root node in the tree.

See Also:
Constant Field Values
Method Detail

instance

public static OptionsMediator instance()
Singleton accessor for this class.

Returns:
the OptionsMediator instance

setOptionsVisible

public final void setOptionsVisible(boolean visible)
Makes the options window either visible or not visible depending on the boolean argument.

Parameters:
visible - boolean value specifying whether the options window should be made visible or not visible

isOptionsVisible

public final boolean isOptionsVisible()
Returns if the Options Box is visible.

Returns:
true if the Options Box is visible.

getString

public final java.lang.String getString(java.lang.String key)
Returns a locale-specific String from the GUIMediator class.

Parameters:
key - the key of the desired locale-specific String
Returns:
the locale-specific String corresponding to the key argument.

getImage

public final javax.swing.ImageIcon getImage(java.lang.String imageName)
Returns the specified image.

Parameters:
imageName - the name of the icon to return
Returns:
the ImageIcon object specified in the param string

handleSelection

public final void handleSelection(java.lang.String key)
Handles the selection of a new panel as the currently visible panel.

Parameters:
key - the unique identifying key of the panel to show

applyOptions

public final void applyOptions()
                        throws java.io.IOException
Applies the current settings in the options windows, storing them to disk. This method delegates to the OptionsPaneManager.

Throws:
java.io.IOException - if the options could not be fully applied

getSaveDirectoryChanged

public boolean getSaveDirectoryChanged()
Returns whether or not the save directory has changed since the last time settings were stored.

Returns:
true if the save directory has changed since the last time the settings were applied, false otherwise

setSaveDirectoryChanged

public void setSaveDirectoryChanged(boolean directoryChanged)
Sets whether or not the save directory has changed since the last time that the settings were applied.

Parameters:
directoryChanged - specifies whether or not the save directory has changed since the last time settings were applied

getMainOptionsComponent

public javax.swing.JDialog getMainOptionsComponent()
Returns the main JDialog instance for the options window, allowing other components to position themselves accordingly.

Returns:
the main options JDialog window

updateTheme

public void updateTheme()
Description copied from interface: ThemeObserver
Update any required theme settings, such as colors or images.

Specified by:
updateTheme in interface ThemeObserver