|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object resource.util.ResourceManager
The global manager for all resources. The ResourceManager is responsible for managing all binary resources
of the framework. This can be images, videos, text ...
Resources are managed as follows:
The root directory is a directory ending with the name "resource". Here it is just the directory
"resource". Starting from this directory all resources are given back relative to this path.
There can be multiple resouces to manage: gif-images, jpeg-images, text and others.
For all of these resources there should exist one resource module.
There is already one module for gif-resources
.
Resources are requested as follows:
URL url = ResourceManager.getInstance().getResource (String type, String path);
The "type" is the name of the resource module. The path string is the path relative to the directory
of the requested type and is separated with a dot.
Example:
An icon of the size 16x16 should be requested. It is located in the directory "resource/gif/icon".
The icon's name is "document.gif".
So the call is:
URL url = ResourceManager.getInstance().getResource (RESOURCE_GIF, "icon.document");
Nested Class Summary | |
static interface |
ResourceManager.ResourceModul
Interface for a resource module. |
Field Summary | |
static String |
RESOURCE_GIF
Type name for resource module: GIF |
protected String |
resourceRootPath
The root path of all resources. |
Constructor Summary | |
protected |
ResourceManager()
Creates a new instance of ResourceManager. |
Method Summary | |
void |
addResourceModul(ResourceManager.ResourceModul rm)
Adds a resource module to the ResourceManager. |
String |
getFullPath(String type,
String path)
Returns the full path of a resource.. |
static ResourceManager |
getInstance()
Returns the singleton instance of the ResourceManager. |
URL |
getResource(String type,
String path)
Returns a resource as URL. |
void |
removeResourceModul(ResourceManager.ResourceModul rm)
Removes a resource module from the ResourceManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String resourceRootPath
public static final String RESOURCE_GIF
Constructor Detail |
protected ResourceManager()
Method Detail |
public static ResourceManager getInstance()
public void addResourceModul(ResourceManager.ResourceModul rm)
rm
- the resource module to be added.public void removeResourceModul(ResourceManager.ResourceModul rm)
rm
- the resource module to be removed.public URL getResource(String type, String path)
getResource ("RESOURCE_GIF", "icon.16x16.document)
(without file extension).
type
- the logical type namepath
- der relative path + file name without extension
public String getFullPath(String type, String path)
type
- the logical type namepath
- der relative path + file name without extension
|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |