com.jrefinery.report.targets.pageable
Interface OutputTarget

All Superinterfaces:
LayoutSupport
All Known Implementing Classes:
AbstractOutputTarget

public interface OutputTarget
extends LayoutSupport

An interface that defines the methods that must be supported by a report output target. JFreeReport currently implements three targets: one for Graphics2D (screen and printer), one for Acrobat PDF files and an other target for PlainText output.

Author:
David Gilbert

Field Summary
static java.lang.String AUTHOR
          Literal text for the 'author' property name.
static java.lang.String TITLE
          Literal text for the 'title' property name.
 
Method Summary
 void beginPage(PhysicalPage page)
          Signals that a page is being started.
 void close()
          Closes the target.
 void configure(ReportConfiguration config)
          Configures the output target.
 OutputTarget createDummyWriter()
          Creates an output target that mimics a real output target, but produces no output.
 void drawDrawable(DrawableContainer drawable)
          Draws a drawable relative to the current position.
 void drawImage(ImageReference image)
          Draws a image relative to the specified coordinates.
 void drawShape(java.awt.Shape shape)
          Draws a shape relative to the current position.
 void drawString(java.lang.String text)
          Draws a string at the current cursor position.
 void endPage()
          Signals that the current page is ended.
 void fillShape(java.awt.Shape shape)
          Fills the shape relative to the current position.
 FontDefinition getFont()
          Returns the current font.
 LogicalPage getLogicalPage()
          Returns the logical page.
 java.awt.geom.Rectangle2D getOperationBounds()
          Returns the operation bounds.
 java.awt.Paint getPaint()
          Returns the current paint.
 java.lang.Object getProperty(java.lang.String property)
          Returns the value of the specified property.
 java.lang.Object getProperty(java.lang.String property, java.lang.Object defaultValue)
          Returns the value of the specified property.
 java.awt.Stroke getStroke()
          Returns the current stroke.
 boolean isOpen()
          Returns true if the target is open, and false otherwise.
 void open()
          Opens the target.
 void setFont(FontDefinition font)
          Sets the font.
 void setOperationBounds(java.awt.geom.Rectangle2D bounds)
          Defines the bounds for the next set of operations.
 void setPaint(java.awt.Paint paint)
          Sets the paint.
 void setProperty(java.lang.String property, java.lang.Object value)
          Defines a property for this target.
 void setStroke(java.awt.Stroke stroke)
          Defines the current stroke for the target.
 
Methods inherited from interface com.jrefinery.report.targets.base.layout.LayoutSupport
createTextSizeCalculator, getContentFactory, getHorizontalAlignmentBorder, getVerticalAlignmentBorder
 

Field Detail

TITLE

public static final java.lang.String TITLE
Literal text for the 'title' property name.

See Also:
Constant Field Values

AUTHOR

public static final java.lang.String AUTHOR
Literal text for the 'author' property name.

See Also:
Constant Field Values
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String property,
                                    java.lang.Object defaultValue)
Returns the value of the specified property. If the property is not found, the defaultValue is returned.

Parameters:
property - the property name (or key).
defaultValue - the default value.
Returns:
the property value.
Throws:
java.lang.NullPointerException - if property is null.

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object value)
Defines a property for this target.

Properties provide a mechanism for configuring a target. For example, you can add title and author information to a PDF report using the 'title' and 'author' properties.

Parameters:
property - the property name (key).
value - the property value (use null to remove an existing property).

open

public void open()
          throws OutputTargetException
Opens the target.

Throws:
OutputTargetException - if there is some problem opening the target.

isOpen

public boolean isOpen()
Returns true if the target is open, and false otherwise.

Returns:
true or false.

close

public void close()
Closes the target.


beginPage

public void beginPage(PhysicalPage page)
Signals that a page is being started. Stores the state of the target to make it possible to restore the complete output target.

Parameters:
page - the physical page.

endPage

public void endPage()
             throws OutputTargetException
Signals that the current page is ended. Some targets need to know when a page is finished, others can simply ignore this message.

Throws:
OutputTargetException - if there is some problem with the target.

getProperty

public java.lang.Object getProperty(java.lang.String property)
Returns the value of the specified property. If the property is not found, null is returned.

Parameters:
property - the property name (or key).
Returns:
the property value.
Throws:
java.lang.NullPointerException - if property is null.

getFont

public FontDefinition getFont()
Returns the current font.

Returns:
the current font.

setFont

public void setFont(FontDefinition font)
             throws OutputTargetException
Sets the font.

Parameters:
font - the font.
Throws:
OutputTargetException - if there is a problem setting the font.

getStroke

public java.awt.Stroke getStroke()
Returns the current stroke.

Returns:
the stroke.

setStroke

public void setStroke(java.awt.Stroke stroke)
               throws OutputTargetException
Defines the current stroke for the target.

The stroke is used to draw the outlines of shapes.

Parameters:
stroke - the stroke.
Throws:
OutputTargetException - if there is a problem setting the stroke.

getPaint

public java.awt.Paint getPaint()
Returns the current paint.

Returns:
the paint.

setPaint

public void setPaint(java.awt.Paint paint)
              throws OutputTargetException
Sets the paint.

Parameters:
paint - The paint.
Throws:
OutputTargetException - if there is a problem setting the paint.

setOperationBounds

public void setOperationBounds(java.awt.geom.Rectangle2D bounds)
Defines the bounds for the next set of operations.

Parameters:
bounds - the bounds.

getOperationBounds

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

Returns:
the bounds.

drawString

public void drawString(java.lang.String text)
Draws a string at the current cursor position.

Parameters:
text - the text.

drawShape

public void drawShape(java.awt.Shape shape)
Draws a shape relative to the current position.

Parameters:
shape - the shape to draw.

fillShape

public void fillShape(java.awt.Shape shape)
Fills the shape relative to the current position.

Parameters:
shape - the shape to draw.

drawDrawable

public void drawDrawable(DrawableContainer drawable)
Draws a drawable relative to the current position.

Parameters:
drawable - the drawable to draw.

drawImage

public void drawImage(ImageReference image)
               throws OutputTargetException
Draws a image relative to the specified coordinates.

Parameters:
image - The image to draw (as ImageReference for possible embedding of raw data).
Throws:
OutputTargetException - if there is a problem setting the paint.

createDummyWriter

public OutputTarget createDummyWriter()
Creates an output target that mimics a real output target, but produces no output. This is used by the reporting engine when it makes its first pass through the report, calculating page boundaries etc. The second pass will use a real output target.

Returns:
a dummy output target.

configure

public void configure(ReportConfiguration config)
Configures the output target.

Parameters:
config - the configuration.

getLogicalPage

public LogicalPage getLogicalPage()
Returns the logical page.

Returns:
the logical page.