org.noos.xing.mydoggy.plaf.ui.look
Class MyDoggyResourceManager

java.lang.Object
  extended by org.noos.xing.mydoggy.plaf.PropertyChangeEventSource
      extended by org.noos.xing.mydoggy.plaf.ui.look.MyDoggyResourceManager
All Implemented Interfaces:
org.noos.xing.mydoggy.Observable, Cleaner, ResourceManager

public class MyDoggyResourceManager
extends PropertyChangeEventSource
implements ResourceManager

Author:
Angelo De Caro (angelo.decaro@gmail.com)

Nested Class Summary
static class MyDoggyResourceManager.ParentOfQuestionInstanceCreator
           
 
Nested classes/interfaces inherited from class org.noos.xing.mydoggy.plaf.PropertyChangeEventSource
PropertyChangeEventSource.ExcludePropertyChangeListener
 
Field Summary
protected  String bundlePath
           
protected  ClassLoader classLoader
           
protected  Map<String,ObjectCreator<Component>> cmpCreators
           
protected  Map<String,ObjectCustomizer<Component>> cmpCustomizers
           
protected  Map<String,ObjectCreator<ComponentUI>> cmpUiCreators
           
protected  Map<Class,ObjectCreator> instanceCreators
           
protected  ResourceBundle resourceBundle
           
protected  Properties resources
           
protected  TransparencyManager<Window> transparencyManager
           
protected  ResourceBundle userResourceBundle
           
 
Fields inherited from class org.noos.xing.mydoggy.plaf.PropertyChangeEventSource
firePublicEventQuestion, plafChangeSupport, publicChangeSupport, publicEvent
 
Constructor Summary
MyDoggyResourceManager()
           
 
Method Summary
<T extends Component>
T
applyCustomization(String key, T component, Context context)
          Apply the customization using the rule specified by the key param.
<T extends Component>
T
createComponent(String key, Context context)
          Create the component using the rule specified by the key param.
 ComponentUI createComponentUI(String key, Context context)
          Create the component ui using the rule specified by the key param.
<T> T
createInstance(Class<T> clazz, Context context)
          Returns an instance of class clazz using passed args.
 boolean getBoolean(String name, boolean defaultValue)
          Searches for the property with the specified name in the property list.
 Color getColor(String id)
          Returns the color to which this manager maps the specified id.
 List<String> getColors()
          Returns the map that contains all colors definition.
 float getFloat(String name, float defaultValue)
          Searches for the property with the specified name in the property list.
 Icon getIcon(String id)
          Returns the icon to which this manager maps the specified id.
 List<String> getIcons()
          Returns the map that contains all icons definition.
 BufferedImage getImage(String id)
          Returns the buffered image to which this manager maps the specified id.
 int getInt(String name, int defaultValue)
          Searches for the property with the specified name in the property list.
<T> T
getObject(Class<T> clazz, T defaultValue)
          Searches for the object with the specified class in the property list.
 String getProperty(String name)
          Searches for the property with the specified name in the property list.
 ResourceBundle getResourceBundle()
          Returns the resource bundle used for the internationalization of mydoggy.
 String getString(String key)
          This method is equivalent to getResourceBundle().getString(key)
 TransparencyManager<Window> getTransparencyManager()
          Returns the transparency manager for the windows used to manage transparency of toolwindows of FLOATING or FLOATING_FREE type.
protected  URL getUrl(String url)
           
 ResourceBundle getUserResourceBundle()
          Returns the resource bundle used for the internationalization of special strings like the the toolwindow id.
 String getUserString(String key)
          This method is equivalent to getUserResourceBundle().getString(key)
protected  void initComponentCreators()
           
protected  void initTransparencyManager()
           
protected  boolean isAlreadyLoaded()
           
protected  void loadBoolean(String name, String value)
           
protected  void loadColor(String name, String colorDef)
           
protected  void loadFloat(String name, String value)
           
protected  void loadIcon(String name, String url)
           
protected  void loadImage(String name, String url)
           
protected  void loadInt(String name, String value)
           
protected  void loadObjects()
           
protected  void loadResource(String prefix, String name, String value)
           
protected  ResourceBundle loadResourceBundle(Locale locale, String bundle)
           
protected  ResourceBundle loadResourceBundle(Locale locale, String bundle, ClassLoader classLoader)
           
protected  void loadResourceBundles(String bundlePath)
           
protected  void loadResources()
           
protected  void loadString(String name, String value)
           
 void putBoolean(String name, boolean value)
          Associates a string representing the specified boolean value with the specified name.
 Color putColor(String id, Color color)
          Associates the specified color with the specified id.
 void putComponentCreator(String key, ObjectCreator<Component> componentCreator)
           
 void putComponentCustomizer(String key, ObjectCustomizer<Component> componentCustomizer)
           
 void putComponentUICreator(String key, ObjectCreator<ComponentUI> componentUICreator)
           
 void putFloat(String name, float value)
          Associates a string representing the specified float value with the specified name.
 Icon putIcon(String id, Icon icon)
          Associates the specified icon with the specified id.
 void putImage(String name, BufferedImage bufferedImage)
           
 void putInstanceCreator(Class aClass, ObjectCreator instanceCreator)
           
 void putInt(String name, int value)
          Associates a string representing the specified int value with the specified name.
 void putObject(Object key, Object value)
          Associates the specified value with the specified key.
 void putProperty(String name, String value)
          Associates the specified value with the specified property name.
 void setClassloader(ClassLoader classLoader)
           
 void setLocale(Locale locale)
          Sets the locale of this manager used for the internationalization of the relative toolwindow manager.
 void setTransparencyManager(TransparencyManager<Window> transparencyManager)
          Sets the transparency manager for the windows used to manage transparency of toolwindows of FLOATING or FLOATING_FREE type.
 void setUserBundle(Locale locale, String bundle, ClassLoader classLoader)
          Sets the bundle used for the internationalization of special strings like the the toolwindow id.
 void setUserBundle(ResourceBundle userBundle)
          Sets the bundle used for the internationalization of special strings like the the toolwindow id.
 
Methods inherited from class org.noos.xing.mydoggy.plaf.PropertyChangeEventSource
addPlafPropertyChangeListener, addPlafPropertyChangeListener, addPlafPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, cleanup, firePlafPropertyChangeEvent, firePlafPropertyChangeEvent, firePropertyChangeEvent, firePropertyChangeEvent, firePropertyChangeEvent, firePropertyChangeEvent, firePropertyChangeEventPublicListenerOnly, getPlafPropertyChangeListeners, getPlafPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListeners, initPropertyChangeSupport, removePlafPropertyChangeListener, removePlafPropertyChangeListener, removePlafPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.noos.xing.mydoggy.Observable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

classLoader

protected ClassLoader classLoader

resources

protected Properties resources

cmpCreators

protected Map<String,ObjectCreator<Component>> cmpCreators

cmpUiCreators

protected Map<String,ObjectCreator<ComponentUI>> cmpUiCreators

cmpCustomizers

protected Map<String,ObjectCustomizer<Component>> cmpCustomizers

instanceCreators

protected Map<Class,ObjectCreator> instanceCreators

bundlePath

protected String bundlePath

resourceBundle

protected ResourceBundle resourceBundle

userResourceBundle

protected ResourceBundle userResourceBundle

transparencyManager

protected TransparencyManager<Window> transparencyManager
Constructor Detail

MyDoggyResourceManager

public MyDoggyResourceManager()
Method Detail

setClassloader

public void setClassloader(ClassLoader classLoader)
Specified by:
setClassloader in interface ResourceManager

createInstance

public <T> T createInstance(Class<T> clazz,
                            Context context)
Description copied from interface: ResourceManager
Returns an instance of class clazz using passed args.

Specified by:
createInstance in interface ResourceManager
Parameters:
clazz - the class of the instance to be returned.
context - a context where retrieve arguments.
Returns:
an instance of class clazz using passed args.

createComponent

public <T extends Component> T createComponent(String key,
                                               Context context)
Description copied from interface: ResourceManager
Create the component using the rule specified by the key param.

Specified by:
createComponent in interface ResourceManager
Parameters:
key - key whose associated rule is used to create the component.
context - a context where retrieve arguments.
Returns:
the component created using the rule specified by the key param.

createComponentUI

public ComponentUI createComponentUI(String key,
                                     Context context)
Description copied from interface: ResourceManager
Create the component ui using the rule specified by the key param.

Specified by:
createComponentUI in interface ResourceManager
Parameters:
key - key whose associated rule is used to create the component.
context - a context where retrieve arguments.
Returns:
the component ui created using the rule specified by the key param.

applyCustomization

public <T extends Component> T applyCustomization(String key,
                                                  T component,
                                                  Context context)
Description copied from interface: ResourceManager
Apply the customization using the rule specified by the key param.

Specified by:
applyCustomization in interface ResourceManager
Parameters:
key - key whose associated rule is used to customize the component.
component - the component to be customized.
context - a context where retrieve arguments.
Returns:
the component customized.

getIcon

public Icon getIcon(String id)
Description copied from interface: ResourceManager
Returns the icon to which this manager maps the specified id. Returns null if the manager contains no mapping for this id.

Specified by:
getIcon in interface ResourceManager
Parameters:
id - id whose associated icon is to be returned.
Returns:
the icon to which this manager maps the specified id, or null if the manager contains no mapping for this id.

putIcon

public Icon putIcon(String id,
                    Icon icon)
Description copied from interface: ResourceManager
Associates the specified icon with the specified id. If the manager previously contained a mapping for this id, the old icon is replaced by the specified icon.

Specified by:
putIcon in interface ResourceManager
Parameters:
id - id with which the specified icon is to be associated.
icon - icon to be associated with the specified id.
Returns:
previous icon associated with specified id, or null if there was no mapping for id.

getColor

public Color getColor(String id)
Description copied from interface: ResourceManager
Returns the color to which this manager maps the specified id. Returns null if the manager contains no mapping for this id.

Specified by:
getColor in interface ResourceManager
Parameters:
id - id whose associated color is to be returned.
Returns:
the color to which this manager maps the specified id, or null if the manager contains no mapping for this id.

putColor

public Color putColor(String id,
                      Color color)
Description copied from interface: ResourceManager
Associates the specified color with the specified id. If the manager previously contained a mapping for this id, the old color is replaced by the specified color.

Specified by:
putColor in interface ResourceManager
Parameters:
id - id with which the specified color is to be associated.
color - color to be associated with the specified id.
Returns:
previous color associated with specified id, or null if there was no mapping for id.

putImage

public void putImage(String name,
                     BufferedImage bufferedImage)

getImage

public BufferedImage getImage(String id)
Description copied from interface: ResourceManager
Returns the buffered image to which this manager maps the specified id. Returns null if the manager contains no mapping for this id.

Specified by:
getImage in interface ResourceManager
Parameters:
id - id whose associated buffered image is to be returned.
Returns:
the buffered image to which this manager maps the specified id, or null if the manager contains no mapping for this id.

getTransparencyManager

public TransparencyManager<Window> getTransparencyManager()
Description copied from interface: ResourceManager
Returns the transparency manager for the windows used to manage transparency of toolwindows of FLOATING or FLOATING_FREE type.

Specified by:
getTransparencyManager in interface ResourceManager
Returns:
the transparency manager for the windows.

setTransparencyManager

public void setTransparencyManager(TransparencyManager<Window> transparencyManager)
Description copied from interface: ResourceManager
Sets the transparency manager for the windows used to manage transparency of toolwindows of FLOATING or FLOATING_FREE type.

Specified by:
setTransparencyManager in interface ResourceManager
Parameters:
transparencyManager - the transparency manager for the windows.

setLocale

public void setLocale(Locale locale)
Description copied from interface: ResourceManager
Sets the locale of this manager used for the internationalization of the relative toolwindow manager.

Specified by:
setLocale in interface ResourceManager
Parameters:
locale - the locale to become this manager's locale

setUserBundle

public void setUserBundle(Locale locale,
                          String bundle,
                          ClassLoader classLoader)
Description copied from interface: ResourceManager
Sets the bundle used for the internationalization of special strings like the the toolwindow id.

Specified by:
setUserBundle in interface ResourceManager
Parameters:
locale - the locale for which a resource bundle is desired
bundle - the base name of the resource bundle, a fully qualified class name
classLoader - the class loader from which to load the resource bundle
See Also:
ResourceManager.getUserResourceBundle()

setUserBundle

public void setUserBundle(ResourceBundle userBundle)
Description copied from interface: ResourceManager
Sets the bundle used for the internationalization of special strings like the the toolwindow id.

Specified by:
setUserBundle in interface ResourceManager
Parameters:
userBundle - the ResourceBundle

getResourceBundle

public ResourceBundle getResourceBundle()
Description copied from interface: ResourceManager
Returns the resource bundle used for the internationalization of mydoggy.

Specified by:
getResourceBundle in interface ResourceManager
Returns:
the resource bundle used for the internationalization of mydoggy.

getUserResourceBundle

public ResourceBundle getUserResourceBundle()
Description copied from interface: ResourceManager
Returns the resource bundle used for the internationalization of special strings like the the toolwindow id.

Specified by:
getUserResourceBundle in interface ResourceManager
Returns:
the resource bundle used for the internationalization of special strings like the the toolwindow id.

getString

public String getString(String key)
Description copied from interface: ResourceManager
This method is equivalent to getResourceBundle().getString(key)

Specified by:
getString in interface ResourceManager
Parameters:
key - the key for the desired string
Returns:
the string for the given key

getUserString

public String getUserString(String key)
Description copied from interface: ResourceManager
This method is equivalent to getUserResourceBundle().getString(key)

Specified by:
getUserString in interface ResourceManager
Parameters:
key - the key for the desired string
Returns:
the string for the given key

getColors

public List<String> getColors()
Description copied from interface: ResourceManager
Returns the map that contains all colors definition.

Specified by:
getColors in interface ResourceManager
Returns:
the map that contains all colors definition.

getIcons

public List<String> getIcons()
Description copied from interface: ResourceManager
Returns the map that contains all icons definition.

Specified by:
getIcons in interface ResourceManager
Returns:
the map that contains all icons definition.

getProperty

public String getProperty(String name)
Description copied from interface: ResourceManager
Searches for the property with the specified name in the property list. The method returns null if the property is not found.

Specified by:
getProperty in interface ResourceManager
Parameters:
name - the property bame.
Returns:
the value in this property list with the specified key value.

putProperty

public void putProperty(String name,
                        String value)
Description copied from interface: ResourceManager
Associates the specified value with the specified property name.

Specified by:
putProperty in interface ResourceManager
Parameters:
name - property name with which the specified value is to be associated.
value - value to be associated with the specified name.

getBoolean

public boolean getBoolean(String name,
                          boolean defaultValue)
Description copied from interface: ResourceManager
Searches for the property with the specified name in the property list. The method returns defaultValue if the property is not found.

Specified by:
getBoolean in interface ResourceManager
Parameters:
name - the property name.
defaultValue - the default value if the property is not found.
Returns:
the value in this property list with the specified key value.

putBoolean

public void putBoolean(String name,
                       boolean value)
Description copied from interface: ResourceManager
Associates a string representing the specified boolean value with the specified name. The associated string is the one that would be returned if the boolean value were passed to Boolean.toString(boolean).

Specified by:
putBoolean in interface ResourceManager
Parameters:
name - name with which the string form of value is to be associated.
value - value whose string form is to be associated with key.
See Also:
ResourceManager.getBoolean(String, boolean)

getFloat

public float getFloat(String name,
                      float defaultValue)
Description copied from interface: ResourceManager
Searches for the property with the specified name in the property list. The method returns defaultValue if the property is not found.

Specified by:
getFloat in interface ResourceManager
Parameters:
name - the property name.
defaultValue - the default value if the property is not found.
Returns:
the value in this property list with the specified key value.

putFloat

public void putFloat(String name,
                     float value)
Description copied from interface: ResourceManager
Associates a string representing the specified float value with the specified name. The associated string is the one that would be returned if the float value were passed to Float.toString(float).

Specified by:
putFloat in interface ResourceManager
Parameters:
name - name with which the string form of value is to be associated.
value - value whose string form is to be associated with key.
See Also:
ResourceManager.getFloat(String, float)

getInt

public int getInt(String name,
                  int defaultValue)
Description copied from interface: ResourceManager
Searches for the property with the specified name in the property list. The method returns defaultValue if the property is not found.

Specified by:
getInt in interface ResourceManager
Parameters:
name - the property name.
defaultValue - the default value if the property is not found.
Returns:
the value in this property list with the specified key value.

putInt

public void putInt(String name,
                   int value)
Description copied from interface: ResourceManager
Associates a string representing the specified int value with the specified name. The associated string is the one that would be returned if the int value were passed to Integer.toString(int).

Specified by:
putInt in interface ResourceManager
Parameters:
name - name with which the string form of value is to be associated.
value - value whose string form is to be associated with key.
See Also:
ResourceManager.getInt(String, int)

putObject

public void putObject(Object key,
                      Object value)
Description copied from interface: ResourceManager
Associates the specified value with the specified key.

Specified by:
putObject in interface ResourceManager
Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified name.

getObject

public <T> T getObject(Class<T> clazz,
                       T defaultValue)
Description copied from interface: ResourceManager
Searches for the object with the specified class in the property list. The method returns defaultValue if the object is not found.

Specified by:
getObject in interface ResourceManager
Parameters:
clazz - the object class.
defaultValue - the default value if the object is not found.
Returns:
1.4.1

putInstanceCreator

public void putInstanceCreator(Class aClass,
                               ObjectCreator instanceCreator)

putComponentCreator

public void putComponentCreator(String key,
                                ObjectCreator<Component> componentCreator)

putComponentCustomizer

public void putComponentCustomizer(String key,
                                   ObjectCustomizer<Component> componentCustomizer)

putComponentUICreator

public void putComponentUICreator(String key,
                                  ObjectCreator<ComponentUI> componentUICreator)

loadResources

protected void loadResources()

loadResource

protected void loadResource(String prefix,
                            String name,
                            String value)

loadIcon

protected void loadIcon(String name,
                        String url)

loadImage

protected void loadImage(String name,
                         String url)

loadColor

protected void loadColor(String name,
                         String colorDef)

loadInt

protected void loadInt(String name,
                       String value)

loadFloat

protected void loadFloat(String name,
                         String value)

loadString

protected void loadString(String name,
                          String value)

loadResourceBundles

protected void loadResourceBundles(String bundlePath)

loadObjects

protected void loadObjects()

loadBoolean

protected void loadBoolean(String name,
                           String value)

isAlreadyLoaded

protected boolean isAlreadyLoaded()

getUrl

protected URL getUrl(String url)

initComponentCreators

protected void initComponentCreators()

loadResourceBundle

protected ResourceBundle loadResourceBundle(Locale locale,
                                            String bundle)

loadResourceBundle

protected ResourceBundle loadResourceBundle(Locale locale,
                                            String bundle,
                                            ClassLoader classLoader)

initTransparencyManager

protected void initTransparencyManager()


Copyright © 2012. All Rights Reserved.