ilog.cpl.service
Class IlpDefaultImageRepository

java.lang.Object
  extended by ilog.cpl.service.IlpDefaultImageRepository
All Implemented Interfaces:
IlpImageRepository
Direct Known Subclasses:
IltDefaultImageRepository

public class IlpDefaultImageRepository
extends Object
implements IlpImageRepository

Default implementation of the IlpImageRepository.

Since:
JTGO 3.0

Constructor Summary
IlpDefaultImageRepository(IlpContext context)
          Creates an image repository.
IlpDefaultImageRepository(IlpContext context, String defaultImageName)
          Creates an image repository.
 
Method Summary
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 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 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 map)
          Setter for repository for test purpose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpDefaultImageRepository

public IlpDefaultImageRepository(IlpContext context)
Creates an image repository.

Parameters:
context - The service context used to get the URL Access service used by the repository to load data.

IlpDefaultImageRepository

public IlpDefaultImageRepository(IlpContext context,
                                 String defaultImageName)
Creates an image repository.

Parameters:
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.
Method Detail

getContext

protected IlpContext getContext()
Returns the application context.

Since:
JViews 7.5

getLocalImage

protected Image getLocalImage(String location)
Returns the image that corresponds to the given location, if it is already loaded, otherwise returns null

Since:
JViews 7.5

setLocalImage

protected void setLocalImage(String location,
                             Image im)
Registers the given image.

Parameters:
location - Image location
im - Image
Since:
JViews 7.5

getImage

public Image 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). If it cannot be found, a default image will be returned.

Specified by:
getImage in interface IlpImageRepository
Parameters:
location - Relative path of the image.
Returns:
The image associated with the given location.

getImageLocation

public String getImageLocation(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.

Specified by:
getImageLocation in interface IlpImageRepository
Parameters:
image - The image to search for.
Returns:
Location string associated with the image or null if the image was not found.

getImageLocations

public List getImageLocations()
Gets a list of all the image locations currently in the repository.

Specified by:
getImageLocations in interface IlpImageRepository
Returns:
The list of image locations as String instances for the images currently in the repository.

getImageURL

public URL getImageURL(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.

Specified by:
getImageURL in interface IlpImageRepository
Parameters:
image - The image to search for.
Returns:
URL for the location of the image or null if the image was not found.

removeImage

public void removeImage(String location)
Removes an image from the repository.

Specified by:
removeImage in interface IlpImageRepository
Parameters:
location - Location string associated with the image to be removed.

createDefaultImage

protected Image createDefaultImage()
Creates a default image, which is used when a requested image can not be resolved.


getRepository

protected Map getRepository()
Accessor to repository for test purpose

Internal method or field: do not use!

setRepository

protected void setRepository(Map map)
Setter for repository for test purpose

Internal method or field: do not use!


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.