org.jfree.report.function
Class PaintDynamicComponentFunction

java.lang.Object
  extended byorg.jfree.report.function.AbstractFunction
      extended byorg.jfree.report.function.PaintDynamicComponentFunction
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, Expression, Function, PageEventListener, ReportListener, java.io.Serializable

public class PaintDynamicComponentFunction
extends AbstractFunction
implements java.io.Serializable, PageEventListener

Paints a AWT or Swing Component. The component must be contained in the dataRow.

Author:
Thomas Morgner
See Also:
Serialized Form

Field Summary
static java.lang.String FIELD_PROPERTY
          Literal text for the 'field' property.
static java.lang.String SCALE_PROPERTY
          Literal text for the 'scale' property.
 
Fields inherited from interface org.jfree.report.function.Expression
AUTOACTIVATE_PROPERTY
 
Constructor Summary
PaintDynamicComponentFunction()
          DefaultConstructor.
 
Method Summary
 java.lang.String getField()
          Returns the field used by the function.
 Expression getInstance()
          Return a completly separated copy of this function.
 float getScale()
          Gets the scale factor for the created image.
 java.lang.Object getValue()
          Return the current expression value.
 void groupFinished(ReportEvent event)
          Receives notification that a group has finished.
 void groupStarted(ReportEvent event)
          Receives notification that a group has started.
 void initialize()
          Initializes the function and tests that all required properties are set.
 void itemsAdvanced(ReportEvent event)
          Receives notification that a row of data is being processed.
 void pageCanceled(ReportEvent event)
          Receives notification that a page was canceled by the ReportProcessor.
 void pageFinished(ReportEvent event)
          Receives notification that a page has ended.
 void pageStarted(ReportEvent event)
          Receives notification that a page has started.
 void reportFinished(ReportEvent event)
          Receives notification that the report has finished.
 void reportInitialized(ReportEvent event)
          Receives notification that report generation initializes the current run.
 void reportStarted(ReportEvent event)
          Receives notification that the report has started.
 void setField(java.lang.String field)
          Sets the field name for the function.
 void setScale(float scale)
          Define a scale factor for the created image.
 
Methods inherited from class org.jfree.report.function.AbstractFunction
clone, getDataRow, getDependencyLevel, getName, getProperties, getProperty, getProperty, isActive, itemsFinished, itemsStarted, reportDone, setDataRow, setDependencyLevel, setName, setProperties, setProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_PROPERTY

public static final java.lang.String FIELD_PROPERTY
Literal text for the 'field' property.

See Also:
Constant Field Values

SCALE_PROPERTY

public static final java.lang.String SCALE_PROPERTY
Literal text for the 'scale' property.

See Also:
Constant Field Values
Constructor Detail

PaintDynamicComponentFunction

public PaintDynamicComponentFunction()
DefaultConstructor.

Method Detail

getField

public java.lang.String getField()
Returns the field used by the function.

The field name corresponds to a column name in the report's TableModel.

Returns:
The field name.

setField

public void setField(java.lang.String field)
Sets the field name for the function.

The field name corresponds to a column name in the report's TableModel.

Parameters:
field - the field name (null not permitted).

reportStarted

public void reportStarted(ReportEvent event)
Receives notification that the report has started.

Specified by:
reportStarted in interface ReportListener
Overrides:
reportStarted in class AbstractFunction
Parameters:
event - the event.

reportInitialized

public void reportInitialized(ReportEvent event)
Receives notification that report generation initializes the current run.

The event carries a ReportState.Started state. Use this to initialize the report.

Specified by:
reportInitialized in interface ReportListener
Overrides:
reportInitialized in class AbstractFunction
Parameters:
event - The event.

reportFinished

public void reportFinished(ReportEvent event)
Receives notification that the report has finished.

Specified by:
reportFinished in interface ReportListener
Overrides:
reportFinished in class AbstractFunction
Parameters:
event - the event.

pageStarted

public void pageStarted(ReportEvent event)
Receives notification that a page has started.

Specified by:
pageStarted in interface PageEventListener
Parameters:
event - the event.

pageFinished

public void pageFinished(ReportEvent event)
Receives notification that a page has ended.

Specified by:
pageFinished in interface PageEventListener
Parameters:
event - the event.

pageCanceled

public void pageCanceled(ReportEvent event)
Receives notification that a page was canceled by the ReportProcessor. This method is called, when a page was removed from the report after it was generated.

Specified by:
pageCanceled in interface PageEventListener
Parameters:
event - The event.

groupStarted

public void groupStarted(ReportEvent event)
Receives notification that a group has started.

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class AbstractFunction
Parameters:
event - the event.

groupFinished

public void groupFinished(ReportEvent event)
Receives notification that a group has finished.

Specified by:
groupFinished in interface ReportListener
Overrides:
groupFinished in class AbstractFunction
Parameters:
event - the event.

itemsAdvanced

public void itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed.

Specified by:
itemsAdvanced in interface ReportListener
Overrides:
itemsAdvanced in class AbstractFunction
Parameters:
event - the event.

getValue

public java.lang.Object getValue()
Return the current expression value.

The value depends (obviously) on the expression implementation.

Specified by:
getValue in interface Expression
Returns:
the value of the function.

setScale

public void setScale(float scale)
Define a scale factor for the created image. Using a higher scale factor will produce better results. A scale factor of 2 will double the resolution. A scale factor of 1 will create 72 dpi images.

Parameters:
scale - the scale factor.

getScale

public float getScale()
Gets the scale factor for the created image. Using a higher scale factor will produce better results. A scale factor of 2 will double the resolution. A scale factor of 1 will create 72 dpi images.

Returns:
the scale factor.

initialize

public void initialize()
                throws FunctionInitializeException
Initializes the function and tests that all required properties are set. If the required field property is not set, a FunctionInitializeException is thrown.

Specified by:
initialize in interface Expression
Overrides:
initialize in class AbstractFunction
Throws:
FunctionInitializeException - when no field is set.

getInstance

public Expression getInstance()
Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.

Specified by:
getInstance in interface Expression
Overrides:
getInstance in class AbstractFunction
Returns:
a copy of this function.