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 actionStateIcon
           
private static ImageIcon branchIcon
           
private static ImageIcon callStateIcon
           
private static ImageIcon commentIcon
           
private static ImageIcon deepIcon
           
private static ImageIcon finalStateIcon
           
private static ImageIcon forkIcon
           
private  Hashtable iconCache
           
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 objectFlowStateIcon
           
private static ImageIcon realizeIcon
           
private static ImageIcon shallowIcon
           
private static ImageIcon signalIcon
           
private static ImageIcon stateIcon
           
private static ImageIcon subactivityStateIcon
           
 
Constructor Summary
private ResourceLoaderWrapper()
          Constructor for ResourceLoaderWrapper.
 
Method Summary
static void addResourceExtension(String extension)
           
static void addResourceLocation(String location)
           
static boolean containsExtension(String extension)
           
static boolean containsLocation(String location)
           
static ResourceLoaderWrapper getInstance()
          Returns the singleton instance.
private static void initResourceLoader()
          Initializes the resourceloader.
static boolean isInCache(String resource)
           
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 ImageIcon lookupIconResource(String resource)
           
static ImageIcon lookupIconResource(String resource, ClassLoader loader)
           
static ImageIcon lookupIconResource(String resource, String desc)
           
static ImageIcon lookupIconResource(String resource, String desc, ClassLoader loader)
           
static void removeResourceExtension(String extension)
           
static void removeResourceLocation(String location)
           
 
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.


actionStateIcon

private static ImageIcon actionStateIcon

stateIcon

private static ImageIcon stateIcon

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

finalStateIcon

private static ImageIcon finalStateIcon

realizeIcon

private static ImageIcon realizeIcon

signalIcon

private static ImageIcon signalIcon

commentIcon

private static ImageIcon commentIcon

callStateIcon

private static ImageIcon callStateIcon

objectFlowStateIcon

private static ImageIcon objectFlowStateIcon

subactivityStateIcon

private static ImageIcon subactivityStateIcon

iconCache

private Hashtable iconCache

instance

private static ResourceLoaderWrapper instance
Singleton implementation.

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.


addResourceExtension

public static void addResourceExtension(String extension)
See Also:
ResourceLoader.addResourceExtension(String)

addResourceLocation

public static void addResourceLocation(String location)
See Also:
ResourceLoader.addResourceLocation(String)

containsExtension

public static boolean containsExtension(String extension)
See Also:
ResourceLoader.containsExtension(String)

containsLocation

public static boolean containsLocation(String location)
See Also:
ResourceLoader.containsLocation(String)

isInCache

public static boolean isInCache(String resource)
See Also:
ResourceLoader.isInCache(String)

lookupIconResource

public static ImageIcon lookupIconResource(String resource)
See Also:
ResourceLoader.lookupIconResource(String)

lookupIconResource

public static ImageIcon lookupIconResource(String resource,
                                           ClassLoader loader)
See Also:
ResourceLoader.lookupIconResource(String, ClassLoader)

lookupIconResource

public static ImageIcon lookupIconResource(String resource,
                                           String desc)
See Also:
ResourceLoader.lookupIconResource(String, String)

lookupIconResource

public static ImageIcon lookupIconResource(String resource,
                                           String desc,
                                           ClassLoader loader)
See Also:
ResourceLoader.lookupIconResource(String, String, ClassLoader)

removeResourceExtension

public static void removeResourceExtension(String extension)
See Also:
ResourceLoader.removeResourceExtension(String)

removeResourceLocation

public static void removeResourceLocation(String location)
See Also:
ResourceLoader.removeResourceLocation(String)

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.


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook