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

java.lang.Object
  extended bycom.jrefinery.report.targets.pageable.output.AbstractOutputTarget
      extended bycom.jrefinery.report.targets.pageable.output.DummyOutputTarget
All Implemented Interfaces:
LayoutSupport, OutputTarget

public class DummyOutputTarget
extends AbstractOutputTarget

The dummy output target wraps an output target for the layouting process, so that no real output is done.

This implementation forwards all requests belonging to the LayoutSupport functionality to the wrapped OutputTarget. All other method calls are ignored.

Author:
Thomas Morgner
See Also:
LayoutSupport

Field Summary
 
Fields inherited from interface com.jrefinery.report.targets.pageable.OutputTarget
AUTHOR, TITLE
 
Constructor Summary
DummyOutputTarget(OutputTarget backend)
          Creates a new output target based on the given backend.
 
Method Summary
 void beginPage(PhysicalPage page)
          This method does nothing.
 void close()
          Closes the target.
 void configure(ReportConfiguration config)
          This method does nothing.
 OutputTarget createDummyWriter()
          Creates an output target that mimics a real output target, but produces no output.
 SizeCalculator createTextSizeCalculator(FontDefinition font)
          Creates a size calculator for the current state of the output target.
 void drawDrawable(DrawableContainer drawable)
          Draws a drawable relative to the current position.
 void drawImage(ImageReference image)
          This method does nothing.
 void drawShape(java.awt.Shape shape)
          This method does nothing.
 void drawString(java.lang.String text)
          This method does nothing.
 void endPage()
          This method does nothing.
 void fillShape(java.awt.Shape shape)
          This method does nothing.
 ContentFactory getContentFactory()
          Returns the assigned content factory for the target.
 FontDefinition getFont()
          Returns the current font.
 float getHorizontalAlignmentBorder()
          Returns the element alignment.
 java.awt.Paint getPaint()
          Returns the current paint.
 java.awt.Stroke getStroke()
          Returns the current stroke.
 float getVerticalAlignmentBorder()
          Returns the element alignment.
 boolean isOpen()
          Returns true if the target is open, and false otherwise.
 void open()
          Opens the target.
 void restoreState()
          Restores the state from the beginning of the page.
 void setFont(FontDefinition font)
          Sets the font.
 void setPaint(java.awt.Paint paint)
          Sets the paint.
 void setStroke(java.awt.Stroke stroke)
          Defines the current stroke for the target.
 
Methods inherited from class com.jrefinery.report.targets.pageable.output.AbstractOutputTarget
createContentFactory, getLogicalPage, getOperationBounds, getProperty, getProperty, getPropertyNames, setOperationBounds, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyOutputTarget

public DummyOutputTarget(OutputTarget backend)
Creates a new output target based on the given backend.

Parameters:
backend - the original outputtarget, that should be used in this proxy.
Method Detail

open

public void open()
          throws OutputTargetException
Opens the target. The request is not forwarded to the backend.

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. The request is not forwarded to the backend.


beginPage

public void beginPage(PhysicalPage page)
This method does nothing.

Parameters:
page - the physical page.

endPage

public void endPage()
             throws OutputTargetException
This method does nothing.

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

restoreState

public void restoreState()
                  throws OutputTargetException
Restores the state from the beginning of the page.

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

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.

drawString

public void drawString(java.lang.String text)
This method does nothing.

Parameters:
text - the text.

drawShape

public void drawShape(java.awt.Shape shape)
This method does nothing.

Parameters:
shape - the shape to draw.

fillShape

public void fillShape(java.awt.Shape shape)
This method does nothing.

Parameters:
shape - the shape to draw.

drawImage

public void drawImage(ImageReference image)
               throws OutputTargetException
This method does nothing.

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)
This method does nothing.

Parameters:
config - the configuration.

createTextSizeCalculator

public SizeCalculator createTextSizeCalculator(FontDefinition font)
                                        throws SizeCalculatorException
Creates a size calculator for the current state of the output target. The calculator is used to calculate the string width and line height and later maybe more...

Parameters:
font - the font.
Returns:
the size calculator.
Throws:
SizeCalculatorException - if there is a problem with the output target.

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
Overrides:
getHorizontalAlignmentBorder in class AbstractOutputTarget
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
Overrides:
getVerticalAlignmentBorder in class AbstractOutputTarget
Returns:
the vertical alignment grid boundry

getContentFactory

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

Specified by:
getContentFactory in interface LayoutSupport
Overrides:
getContentFactory in class AbstractOutputTarget
Returns:
the content factory.

drawDrawable

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

Parameters:
drawable - the drawable to draw.