com.google.wave.api
Class Element

java.lang.Object
  extended by com.google.wave.api.BlipContent
      extended by com.google.wave.api.Element
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Attachment, FormElement, Gadget, Image, Installer, Line

public class Element
extends BlipContent
implements java.io.Serializable

Elements are non-text content within a document. What the represent is generally abstracted from the Robot. Although a Robot can query the properties of an element it can only interact with the specific types that the element represents.

See Also:
Serialized Form

Constructor Summary
Element(ElementType type)
          Creates an element of the given type.
Element(ElementType type, java.util.Map<java.lang.String,java.lang.String> properties)
          Constructs an Element of the given type with an initial set of properties.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Returns the map of properties for this element.
 java.lang.String getProperty(java.lang.String name)
          Returns the named property of this element.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Returns the named property of this element, or the default value if the property was not found.
 java.lang.String getText()
          Returns the textual representation of of this blip content, for example, if it's an element, it returns a space.
 ElementType getType()
          Returns the type of the element.
 boolean isAttachment()
          Returns whether this element is an attachment.
 boolean isFormElement()
          Returns whether this element is a form element.
 boolean isGadget()
          Returns whether this element is a gadget.
 boolean isImage()
          Returns whether this element is an image.
 boolean isInlineBlip()
          Returns whether this element is an inline blip.
 void setProperty(java.lang.String name, java.lang.String value)
          Creates/replaces a property with the given to a new value.
 java.lang.String 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
 

Constructor Detail

Element

public Element(ElementType type)
Creates an element of the given type.

Parameters:
type - the type of element to construct.

Element

public Element(ElementType type,
               java.util.Map<java.lang.String,java.lang.String> properties)
Constructs an Element of the given type with an initial set of properties.

Parameters:
type - the type of element to construct.
properties - the properties of the element.
Method Detail

getType

public ElementType getType()
Returns the type of the element.

Returns:
the type of the element.

getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
Returns the map of properties for this element.

Returns:
the map of properties for this element.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Creates/replaces a property with the given to a new value.

Parameters:
name - the name of the property to create/replace.
value - the value to be set on this property.

getProperty

public java.lang.String getProperty(java.lang.String name)
Returns the named property of this element.

Parameters:
name - the name of the property.
Returns:
the value of the property or null if the property was not found.

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Returns the named property of this element, or the default value if the property was not found.

Parameters:
name - the name of the property.
defaultValue - the default value of the property.
Returns:
the value of the property or the default value if the property was not found.

isFormElement

public boolean isFormElement()
Returns whether this element is a form element.

Returns:
true if the element is a form element, false otherwise.

isGadget

public boolean isGadget()
Returns whether this element is a gadget.

Returns:
true if the element is a gadget, false otherwise.

isInlineBlip

public boolean isInlineBlip()
Returns whether this element is an inline blip.

Returns:
true if the element is an inline blip, false otherwise.

isImage

public boolean isImage()
Returns whether this element is an image.

Returns:
true if the element is an image, false otherwise.

isAttachment

public boolean isAttachment()
Returns whether this element is an attachment.

Returns:
true if the element is an attachment, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getText

public java.lang.String getText()
Description copied from class: BlipContent
Returns the textual representation of of this blip content, for example, if it's an element, it returns a space.

Specified by:
getText in class BlipContent
Returns:
the textual representation.