org.tigris.gef.util
Class ResourceLoader

java.lang.Object
  extended by org.tigris.gef.util.ResourceLoader

public class ResourceLoader
extends java.lang.Object

This class manages the resource locations needed within the application. Already loaded resources are cached. The resources can be searched in different locations.


Constructor Summary
ResourceLoader()
           
 
Method Summary
static void addResourceExtension(java.lang.String extension)
          This method adds a new extension to the list of known extensions.
static void addResourceLocation(java.lang.String location)
          This method adds a new location to the list of known locations.
static boolean containsExtension(java.lang.String extension)
           
static boolean containsLocation(java.lang.String location)
           
static boolean isInCache(java.lang.String resource)
           
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource)
           
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource, java.lang.ClassLoader loader)
           
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource, java.lang.String desc)
           
static javax.swing.ImageIcon lookupIconResource(java.lang.String resource, java.lang.String desc, java.lang.ClassLoader loader)
          This method tries to find an ImageIcon for the given name in all known locations.
static void removeResourceExtension(java.lang.String extension)
          This method removes a extension from the list of known extensions.
static void removeResourceLocation(java.lang.String location)
          This method removes a location from the list of known locations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLoader

public ResourceLoader()
Method Detail

lookupIconResource

public static javax.swing.ImageIcon lookupIconResource(java.lang.String resource)

lookupIconResource

public static javax.swing.ImageIcon lookupIconResource(java.lang.String resource,
                                                       java.lang.String desc)

lookupIconResource

public static javax.swing.ImageIcon lookupIconResource(java.lang.String resource,
                                                       java.lang.ClassLoader loader)

lookupIconResource

public static javax.swing.ImageIcon lookupIconResource(java.lang.String resource,
                                                       java.lang.String desc,
                                                       java.lang.ClassLoader loader)
This method tries to find an ImageIcon for the given name in all known locations. The file extension of the used image file can be any of the known extensions.

Parameters:
resource - Name of the image to be looked after.
desc - A description for the ImageIcon.
loader - The class loader that should be used for loading the resource.
Returns:
ImageIcon for the given name, null if no image could be found.

addResourceLocation

public static void addResourceLocation(java.lang.String location)
This method adds a new location to the list of known locations.

Parameters:
location - String representation of the new location.

addResourceExtension

public static void addResourceExtension(java.lang.String extension)
This method adds a new extension to the list of known extensions.

Parameters:
extension - String representation of the new extension.

removeResourceLocation

public static void removeResourceLocation(java.lang.String location)
This method removes a location from the list of known locations.

Parameters:
location - String representation of the location to be removed.

removeResourceExtension

public static void removeResourceExtension(java.lang.String extension)
This method removes a extension from the list of known extensions.

Parameters:
extension - String representation of the extension to be removed.

containsExtension

public static boolean containsExtension(java.lang.String extension)

containsLocation

public static boolean containsLocation(java.lang.String location)

isInCache

public static boolean isInCache(java.lang.String resource)