| Context and Deployment Descriptor > The Context Services > Image Repository Service |
Image Repository Service |
INDEX
PREVIOUS
NEXT
|
The image repository service is defined by the interface IlpImageRepository. It is used to load all JViews TGO images. This service will return the requested image if it is already in the repository. Otherwise, it will use the URL access service to locate the image. If the image cannot be found, a default image is returned.
The image repository serves two main purposes:
The IlpImageRepository interface provides five methods to manage the image repository:
getImage(String location) Gets an image by location. The location is described in the form of a string presenting the relative path of the image. If the image is not already in the repository, it will be retrieved from the given location (as resolved by the URL access service).
getImageLocation(java.awt.Image image) Gets the location string associated with an image in the repository. This method searches the repository for the given image and returns the location of the image if it is found or null otherwise.
getImageLocations() Gets a list of all the image locations currently in the repository.
getImageURL(java.awt.Image image) Gets the location of an image in the repository as a URL. This method searches the repository for the given image and returns the location of the image as a URL if it is found or null otherwise.
removeImage(String location) Removes an image from the repository.
The following code extract shows you how you can use this service in your application:
IlpContext context = IltSystem.GetDefaultContext();
IlpImageRepository repository = context.getImageRepository();
Image img = repository.getImage("ilog/tgo/check.png");
By default, the image repository service is implemented by the class IltDefaultImageRepository.
The following code extract shows you how you can customize the context to use your own image repository implementation:
context.addService(IlpImageRepository.class, myImageRepository);
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |