org.w3c.mwi.mobileok.basic
Class ImageContent

java.lang.Object
  extended by org.w3c.mwi.mobileok.basic.DecodedContent
      extended by org.w3c.mwi.mobileok.basic.ImageContent
Direct Known Subclasses:
GifImageContent, JpegImageContent, NotSupportedImageContent

public abstract class ImageContent
extends DecodedContent

Abstract class that represents an image resource with a defined width and height.

The class extends Resource to add information about the image: format validation, image width, image height, and use of transparency. The class is more defined as an interface than as a real Resource implementation.

Version:
$Revision: 1.1 $
Author:
The W3C mobileOK Checker Task Force

Constructor Summary
ImageContent(java.net.URI uri, java.util.List<RetrievalElement> retrieved)
          Creates a class instance bound to a URI.
 
Method Summary
abstract  java.util.List<ValidationByteMessage> getImageErrorMessageList()
          Returns the list of image format validation error messages.
abstract  int getImageHeight()
          Returns the height of the image.
abstract  java.lang.String getImageType()
          Returns the image content-type.
abstract  int getImageWidth()
          Returns the width of the image.
abstract  boolean hasTransparency()
          Returns true when the image uses transparency.
 org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document, org.w3c.dom.Node parent)
          Serializes the content to its moki representation as a DOM node.
 
Methods inherited from class org.w3c.mwi.mobileok.basic.DecodedContent
addByteErrorMessages, addLineAndColumnMessages, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageContent

public ImageContent(java.net.URI uri,
                    java.util.List<RetrievalElement> retrieved)
             throws TestException
Creates a class instance bound to a URI.

The content is validated while it is instantiated.

Parameters:
uri - absolute URI of the resource.
retrieved - the retrieved representation of the resource.
Throws:
TestException - an unexpected error occurred while retrieving the resource.
Method Detail

getImageErrorMessageList

public abstract java.util.List<ValidationByteMessage> getImageErrorMessageList()
Returns the list of image format validation error messages.

Returns:
the list of validation error messages.

getImageType

public abstract java.lang.String getImageType()
Returns the image content-type.

Returns:
the image type

getImageHeight

public abstract int getImageHeight()
Returns the height of the image.

Returns:
the height of the image, in pixels.

getImageWidth

public abstract int getImageWidth()
Returns the width of the image.

Returns:
the width of the image, in pixels.

hasTransparency

public abstract boolean hasTransparency()
Returns true when the image uses transparency.

Support for transparency may depend on the image format. A false may thus also mean that transparency simply cannot be used.

Returns:
true when the image uses transparency, false otherwise.

toMokiNode

public org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document,
                                   org.w3c.dom.Node parent)
Description copied from class: DecodedContent
Serializes the content to its moki representation as a DOM node.

Specified by:
toMokiNode in class DecodedContent
Parameters:
document - DOM document the created node should belong to
parent - DOM node to which the representation should be appended.
Returns:
the moki representation of the resource as a DOM node.