com.sibvisions.rad.ui.web.impl
Class WebImage

java.lang.Object
  extended by com.sibvisions.rad.ui.web.impl.WebResource
      extended by com.sibvisions.rad.ui.web.impl.WebImage
All Implemented Interfaces:
IImage, IResource

public final class WebImage
extends WebResource
implements IImage

Web server implementation of image definition.

See Also:
Image

Method Summary
static WebImage createScaledImage(WebImage pImage)
          Creates a scaled image.
 String getAsString()
          Gets this Object as String.
 byte[] getData()
          Gets the image stream.
 int getHeight()
          Determines the height of the image.
static WebImage getImage(String pImageName)
          Creates a new instance of WebImage with a specific image name.
static WebImage getImage(String pImageName, byte[] pData)
          Creates a new instance of WebImage for specific byte data and an image name.
static WebImage getImageFromURI(String pRequestURI)
          Gets the WebImage from a given request URI.
static String getImageMapping(String pMappingName)
          Gets the image name for the given mapping name.
static String[] getImageMappingNames()
          Gets all used mapping names.
 String getImageName()
          Gets the image name.
static String getImageURI(String pImageName)
          Gets the URL for the given image name.
static String getImageURI(String pImageName, byte[] pData)
          Gets the URL for the given image name and data.
 InputStream getInputStream()
          Gets the image stream.
static String getURLPrefix()
          Gets the url prefix.
 int getWidth()
          Determines the width of the image.
 void saveAs(String pFileName)
          Saves the current image as file.
static void setImageMapping(String pMappingName, String pImageName)
          Sets the image name for the given mapping name.
static void setURLPrefix(String pUrlPrefix)
          Sets the url prefix.
 
Methods inherited from class com.sibvisions.rad.ui.web.impl.WebResource
getNullableAsString, getResource, setAsString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Method Detail

getAsString

public String getAsString()
Gets this Object as String.

Specified by:
getAsString in class WebResource
Returns:
the String.

getWidth

public int getWidth()
Determines the width of the image. If the width is not yet known, this method returns -1.

Specified by:
getWidth in interface IImage
Returns:
the width of this image, or -1 if the width is not yet known.
See Also:
Image.getHeight(java.awt.image.ImageObserver)

getHeight

public int getHeight()
Determines the height of the image. If the height is not yet known, this method returns -1.

Specified by:
getHeight in interface IImage
Returns:
the height of this image, or -1 if the height is not yet known.
See Also:
Image.getWidth(java.awt.image.ImageObserver)

saveAs

public void saveAs(String pFileName)
            throws IOException
Saves the current image as file.

Specified by:
saveAs in interface IImage
Parameters:
pFileName - the filename
Throws:
IOException - if the image can not be saved

getImage

public static WebImage getImage(String pImageName)
Creates a new instance of WebImage with a specific image name.

Parameters:
pImageName - the Image name.
Returns:
the WebImage.
See Also:
IImage

getImage

public static WebImage getImage(String pImageName,
                                byte[] pData)
Creates a new instance of WebImage for specific byte data and an image name.

Parameters:
pImageName - the name of the image specified with byData
pData - the image data
Returns:
the WebImage.

getInputStream

public InputStream getInputStream()
Gets the image stream.

Returns:
image stream.

getImageName

public String getImageName()
Gets the image name.

Returns:
image name.

getData

public byte[] getData()
Gets the image stream.

Returns:
image stream.

getImageURI

public static String getImageURI(String pImageName)
Gets the URL for the given image name.

Parameters:
pImageName - the image name.
Returns:
the Image URI.

getImageURI

public static String getImageURI(String pImageName,
                                 byte[] pData)
Gets the URL for the given image name and data.

Parameters:
pImageName - the image name.
pData - the data.
Returns:
the Image URI.

getImageFromURI

public static WebImage getImageFromURI(String pRequestURI)
Gets the WebImage from a given request URI.

Parameters:
pRequestURI - the request URI.
Returns:
the WebImage.

getImageMapping

public static String getImageMapping(String pMappingName)
Gets the image name for the given mapping name.

Parameters:
pMappingName - the mapping name.
Returns:
the image name.

setImageMapping

public static void setImageMapping(String pMappingName,
                                   String pImageName)
Sets the image name for the given mapping name.

Parameters:
pMappingName - the mapping name.
pImageName - the image name.

getImageMappingNames

public static String[] getImageMappingNames()
Gets all used mapping names.

Returns:
the mapping names.

getURLPrefix

public static String getURLPrefix()
Gets the url prefix.

Returns:
the url prefix.

setURLPrefix

public static void setURLPrefix(String pUrlPrefix)
Sets the url prefix.

Parameters:
pUrlPrefix - the url prefix.

createScaledImage

public static WebImage createScaledImage(WebImage pImage)
Creates a scaled image.

Parameters:
pImage - the image to scale
Returns:
the scaled image


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.