org.jfree.report.modules.output.pageable.base.output
Class AbstractOutputTarget

java.lang.Object
  |
  +--org.jfree.report.modules.output.pageable.base.output.AbstractOutputTarget
Direct Known Subclasses:
G2OutputTarget, PDFOutputTarget, PlainTextOutputTarget

public abstract class AbstractOutputTarget
extends java.lang.Object
implements OutputTarget

The abstract OutputTarget implements base code for all pageable OutputTargets. This implementation contains base functions to process the MetaPage objects to create the real output.

Author:
David Gilbert, Thomas Morgner

Fields inherited from interface org.jfree.report.modules.output.pageable.base.OutputTarget
AUTHOR, TITLE
 
Constructor Summary
protected AbstractOutputTarget()
           
 
Method Summary
protected abstract  void beginPage(PageDefinition page, int index)
           
 void configure(org.jfree.util.Configuration config)
          Configures the output target.
protected  ContentFactory createContentFactory()
          Creates a default content factory, which supports all known content types.
protected abstract  void drawDrawable(MetaElement element, DrawableContent d)
           
protected abstract  void drawImage(ImageContent content)
           
protected abstract  void drawShape(java.awt.Shape s)
           
protected abstract  void endPage()
           
protected abstract  void fillShape(java.awt.Shape s)
           
 LayoutManagerCache getCache()
           
 ContentFactory getContentFactory()
          Returns the assigned content factory for the target.
protected abstract  FontDefinition getFont()
           
 float getHorizontalAlignmentBorder()
          Returns the element alignment.
 long getInternalHorizontalAlignmentBorder()
          Returns the element alignment.
protected  StrictBounds getInternalOperationBounds()
           
protected  StrictBounds getInternalPageBounds()
           
 long getInternalVerticalAlignmentBorder()
          Returns the element alignment.
protected  java.awt.geom.Rectangle2D getOperationBounds()
           
protected  java.awt.geom.Rectangle2D getPageBounds()
           
protected abstract  java.awt.Paint getPaint()
           
 java.lang.String getProperty(java.lang.String property)
          Queries the property named with property.
 java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue)
          Queries the property named with property.
protected  java.util.Iterator getPropertyNames()
          Returns an enumeration of the property names.
protected  ReportDefinition getReport()
           
protected abstract  java.awt.Stroke getStroke()
           
 float getVerticalAlignmentBorder()
          Returns the element alignment.
 boolean isImageResolutionMappingActive()
           
protected abstract  boolean isPaintSupported(java.awt.Paint p)
           
protected  void printAnchorContent(MetaElement element, Content content)
           
protected  void printBand(MetaBand band, StrictBounds bounds)
          Prints all elements of the band, which are within the given bounds.
protected  void printContainerContent(MetaElement element, Content content)
           
protected  void printContent(MetaElement element, Content content)
           
protected  void printDrawableContent(MetaElement element, Content content)
           
protected  void printElement(MetaElement element, StrictBounds bounds)
           
protected  void printHRefForCurrentContent(java.lang.String href, java.lang.String hrefWindow)
           
protected  void printHRefTarget(MetaElement element, java.lang.String target)
           
protected  void printImageContent(MetaElement element, Content content)
           
 void printPage(MetaPage content, PageDefinition page, int index)
           
protected  void printShapeContent(MetaElement element, Content content)
           
protected abstract  void printText(java.lang.String text)
           
protected  void printTextContent(MetaElement element, Content content)
           
protected  void printTextLine(TextLine c, java.lang.String hrefTarget, java.lang.String hrefWindow)
          Add a single content junk (in most cases a single line or a line fragment) to the list of PhysicalOperations.
protected abstract  void setFont(FontDefinition f)
           
protected  void setInternalOperationBounds(StrictBounds operationBounds)
          Correct the given bounds to fit on the page.
protected  void setPageBounds(java.awt.geom.Rectangle2D pageBounds)
           
protected abstract  void setPaint(java.awt.Paint p)
           
 void setProperty(java.lang.String property, java.lang.String value)
          Defines a property for this output target.
 void setReport(ReportDefinition report)
           
protected abstract  void setStroke(java.awt.Stroke s)
           
protected  void updateFont(FontDefinition f)
           
protected  void updatePaint(java.awt.Paint paint)
           
protected  void updateStroke(java.awt.Stroke stroke)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOutputTarget

protected AbstractOutputTarget()
Method Detail

configure

public void configure(org.jfree.util.Configuration config)
Configures the output target.
Specified by:
configure in interface OutputTarget
Parameters:
config - the configuration.

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
Defines a property for this output target. Properties are the standard way of configuring an output target.
Specified by:
setProperty in interface OutputTarget
Parameters:
property - the name of the property to set (null not permitted).
value - the value of the property. If the value is null, the property is removed from the output target.

getProperty

public java.lang.String getProperty(java.lang.String property)
Queries the property named with property. If the property is not found, null is returned.
Specified by:
getProperty in interface OutputTarget
Parameters:
property - the name of the property to be queried
Returns:
the value stored under the given property name
Throws:
java.lang.NullPointerException - if property is null

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    java.lang.String defaultValue)
Queries the property named with property. If the property is not found, the default value is returned.
Specified by:
getProperty in interface OutputTarget
Parameters:
property - the name of the property to be queried
defaultValue - the defaultvalue returned if there is no such property
Returns:
the value stored under the given property name
Throws:
java.lang.NullPointerException - if property is null

getPropertyNames

protected java.util.Iterator getPropertyNames()
Returns an enumeration of the property names.
Returns:
the enumeration.

getHorizontalAlignmentBorder

public float getHorizontalAlignmentBorder()
Returns the element alignment. Elements will be layouted aligned to this border, so that mod(X, horizontalAlignment) == 0 and mod(Y, verticalAlignment) == 0
Returns:
the vertical alignment grid boundry

getVerticalAlignmentBorder

public float getVerticalAlignmentBorder()
Returns the element alignment. Elements will be layouted aligned to this border, so that mod(X, horizontalAlignment) == 0 and mod(Y, verticalAlignment) == 0
Returns:
the vertical alignment grid boundry

getInternalVerticalAlignmentBorder

public long getInternalVerticalAlignmentBorder()
Returns the element alignment. Elements will be layouted aligned to this border, so that mod(X, horizontalAlignment) == 0 and mod(Y, verticalAlignment) == 0. Returning 0 will disable the alignment.

Q&D Hack: Save some cycles of processor time by computing that thing only once.

Returns:
the vertical alignment grid boundry

getInternalHorizontalAlignmentBorder

public long getInternalHorizontalAlignmentBorder()
Returns the element alignment. Elements will be layouted aligned to this border, so that mod(X, horizontalAlignment) == 0 and mod(Y, verticalAlignment) == 0. Returning 0 will disable the alignment.

Q&D Hack: Save some cycles of processor time by computing that thing only once.

Returns:
the vertical alignment grid boundry

getContentFactory

public ContentFactory getContentFactory()
Returns the assigned content factory for the target.
Returns:
the content factory.

createContentFactory

protected ContentFactory createContentFactory()
Creates a default content factory, which supports all known content types. Override this method to supply an own implementation of the ContentFactory.
Returns:
a default content factory.

beginPage

protected abstract void beginPage(PageDefinition page,
                                  int index)
                           throws OutputTargetException

endPage

protected abstract void endPage()
                         throws OutputTargetException

printPage

public void printPage(MetaPage content,
                      PageDefinition page,
                      int index)
               throws OutputTargetException
Specified by:
printPage in interface OutputTarget

printBand

protected void printBand(MetaBand band,
                         StrictBounds bounds)
                  throws OutputTargetException
Prints all elements of the band, which are within the given bounds. The bounds are global bounds, so they define a position on the meta page, not the physical page.
Parameters:
band - the band that should be printed
bounds - the bounds for that band.

printHRefTarget

protected void printHRefTarget(MetaElement element,
                               java.lang.String target)

printElement

protected void printElement(MetaElement element,
                            StrictBounds bounds)
                     throws OutputTargetException

printContent

protected void printContent(MetaElement element,
                            Content content)
                     throws OutputTargetException

printHRefForCurrentContent

protected void printHRefForCurrentContent(java.lang.String href,
                                          java.lang.String hrefWindow)

printTextContent

protected void printTextContent(MetaElement element,
                                Content content)
                         throws OutputTargetException

printShapeContent

protected void printShapeContent(MetaElement element,
                                 Content content)
                          throws OutputTargetException

printImageContent

protected void printImageContent(MetaElement element,
                                 Content content)
                          throws OutputTargetException

printDrawableContent

protected void printDrawableContent(MetaElement element,
                                    Content content)
                             throws OutputTargetException

printContainerContent

protected void printContainerContent(MetaElement element,
                                     Content content)
                              throws OutputTargetException

printAnchorContent

protected void printAnchorContent(MetaElement element,
                                  Content content)
                           throws OutputTargetException

getOperationBounds

protected java.awt.geom.Rectangle2D getOperationBounds()

getInternalOperationBounds

protected StrictBounds getInternalOperationBounds()

setInternalOperationBounds

protected void setInternalOperationBounds(StrictBounds operationBounds)
Correct the given bounds to fit on the page. The operation bounds are valid within the global context, we have to adjust them to the page local context.
Parameters:
operationBounds - the operation bounds

setPageBounds

protected void setPageBounds(java.awt.geom.Rectangle2D pageBounds)

getPageBounds

protected java.awt.geom.Rectangle2D getPageBounds()

getInternalPageBounds

protected StrictBounds getInternalPageBounds()

printTextLine

protected void printTextLine(TextLine c,
                             java.lang.String hrefTarget,
                             java.lang.String hrefWindow)
Add a single content junk (in most cases a single line or a line fragment) to the list of PhysicalOperations. This method is called recursivly for all contentparts.
Parameters:
c - the content.

printText

protected abstract void printText(java.lang.String text)

updateFont

protected void updateFont(FontDefinition f)
                   throws OutputTargetException

setFont

protected abstract void setFont(FontDefinition f)
                         throws OutputTargetException

getFont

protected abstract FontDefinition getFont()

updatePaint

protected void updatePaint(java.awt.Paint paint)

setPaint

protected abstract void setPaint(java.awt.Paint p)

getPaint

protected abstract java.awt.Paint getPaint()

isPaintSupported

protected abstract boolean isPaintSupported(java.awt.Paint p)

updateStroke

protected void updateStroke(java.awt.Stroke stroke)
                     throws OutputTargetException

getCache

public LayoutManagerCache getCache()

setStroke

protected abstract void setStroke(java.awt.Stroke s)
                           throws OutputTargetException

getStroke

protected abstract java.awt.Stroke getStroke()

drawShape

protected abstract void drawShape(java.awt.Shape s)

fillShape

protected abstract void fillShape(java.awt.Shape s)

drawDrawable

protected abstract void drawDrawable(MetaElement element,
                                     DrawableContent d)
                              throws OutputTargetException

drawImage

protected abstract void drawImage(ImageContent content)
                           throws OutputTargetException

isImageResolutionMappingActive

public boolean isImageResolutionMappingActive()

setReport

public void setReport(ReportDefinition report)
Specified by:
setReport in interface OutputTarget

getReport

protected ReportDefinition getReport()