com.alee.managers.settings
Class ComponentSettingsManager

java.lang.Object
  extended by com.alee.managers.settings.ComponentSettingsManager

public final class ComponentSettingsManager
extends java.lang.Object

This SettingsManager sub-manager registers and processes component settings auto-save/restore them on any changes within or outside of that component.

This manager should never be called directly (except the case when you register new SettingsProcessor or if you know what you are doing) to avoid any unexpected component behavior.

Author:
Mikle Garin
See Also:
How to use SettingsManager, SettingsManager, SettingsManager

Constructor Summary
ComponentSettingsManager()
           
 
Method Summary
static void initializeManager()
          Initializes ComponentSettingsManager.
static boolean isComponentSupported(java.lang.Class componentType)
          Returns whether the specified component is supported or not.
static boolean isComponentSupported(java.awt.Component component)
          Returns whether the specified component is supported or not.
static boolean isThrowExceptions()
          Returns whether exceptions are thrown on inappropriate actions or not.
static void loadSettings(java.awt.Component component)
          Loads saved settings into the component if it is registered.
static void registerComponent(java.awt.Component component, SettingsProcessor settingsProcessor)
          Registers component using the specified SettingsProcessor.
static void registerComponent(SettingsProcessorData data)
          Registers component using the specified SettingsProcessorData.
static
<T extends SettingsProcessor>
void
registerSettingsProcessor(java.lang.Class componentType, java.lang.Class<T> settingsProcessor)
          Registers specified settings processor class for the specified component type.
static void saveSettings()
          Saves all registered components settings.
static void saveSettings(java.awt.Component component)
          Saves component settings.
static void setThrowExceptions(boolean throwExceptions)
          Sets whether throw exceptions on inappropriate actions or not.
static void unregisterComponent(java.awt.Component component)
          Unregisters component from settings auto-save.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentSettingsManager

public ComponentSettingsManager()
Method Detail

initializeManager

public static void initializeManager()
Initializes ComponentSettingsManager.


isThrowExceptions

public static boolean isThrowExceptions()
Returns whether exceptions are thrown on inappropriate actions or not.

Returns:
true if exceptions are thrown on inappropriate actions, false otherwise

setThrowExceptions

public static void setThrowExceptions(boolean throwExceptions)
Sets whether throw exceptions on inappropriate actions or not.

Parameters:
throwExceptions - whether throw exceptions on inappropriate actions or not

isComponentSupported

public static boolean isComponentSupported(java.awt.Component component)
Returns whether the specified component is supported or not.

Parameters:
component - component
Returns:
true if the specified component is supported, false otherwise

isComponentSupported

public static boolean isComponentSupported(java.lang.Class componentType)
Returns whether the specified component is supported or not.

Parameters:
componentType - component type
Returns:
true if the specified component is supported, false otherwise

registerSettingsProcessor

public static <T extends SettingsProcessor> void registerSettingsProcessor(java.lang.Class componentType,
                                                                           java.lang.Class<T> settingsProcessor)
Registers specified settings processor class for the specified component type.

Type Parameters:
T - settings processor type
Parameters:
componentType - component type
settingsProcessor - settings processor class

registerComponent

public static void registerComponent(SettingsProcessorData data)
Registers component using the specified SettingsProcessorData. Any old SettingsProcessor for that component will be unregistered if operation is successful.

Parameters:
data - SettingsProcessorData

registerComponent

public static void registerComponent(java.awt.Component component,
                                     SettingsProcessor settingsProcessor)
Registers component using the specified SettingsProcessor. Any old SettingsProcessor for that component will be unregistered if operation is successful.

Parameters:
component - component to register
settingsProcessor - component settings processor

loadSettings

public static void loadSettings(java.awt.Component component)
Loads saved settings into the component if it is registered.

Parameters:
component - component registered for settings auto-save

saveSettings

public static void saveSettings()
Saves all registered components settings.


saveSettings

public static void saveSettings(java.awt.Component component)
Saves component settings.

Parameters:
component - component registered for settings auto-save

unregisterComponent

public static void unregisterComponent(java.awt.Component component)
Unregisters component from settings auto-save.

Parameters:
component - component to unregister