com.jrefinery.report.targets.pageable.output
Class AbstractOutputTarget

java.lang.Object
  |
  +--com.jrefinery.report.targets.pageable.output.AbstractOutputTarget
All Implemented Interfaces:
LayoutSupport, OutputTarget
Direct Known Subclasses:
DummyOutputTarget, G2OutputTarget, PDFOutputTarget, PlainTextOutputTarget

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

The abstract OutputTarget implements base code for all OutputTargets. It contains functions to manage the cursor, the pageformat and the line breaking of strings.

Author:
David Gilbert, Thomas Morgner

Field Summary
 
Fields inherited from interface com.jrefinery.report.targets.pageable.OutputTarget
AUTHOR, TITLE
 
Constructor Summary
protected AbstractOutputTarget(LogicalPage logicalPage)
          Creates a new output target.
protected AbstractOutputTarget(java.awt.print.PageFormat format)
          Creates a new output target.
protected AbstractOutputTarget(java.awt.print.PageFormat logical, java.awt.print.PageFormat physical)
          Creates a new output target with the specified logical and physical page sizes.
 
Method Summary
protected  ContentFactory createContentFactory()
          Creates a default content factory, which supports all known content types.
 ContentFactory getContentFactory()
          Returns the assigned content factory for the target.
 float getHorizontalAlignmentBorder()
          Returns the element alignment.
 LogicalPage getLogicalPage()
          Returns the logical page.
 java.awt.geom.Rectangle2D getOperationBounds()
          Returns the operation bounds.
 java.lang.Object getProperty(java.lang.String property)
          Queries the property named with property.
 java.lang.Object getProperty(java.lang.String property, java.lang.Object defaultValue)
          Queries the property named with property.
protected  java.util.Iterator getPropertyNames()
          Returns an enumeration of the property names.
 float getVerticalAlignmentBorder()
          Returns the element alignment.
 void setOperationBounds(java.awt.geom.Rectangle2D bounds)
          Sets the operation bounds.
 void setProperty(java.lang.String property, java.lang.Object value)
          Defines a property for this output target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.report.targets.pageable.OutputTarget
beginPage, close, configure, createDummyWriter, drawDrawable, drawImage, drawShape, drawString, endPage, fillShape, getFont, getPaint, getStroke, isOpen, open, setFont, setPaint, setStroke
 
Methods inherited from interface com.jrefinery.report.targets.base.layout.LayoutSupport
createTextSizeCalculator
 

Constructor Detail

AbstractOutputTarget

protected AbstractOutputTarget(java.awt.print.PageFormat format)
Creates a new output target. Both the logical page size and the physical page size will be the same.

Parameters:
format - the page format.

AbstractOutputTarget

protected AbstractOutputTarget(java.awt.print.PageFormat logical,
                               java.awt.print.PageFormat physical)
Creates a new output target with the specified logical and physical page sizes.

Parameters:
logical - the page format used by this target for layouting.
physical - the page format used by this target for printing.

AbstractOutputTarget

protected AbstractOutputTarget(LogicalPage logicalPage)
Creates a new output target.

Parameters:
logicalPage - the logical page.
Method Detail

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object 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.Object 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.Object getProperty(java.lang.String property,
                                    java.lang.Object 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.

getLogicalPage

public LogicalPage getLogicalPage()
Returns the logical page.

Specified by:
getLogicalPage in interface OutputTarget
Returns:
the logical page.

setOperationBounds

public void setOperationBounds(java.awt.geom.Rectangle2D bounds)
Sets the operation bounds.

Specified by:
setOperationBounds in interface OutputTarget
Parameters:
bounds - the bounds.

getOperationBounds

public java.awt.geom.Rectangle2D getOperationBounds()
Returns the operation bounds.

Specified by:
getOperationBounds in interface OutputTarget
Returns:
the operation bounds.

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

Specified by:
getHorizontalAlignmentBorder in interface LayoutSupport
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

Specified by:
getVerticalAlignmentBorder in interface LayoutSupport
Returns:
the vertical alignment grid boundry

getContentFactory

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

Specified by:
getContentFactory in interface LayoutSupport
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.