com.google.wave.api
Class Image

java.lang.Object
  extended by com.google.wave.api.BlipContent
      extended by com.google.wave.api.Element
          extended by com.google.wave.api.Image
All Implemented Interfaces:
java.io.Serializable

public class Image
extends Element

Represents an image within a Wave. The image can either refer to an external resource or a Wave attachment. An external image is defined by the 'url' property, while the Wave attachment is defined by the 'attachmentId' property.

See Also:
Serialized Form

Field Summary
static java.lang.String ATTACHMENT_ID
           
static java.lang.String CAPTION
           
static java.lang.String HEIGHT
           
static java.lang.String URL
           
static java.lang.String WIDTH
           
 
Constructor Summary
Image()
          Constructs an empty image.
Image(java.util.Map<java.lang.String,java.lang.String> properties)
          Constructs an image with a given set of properties.
Image(java.lang.String url, int width, int height, java.lang.String caption)
          Constructs an external image given a url, image dimensions, and a caption.
Image(java.lang.String attachmentId, java.lang.String caption)
          Constructs a Wave image given an attachment id and a caption.
 
Method Summary
 java.lang.String getAttachmentId()
          Returns the attachmentId for the image.
 java.lang.String getCaption()
          Returns the caption for the image.
 int getHeight()
          Returns the fixed height of the image.
 java.lang.String getUrl()
          Returns the URL for the image.
 int getWidth()
          Returns the fixed width of the image.
static Restriction restrictByAttachmentId(java.lang.String attachmentId)
          Creates an instance of Restriction that can be used to search for image with the given attachment id.
static Restriction restrictByCaption(java.lang.String caption)
          Creates an instance of Restriction that can be used to search for image with the given caption.
static Restriction restrictByHeight(int height)
          Creates an instance of Restriction that can be used to search for image with the given height.
static Restriction restrictByUrl(java.lang.String url)
          Creates an instance of Restriction that can be used to search for image with the given URL.
static Restriction restrictByWidth(int width)
          Creates an instance of Restriction that can be used to search for image with the given width.
 void setAttachmentId(java.lang.String attachmentId)
          Sets the attacmentId for the Wave image.
 void setCaption(java.lang.String caption)
          Sets the caption for the image.
 void setHeight(int height)
          Sets the fixed height of the image to be displayed.
 void setUrl(java.lang.String url)
          Changes the URL for the image to the given url.
 void setWidth(int width)
          Sets the fixed width of the image to be displayed.
 
Methods inherited from class com.google.wave.api.Element
getProperties, getProperty, getProperty, getText, getType, isAttachment, isFormElement, isGadget, isImage, isInlineBlip, setProperty, toString
 
Methods inherited from class com.google.wave.api.BlipContent
asElement, asPlaintext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTACHMENT_ID

public static final java.lang.String ATTACHMENT_ID
See Also:
Constant Field Values

CAPTION

public static final java.lang.String CAPTION
See Also:
Constant Field Values

HEIGHT

public static final java.lang.String HEIGHT
See Also:
Constant Field Values

URL

public static final java.lang.String URL
See Also:
Constant Field Values

WIDTH

public static final java.lang.String WIDTH
See Also:
Constant Field Values
Constructor Detail

Image

public Image()
Constructs an empty image.


Image

public Image(java.util.Map<java.lang.String,java.lang.String> properties)
Constructs an image with a given set of properties.

Parameters:
properties - the properties of the image.

Image

public Image(java.lang.String attachmentId,
             java.lang.String caption)
Constructs a Wave image given an attachment id and a caption.

Parameters:
attachmentId - the attachment id of the wave image.
caption - the caption for the image.

Image

public Image(java.lang.String url,
             int width,
             int height,
             java.lang.String caption)
Constructs an external image given a url, image dimensions, and a caption.

Parameters:
url - the url for the external image.
width - the width of the image.
height - the height of the image.
caption - the caption for the image.
Method Detail

getUrl

public java.lang.String getUrl()
Returns the URL for the image.

Returns:
the URL for the image.

setUrl

public void setUrl(java.lang.String url)
Changes the URL for the image to the given url. This will cause the new image to be initialized and loaded.

Parameters:
url - the new image url.

setWidth

public void setWidth(int width)
Sets the fixed width of the image to be displayed.

Parameters:
width - the fixed width of the image.

getWidth

public int getWidth()
Returns the fixed width of the image.

Returns:
the fixed width of the image or -1 if no width was specified.
Throws:
java.lang.IllegalStateException - if no width was specified.

setHeight

public void setHeight(int height)
Sets the fixed height of the image to be displayed.

Parameters:
height - the fixed height of the image.

getHeight

public int getHeight()
Returns the fixed height of the image.

Returns:
the fixed height of the image.
Throws:
java.lang.IllegalStateException - if no height was specified.

setAttachmentId

public void setAttachmentId(java.lang.String attachmentId)
Sets the attacmentId for the Wave image.

Parameters:
attachmentId - the attachment id for the image.

getAttachmentId

public java.lang.String getAttachmentId()
Returns the attachmentId for the image.

Returns:
the attachmentId for the image.

setCaption

public void setCaption(java.lang.String caption)
Sets the caption for the image.

Parameters:
caption - the caption to display for the image.

getCaption

public java.lang.String getCaption()
Returns the caption for the image.

Returns:
the caption for the image.

restrictByAttachmentId

public static Restriction restrictByAttachmentId(java.lang.String attachmentId)
Creates an instance of Restriction that can be used to search for image with the given attachment id.

Parameters:
attachmentId - the attachment id to filter.
Returns:
an instance of Restriction.

restrictByCaption

public static Restriction restrictByCaption(java.lang.String caption)
Creates an instance of Restriction that can be used to search for image with the given caption.

Parameters:
caption - the caption to filter.
Returns:
an instance of Restriction.

restrictByUrl

public static Restriction restrictByUrl(java.lang.String url)
Creates an instance of Restriction that can be used to search for image with the given URL.

Parameters:
url - the URL to filter.
Returns:
an instance of Restriction.

restrictByWidth

public static Restriction restrictByWidth(int width)
Creates an instance of Restriction that can be used to search for image with the given width.

Parameters:
width - the width to filter.
Returns:
an instance of Restriction.

restrictByHeight

public static Restriction restrictByHeight(int height)
Creates an instance of Restriction that can be used to search for image with the given height.

Parameters:
height - the height to filter.
Returns:
an instance of Restriction.