public class IlpDefaultImageRepository extends Object implements IlpImageRepository
IlpImageRepository
.Constructor and Description |
---|
IlpDefaultImageRepository(IlpContext context)
Creates an image repository.
|
IlpDefaultImageRepository(IlpContext context,
String defaultImageName)
Creates an image repository.
|
Modifier and Type | Method and Description |
---|---|
protected Image |
createDefaultImage()
Creates a default image, which is used when a requested
image can not be resolved.
|
protected IlpContext |
getContext()
Returns the application context.
|
Image |
getImage(String location)
Gets an image by location.
|
String |
getImageLocation(Image image)
Gets the location string associated with an image in the repository.
|
List<String> |
getImageLocations()
Gets a list of all the image locations currently in the repository.
|
URL |
getImageURL(Image image)
Gets the location of an image in the repository as a URL.
|
protected Image |
getLocalImage(String location)
Returns the image that corresponds to the given location, if
it is already loaded, otherwise returns
null |
protected Map<String,Image> |
getRepository()
Accessor to repository for test purpose
|
void |
removeImage(String location)
Removes an image from the repository.
|
protected void |
setLocalImage(String location,
Image im)
Registers the given image.
|
protected void |
setRepository(Map<String,Image> map)
Setter for repository for test purpose
|
public IlpDefaultImageRepository(IlpContext context)
context
- The service context used to get the URL Access service used by
the repository to load data.public IlpDefaultImageRepository(IlpContext context, String defaultImageName)
context
- The service context used to get the URL Access service used by
the repository to load data.defaultImageName
- The name of the default image used if an image cannot be loaded.protected IlpContext getContext()
protected Image getLocalImage(String location)
null
protected void setLocalImage(String location, Image im)
location
- Image locationim
- Imagepublic Image getImage(String location)
getImage
in interface IlpImageRepository
location
- Relative path of the image.public String getImageLocation(Image image)
null
otherwise.getImageLocation
in interface IlpImageRepository
image
- The image to search for.null
if the image was
not found.public List<String> getImageLocations()
getImageLocations
in interface IlpImageRepository
String
instances for the images
currently in the repository.public URL getImageURL(Image image)
null
otherwise.getImageURL
in interface IlpImageRepository
image
- The image to search for.null
if the image was
not found.public void removeImage(String location)
removeImage
in interface IlpImageRepository
location
- Location string associated with the image to be removed.protected Image createDefaultImage()
protected Map<String,Image> getRepository()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.