com.cisco.ipphone.sdk
Class CIPImage

java.lang.Object
  extended by com.cisco.ipphone.sdk.CIPImage

public class CIPImage
extends java.lang.Object

Title: CIPImage Description: Handles conversion of Java Images Copyright: Copyright (c) 2002 Company: Cisco Systems, Inc.


Field Summary
 int DEFAULT_DEPTH
           
 int MAX_DEPTH
           
 
Constructor Summary
CIPImage()
          This default constructor creates a new CIPImage object with contains an empty image.
CIPImage(java.awt.image.BufferedImage i)
          This constructor creates a CIPImage object from a java.awt.Image.BufferedImage object.
CIPImage(java.io.File f)
          This constructor creates a CIPImage object from a Java File object.
CIPImage(java.lang.String xml)
          This constructor creates a CIPImage object from an XML String.
 
Method Summary
 java.awt.image.BufferedImage getBufferedImage()
          This method returns a java.awt.Image.BufferedImage object based on the CIPImage.
 int getDepth()
           
 int getHeight()
           
 java.awt.Point getLocation()
           
 java.lang.String getPrompt()
           
 java.lang.String getTitle()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 boolean loadCIP(java.io.File f)
          This method loads a CiscoIPPhoneImage from a file referenced by a java.io.File object.
 boolean loadCIPFromBuffer(java.lang.String xml)
          This method loads a CiscoIPPhoneImage object from a String.
 boolean loadImage(java.awt.image.BufferedImage image)
          This method loads a java.awt.Image.BufferedImage object into the CIPImage object performing the necessary color conversion automatically.
 void readData(java.io.DataInputStream in)
          This method is used for custom serialization of the CIPImage object.
 java.lang.String saveCIPDataToBuffer()
          This method returns the raw ASCII Hex data contained in the CIPImage object - no XML tags.
 java.lang.String saveCIPToBuffer()
          This method returns the entire CiscoIPPhoneImage XML object in a String.
 void setLocation(int x, int y)
           
 void setLocation(java.awt.Point p)
           
 void setPrompt(java.lang.String prompt)
           
 void setTitle(java.lang.String title)
           
 void setX(int x)
           
 void setY(int y)
           
 void writeData(java.io.DataOutputStream out)
          This method is used for custom serialization of the CIPImage object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DEPTH

public final int MAX_DEPTH
See Also:
Constant Field Values

DEFAULT_DEPTH

public final int DEFAULT_DEPTH
See Also:
Constant Field Values
Constructor Detail

CIPImage

public CIPImage()
This default constructor creates a new CIPImage object with contains an empty image. Call a load command after instantiation to initialize the image.


CIPImage

public CIPImage(java.lang.String xml)
This constructor creates a CIPImage object from an XML String. The XML String must contain a valid CiscoIPPhoneImage object. If an error occurs during parsing of the XML String, the CIPImage will contain invalid data. If detection of parsing errors is required, use the default CIPImage constructor and then call loadCIPFromBuffer(String xml) which will return true if the XML parsed and image loaded successfully.

Parameters:
xml - String containing a CiscoIPPhoneImage XML object to be loaded

CIPImage

public CIPImage(java.io.File f)
This constructor creates a CIPImage object from a Java File object. The File object must point to a text file containing a valid CiscoIPPhoneImage XML object. If an error occurs while loading the File or parsing the XML, the CIPImage will contain invalid data. If detection of parsing errors is required, use the default CIPImage constructor and then call loadCIP(File f) which will return true if the File loaded and XML parsed successfully.

Parameters:
f - java.io.file object referencing a CiscoIPPhoneImage XML file to be loaded

CIPImage

public CIPImage(java.awt.image.BufferedImage i)
This constructor creates a CIPImage object from a java.awt.Image.BufferedImage object. Any image type supported by the BufferedImage class should work fine with CIPImage. If an error occurs while loading the BufferedImage, the CIPImage will contain invalid data. If detection of loading errors is required, use the default CIPImage constructor and then call loadImage(BufferedImage image) which will return true if the Image loaded successfully.

Parameters:
i - BufferedImage object to be loaded
Method Detail

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
This method returns a java.awt.Image.BufferedImage object based on the CIPImage. The BufferedImage will be of type TYPE_INT_ARGB. If the CIPImage object has not been intialized with a successful load command, this returns null.

Returns:
Returns a BufferedImage reference if CIPImage contains a valid image, otherwise returns null

loadImage

public boolean loadImage(java.awt.image.BufferedImage image)
This method loads a java.awt.Image.BufferedImage object into the CIPImage object performing the necessary color conversion automatically. The CIPImage color depth used is determined by the static int MAX_DEPTH. Any image type supported by the BufferedImage class should work fine with CIPImage. loadImage(BufferedImage image) which will return

Parameters:
image - BufferedImage object to be loaded
Returns:
Returns true if the Image loaded successfully, false if the Image was larger than MAX_WIDTH or MAX_HEIGHT.

loadCIP

public boolean loadCIP(java.io.File f)
This method loads a CiscoIPPhoneImage from a file referenced by a java.io.File object.

Parameters:
f - java.io.file object referencing a CiscoIPPhoneImage XML file to be loaded
Returns:
Returns true if the File loaded and XML parsed successfully, false otherwise.

loadCIPFromBuffer

public boolean loadCIPFromBuffer(java.lang.String xml)
This method loads a CiscoIPPhoneImage object from a String.

Parameters:
xml - String containing a CiscoIPPhoneImage XML object to be loaded
Returns:
Returns true if the XML parsed and image loaded successfully, false otherwise.

writeData

public void writeData(java.io.DataOutputStream out)
This method is used for custom serialization of the CIPImage object. Calling writeData() serializes all of the CIPImage data to the specified stream.

Parameters:
out - DataOutputStream to which the CIPImage is serialized

readData

public void readData(java.io.DataInputStream in)
This method is used for custom serialization of the CIPImage object. Calling readData() deserializes all of the CIPImage data from the specified stream.

Parameters:
in - DataInputStream from which the CIPImage is deserialized

saveCIPDataToBuffer

public java.lang.String saveCIPDataToBuffer()
This method returns the raw ASCII Hex data contained in the CIPImage object - no XML tags.

Returns:
String containing the CiscoIPPhoneImage ASCII Hex data

saveCIPToBuffer

public java.lang.String saveCIPToBuffer()
This method returns the entire CiscoIPPhoneImage XML object in a String.

Returns:
String containing CiscoIPPhoneImage XML

getTitle

public java.lang.String getTitle()
Returns:
Returns a String containing the Title of the CiscoIPPhoneImage

setTitle

public void setTitle(java.lang.String title)
Parameters:
title - Sets the Title of the CiscoIPPhoneImage equal to title

getPrompt

public java.lang.String getPrompt()
Returns:
Returns a String containing the Prompt of the CiscoIPPhoneImage

setPrompt

public void setPrompt(java.lang.String prompt)
Parameters:
prompt - Sets the Prompt of the CiscoIPPhoneImage equal to prompt

getX

public int getX()
Returns:
Returns the current LocationX value of the CiscoIPPhoneImage

getY

public int getY()
Returns:
Returns the current LocationY value of the CiscoIPPhoneImage

setX

public void setX(int x)
Parameters:
x - Sets the current LocationX of the CiscoIPPhoneImage x

setY

public void setY(int y)
Parameters:
y - Sets the current LocationY of the CiscoIPPhoneImage y

getLocation

public java.awt.Point getLocation()
Returns:
Returns the current LocationX,Y of the CiscoIPPhoneImage in the form of a java.awt.Point

setLocation

public void setLocation(java.awt.Point p)
Parameters:
p - Sets the current Location of the CiscoIPPhoneImage to the specified java.awt.Point

setLocation

public void setLocation(int x,
                        int y)
Parameters:
x - LocationX of the CiscoIPPhoneImage
y - LocationY of the CiscoIPPhoneImage

getWidth

public int getWidth()
Returns:
Returns the Width of the CiscoIPPhoneImage

getHeight

public int getHeight()
Returns:
Returns the Height of the CiscoIPPhoneImage

getDepth

public int getDepth()
Returns:
Returns the color Depth (in bits) of the CiscoIPPhoneImage