|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IResourceRegistry
The registry which holds all visual resources in the application.
A single resource is identified by its unique id in String format. For resources associated with data types such as
icon for visualizing entity, the id is equal to Type#toString()
. For other resources such as actions icons,
the id is java package style unique identifier.
Resources can also have tags (string identifiers) which allows for creating families of similar resources. For
example all data sets could have DATA_SET_RESOURCE
tag, creating data set resource family. Each resource
can have zero or more associated tags.
A single resource is represented by IVisualResource
interface - see java doc for more details.
The registry is initialized during the application start and reads & verifies all defined resources at this time so
all errors or warnings are shown to user already at startup. Resources are read from
pl.edu.agh.cast.resource.provider
extension point which returns providers (
IVisualResourcesProvider
) containing definition of resources.
Method Summary | |
---|---|
void |
dispose()
Disposes all hold resources including loaded images. |
IVisualResource |
getResource(String id)
Looks up and returns a resource with the given id. |
IVisualResource |
getResource(String id,
String defaultId)
Looks up and returns a resource with the given id. |
List<IVisualResource> |
getResources(String tag)
Returns list of all resources marked with given tag. |
void |
initalize()
Initialize the resource registry. |
void |
register(IVisualResource resource)
Creates a new resource on base of the given entry and register it by given id and tags (all included in entry object). |
boolean |
unregister(String id)
Unregisters a resource with the given id. |
Method Detail |
---|
void initalize() throws ResourceException
ResourceException
void dispose()
void register(IVisualResource resource) throws ResourceException
resource
- resource to register
ResourceException
- when any error occur during creating resource or a resource with the same id already exists in the
registryboolean unregister(String id) throws ResourceException
Unregisters a resource with the given id.
Note: the method disposes all images associated with resource making it unavailable in the application. It should be used carefully, only from performance reasons.
id
- resource id to unregister
ResourceException
- when any error occurs during unregistering resource.IVisualResource getResource(String id)
null
is returned.
id
- resource id
null
if no resource with given id is registered.IVisualResource getResource(String id, String defaultId)
null
is returned.
id
- resource iddefaultId
- default resource id
null
if no resource with given id and default
id is registered.List<IVisualResource> getResources(String tag)
tag
- tag which identifies resource family.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |