cwi.GraphXML.Elements
Class Picture

java.lang.Object
  extended by cwi.GraphXML.Elements.Picture
All Implemented Interfaces:
java.io.Serializable

public class Picture
extends java.lang.Object
implements java.io.Serializable

This class represents an image in GraphXML, used as a graph icon or a fill property. The image's URL can be retrieved as a Reference object, or the java.awt.Image can be generated. Note that the java.awt.Image is generated only on demand, ie, if the application wants to access the image through different means, it can do it without loss of efficiency.

The reason the class name is not "Image" because we wanted to avoid a clash with java.awt.Image...

Author:
Ivan Herman
See Also:
Reference, Serialized Form

Nested Class Summary
(package private)  class Picture.urlImageFilter
          This filter is used to add a 'url' property to an image.
 
Constructor Summary
Picture(Reference r)
           
 
Method Summary
static Picture create(org.w3c.dom.Node node, ParserError parserError)
          Retrieve the representation of a reference from a node, and returns a corresponding class instance.
 java.awt.Image getImage()
          A utility function which returns the stored image in awt Image format, rather than a simple URL.
 Reference getReference()
          Return the reference of the image
 java.net.URL getURL()
          Return the direct URL of the image
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Picture

Picture(Reference r)
Method Detail

getReference

public Reference getReference()
Return the reference of the image


getURL

public java.net.URL getURL()
Return the direct URL of the image


getImage

public java.awt.Image getImage()
A utility function which returns the stored image in awt Image format, rather than a simple URL.

Returns:
the Image version of the stored image, or null if the image could not be loaded.

create

public static Picture create(org.w3c.dom.Node node,
                             ParserError parserError)
Retrieve the representation of a reference from a node, and returns a corresponding class instance. If exceptions are raised by the java.net.URL class, these are caught and reported as parser fatal errors.

Parameters:
node - The node containing the reference.
parser - the parser in charge; used to generate error messages
Returns:
new Reference class, or null

toString

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