org.jfree.report.content
Class DefaultContentFactory

java.lang.Object
  extended byorg.jfree.report.content.DefaultContentFactory
All Implemented Interfaces:
ContentFactory

public class DefaultContentFactory
extends java.lang.Object
implements ContentFactory

The DefaultContentFactory provides a default implementation for output targets, which support all known content types.

The implementation provides support for text, image and shape content.

Author:
Thomas Morgner

Constructor Summary
DefaultContentFactory()
          Creates an empty DefaultContentFactory.
 
Method Summary
 void addModule(ContentFactoryModule module)
          Adds a content factory module to the factory.
 boolean canHandleContent(java.lang.String contentType)
          Returns true if the module can handle the specified content type, and false otherwise.
 Content createContentForElement(Element e, ElementLayoutInformation bounds, LayoutSupport ot)
          Creates content for an element.
 void removeModule(ContentFactoryModule module)
          Removes a content factory module from this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContentFactory

public DefaultContentFactory()
Creates an empty DefaultContentFactory.

Method Detail

addModule

public void addModule(ContentFactoryModule module)
Adds a content factory module to the factory.

Parameters:
module - the ContentFactoryModule that should be added to the list of available modules.

removeModule

public void removeModule(ContentFactoryModule module)
Removes a content factory module from this factory.

Parameters:
module - removes a ContentFactoryModules from the list of available modules.

createContentForElement

public Content createContentForElement(Element e,
                                       ElementLayoutInformation bounds,
                                       LayoutSupport ot)
                                throws ContentCreationException
Creates content for an element. Delegates the request to the registered modules. If this factory has no registered handler for the element's content type, then a ContentCreationException is thrown.

Specified by:
createContentForElement in interface ContentFactory
Parameters:
e - the element.
bounds - the bounds.
ot - the output target.
Returns:
the content.
Throws:
ContentCreationException - if there is a problem with the OutputTarget or this factory is not able to handle this content type.

canHandleContent

public boolean canHandleContent(java.lang.String contentType)
Returns true if the module can handle the specified content type, and false otherwise. Delegates the request to the registered modules. Returns false, if this factory is not able to handle this content type.

Specified by:
canHandleContent in interface ContentFactory
Parameters:
contentType - the content type.
Returns:
true or false.