com.bigzip
Class ResourceLocator

java.lang.Object
  |
  +--com.bigzip.ResourceLocator

public class ResourceLocator
extends java.lang.Object

The ResourceLocator is used to load resources (icons, images, help files, etc.) in a way that is independant of location and user preferences.


Field Summary
static java.lang.String ACTION_ANIMATION_PATH
          This is the location of the anaimated version of the standard BiGZiP images.
static java.lang.String ACTION_IMAGE_PATH
          This is the location of the standard BiGZiP non-animated images.
static java.lang.String HELP_PATH
          This is the standard location for help files.
static java.lang.String IMAGE_PATH
          This is the standard location where general images are stored.
static java.lang.String RESOURCE_PATH
          This is the standard location where resources are stored.
 
Constructor Summary
ResourceLocator()
           
 
Method Summary
static com.bigzip.HelpSet getHelpSet(java.lang.String helpPathName)
          Loads a HelpSet from the file system so that it may be incorperated into BiGZiP's help when a plugin is loaded.
static javax.swing.ImageIcon getSystemIconResource(java.lang.String iconresourcePathName)
          Retreives an image icon from the specified system resource.
static java.net.URL getSystemResource(java.lang.String resourcePathName)
          Retreives a URL that can access the specified system resource.
static java.io.InputStream getSystemResourceAsStream(java.lang.String resourcePathName)
          Retreives a stream containing the specified system resource.
static javax.swing.ImageIcon getUserIconResource(java.lang.String iconresourcePathName)
          Retrieves an image icon from an image file in the bigzip directory in the current user's home directory or a subdirectory of the user's bigzip directory.
static java.io.File getUserResource(java.lang.String resourcePathName)
          Retrieves File object to access a file in the bigzip directory in the current user's home directory or a subdirectory of the user's bigzip directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_PATH

public static final java.lang.String RESOURCE_PATH
This is the standard location where resources are stored. In it are subdirectories for specific types of resources.

IMAGE_PATH

public static final java.lang.String IMAGE_PATH
This is the standard location where general images are stored. In it is a subdirectory for BiGZiP's action images. It is suggested that a plugin create it's own subdirectory for its image to avoid filename clashes with other plugins.

ACTION_IMAGE_PATH

public static final java.lang.String ACTION_IMAGE_PATH
This is the location of the standard BiGZiP non-animated images.

ACTION_ANIMATION_PATH

public static final java.lang.String ACTION_ANIMATION_PATH
This is the location of the anaimated version of the standard BiGZiP images.

HELP_PATH

public static final java.lang.String HELP_PATH
This is the standard location for help files.
Constructor Detail

ResourceLocator

public ResourceLocator()
Method Detail

getHelpSet

public static com.bigzip.HelpSet getHelpSet(java.lang.String helpPathName)
                                     throws com.bigzip.HelpSetException
Loads a HelpSet from the file system so that it may be incorperated into BiGZiP's help when a plugin is loaded.
Parameters:
helpPathName - The path to the help file relative to the location of the com.bigzip package.
Returns:
A new HelpSet object containing the help file.
Throws:
com.bigzip.HelpSetException - The path is invalid or doesn't refere to a help file, or an error occurred while trying to load the help file.

getSystemResource

public static java.net.URL getSystemResource(java.lang.String resourcePathName)
Retreives a URL that can access the specified system resource.
Parameters:
resourcePathName - The path to the system resource relative to the location of the com.bigzip package.
Returns:
A URL pointing to the system resource or null if the resourcePathName is invalid.

getSystemResourceAsStream

public static java.io.InputStream getSystemResourceAsStream(java.lang.String resourcePathName)
Retreives a stream containing the specified system resource.
Parameters:
resourcePathName - The path to the system resource relative to the location of the com.bigzip package.
Returns:
An input stream containing the contents of the system resource or null if the resourcePathName is invalid.

getSystemIconResource

public static javax.swing.ImageIcon getSystemIconResource(java.lang.String iconresourcePathName)
Retreives an image icon from the specified system resource.
Parameters:
iconresourcePathName - The path to the image file relative to the location of the com.bigzip package.
Returns:
An image icon loaded with the image from the iconresourcePathName or null if iconresourcePathName is invalid or doesn't refer to a existant file.

getUserResource

public static java.io.File getUserResource(java.lang.String resourcePathName)
Retrieves File object to access a file in the bigzip directory in the current user's home directory or a subdirectory of the user's bigzip directory. If the path does not exist, it will be created.
Parameters:
resourcePathName - The path of the resource relative to the user's home directory.
Returns:
A new File object that can access the user resource.

getUserIconResource

public static javax.swing.ImageIcon getUserIconResource(java.lang.String iconresourcePathName)
Retrieves an image icon from an image file in the bigzip directory in the current user's home directory or a subdirectory of the user's bigzip directory. If the path does not exist, it will be created.
Parameters:
iconresourcePathName - The path of the image file relative to the user's home directory.
Returns:
An image icon loaded with the image from the iconresourcePathName or null if iconresourcePathName is invalid or doesn't refer to a readable file.