org.jfree.report.elementfactory
Class StaticImageURLElementFactory

java.lang.Object
  extended byorg.jfree.report.elementfactory.ElementFactory
      extended byorg.jfree.report.elementfactory.ImageElementFactory
          extended byorg.jfree.report.elementfactory.StaticImageURLElementFactory

public class StaticImageURLElementFactory
extends ImageElementFactory

A factory to create an image element that loads its image from an static URL. The content string may contain a relative URL if an valid base URL is given.

Author:
Thomas Morgner

Constructor Summary
StaticImageURLElementFactory()
          Default-Constructor.
 
Method Summary
 Element createElement()
          Creates the image URL element.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.net.URL source)
          Creates a new ImageElement.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.net.URL source, boolean scale)
          Creates a new ImageElement.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.net.URL source, boolean scale, boolean keepAspectRatio)
          Creates a new ImageElement.
 java.net.URL getBaseURL()
          Returns the BaseURL.
 java.lang.String getContent()
          Returns the content part of the URL.
 void setBaseURL(java.net.URL baseURL)
          Defines the base URL.
 void setContent(java.lang.String content)
          Defines the content part of the URL.
 
Methods inherited from class org.jfree.report.elementfactory.ImageElementFactory
applyStyle, getKeepAspectRatio, getScale, setKeepAspectRatio, setScale
 
Methods inherited from class org.jfree.report.elementfactory.ElementFactory
applyElementName, getAbsolutePosition, getDynamicHeight, getMaximumSize, getMinimumSize, getName, getPreferredSize, setAbsolutePosition, setDynamicHeight, setMaximumSize, setMinimumSize, setName, setPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticImageURLElementFactory

public StaticImageURLElementFactory()
Default-Constructor.

Method Detail

createElement

public Element createElement()
Creates the image URL element.

Specified by:
createElement in class ElementFactory
Returns:
the generated element.
Throws:
java.lang.IllegalStateException - if the content is not defined.
See Also:
ElementFactory.createElement()

getContent

public java.lang.String getContent()
Returns the content part of the URL. This string may contain a relative URL, if the base URL is defined.

Returns:
the content part of the URL.

setContent

public void setContent(java.lang.String content)
Defines the content part of the URL. This string may contain a relative URL, if the base URL is defined.

Parameters:
content - the content part of the URL.

getBaseURL

public java.net.URL getBaseURL()
Returns the BaseURL. The base URL is used to build the complete URL if the content url is relative.

Returns:
the base URL.

setBaseURL

public void setBaseURL(java.net.URL baseURL)
Defines the base URL.

Parameters:
baseURL - the base URL.

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.net.URL source)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
source - the source url from where to load the image
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.net.URL source,
                                              boolean scale)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
source - the source url from where to load the image.
scale - scale the image?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.net.URL source,
                                              boolean scale,
                                              boolean keepAspectRatio)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
source - the source url from where to load the image.
scale - scale the image?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid