org.argouml.application.helpers
Class ResourceLoaderWrapper

java.lang.Object
  extended byorg.argouml.application.helpers.ResourceLoaderWrapper

public final class ResourceLoaderWrapper
extends Object

Wrapper around org.tigris.gef.util.ResourceLoader.

Necessary since ArgoUML needs some extra init.

Since:
Nov 24, 2002

Field Summary
private static ImageIcon branchIcon
           
private static ImageIcon commentIcon
           
private static ImageIcon deepIcon
           
private static ImageIcon forkIcon
           
private  Hashtable iconCache
           
private static Map images
          Map to convert tokens into file names.
private static ImageIcon initialStateIcon
           
private static ResourceLoaderWrapper instance
          Singleton implementation.
private static ImageIcon joinIcon
           
private static ImageIcon junctionIcon
           
private static Logger LOG
          Logger.
private static ImageIcon realizeIcon
           
private static ImageIcon shallowIcon
           
private static ImageIcon signalIcon
           
 
Constructor Summary
private ResourceLoaderWrapper()
          Constructor for ResourceLoaderWrapper.
 
Method Summary
static String getImageBinding(String name)
          Convert the key to the image file name.
static ResourceLoaderWrapper getInstance()
          Returns the singleton instance.
private static void initResourceLoader()
          Initializes the resourceloader.
private static String lookAndFeelPath(String classname, String element)
          Calculate the path to a look and feel object.
 Icon lookupIcon(Object value)
          Find the Icon for a given model element.
static Icon lookupIcon(String key)
          Look up the Icon for a key.
static ImageIcon lookupIconResource(String resource)
          Find the correct icon for a key.
static ImageIcon lookupIconResource(String resource, String desc)
          Find the correct icon for a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Logger.


initialStateIcon

private static ImageIcon initialStateIcon

deepIcon

private static ImageIcon deepIcon

shallowIcon

private static ImageIcon shallowIcon

forkIcon

private static ImageIcon forkIcon

joinIcon

private static ImageIcon joinIcon

branchIcon

private static ImageIcon branchIcon

junctionIcon

private static ImageIcon junctionIcon

realizeIcon

private static ImageIcon realizeIcon

signalIcon

private static ImageIcon signalIcon

commentIcon

private static ImageIcon commentIcon

iconCache

private Hashtable iconCache

instance

private static ResourceLoaderWrapper instance
Singleton implementation.


images

private static Map images
Map to convert tokens into file names.

Constructor Detail

ResourceLoaderWrapper

private ResourceLoaderWrapper()
Constructor for ResourceLoaderWrapper.

Method Detail

getInstance

public static ResourceLoaderWrapper getInstance()
Returns the singleton instance.

Returns:
ResourceLoaderWrapper

lookAndFeelPath

private static String lookAndFeelPath(String classname,
                                      String element)
Calculate the path to a look and feel object.

Parameters:
classname - The look and feel classname
element - The en part of the path.
Returns:
the complete path.

initResourceLoader

private static void initResourceLoader()
Initializes the resourceloader. LookupIconResource checks if there are locations and extensions known. If there are none, this method is called to initialize the resource loader. Originally, this method was placed within Main but this coupled Main and the resourceLoader too much.


lookupIconResource

public static ImageIcon lookupIconResource(String resource)
Find the correct icon for a key.

Parameters:
resource - The name of the resource to look up.
Returns:
The ImageIcon.

lookupIconResource

public static ImageIcon lookupIconResource(String resource,
                                           String desc)
Find the correct icon for a key.

Parameters:
resource - The name of the resource to look up.
desc - The description for the icon.
Returns:
The ImageIcon.

lookupIcon

public static Icon lookupIcon(String key)
Look up the Icon for a key.

Parameters:
key - The key to find.
Returns:
The found Icon.

lookupIcon

public Icon lookupIcon(Object value)
Find the Icon for a given model element.

Parameters:
value - The model element. TODO: This should not use string matching on classnames to do this since this means that we have knowledge about how the model elements are implemented outside of the Model component.
Returns:
The Icon or null if there is no Icon.

getImageBinding

public static String getImageBinding(String name)
Convert the key to the image file name.

Parameters:
name - the new i18n key
Returns:
the file name (base part only).


ArgoUML © 1996-2005ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook