org.argouml.application.helpers
Class ResourceLoaderWrapper

java.lang.Object
  extended by org.argouml.application.helpers.ResourceLoaderWrapper

public final class ResourceLoaderWrapper
extends java.lang.Object

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

Necessary since ArgoUML needs some extra init.

Since:
Nov 24, 2002
Stereotype:
singleton

Method Summary
static void addResourceLocation(java.lang.String location)
          This public operation is needed to allow modules to add their own images.
static java.lang.String getImageBinding(java.lang.String name)
          Convert the key to the image file name.
static ResourceLoaderWrapper getInstance()
          Returns the singleton instance.
 javax.swing.Icon lookupIcon(java.lang.Object value)
          Find the Icon for a given model element.
static javax.swing.ImageIcon lookupIcon(java.lang.String key)
          Look up the Icon for a key.
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource)
          Find the correct icon for a key.
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource, java.lang.String desc)
          Find the correct icon for a key.
static java.net.URL lookupIconUrl(java.lang.String name)
          Find the path to a given icon and return it as a URL.
static java.net.URL lookupIconUrl(java.lang.String name, java.lang.ClassLoader loader)
          Find the path to a given icon and return it as a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ResourceLoaderWrapper getInstance()
Returns the singleton instance.

Returns:
ResourceLoaderWrapper

addResourceLocation

public static void addResourceLocation(java.lang.String location)
This public operation is needed to allow modules to add their own images.

Parameters:
location - the path were the images are

lookupIconResource

public static javax.swing.ImageIcon lookupIconResource(java.lang.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 javax.swing.ImageIcon lookupIconResource(java.lang.String resource,
                                                       java.lang.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 javax.swing.ImageIcon lookupIcon(java.lang.String key)
Look up the Icon for a key.

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

lookupIcon

public javax.swing.Icon lookupIcon(java.lang.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 java.lang.String getImageBinding(java.lang.String name)
Convert the key to the image file name.

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

lookupIconUrl

public static java.net.URL lookupIconUrl(java.lang.String name,
                                         java.lang.ClassLoader loader)
Find the path to a given icon and return it as a URL.

Parameters:
name - base name of the icon to search for
loader - class loader to use or null to use the default class loader
Returns:
the URL where the icon was found

lookupIconUrl

public static java.net.URL lookupIconUrl(java.lang.String name)
Find the path to a given icon and return it as a URL.

Parameters:
name - base name of the icon to search for
Returns:
the URL where the icon was found


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook