Class ElementLayoutController
- java.lang.Object
-
- org.jfree.report.flow.layoutprocessor.ElementLayoutController
-
- All Implemented Interfaces:
java.lang.Cloneable
,LayoutController
- Direct Known Subclasses:
AutoTableItemLayoutController
,AutoTableLayoutController
,ContentElementLayoutController
,SectionLayoutController
public abstract class ElementLayoutController extends java.lang.Object implements LayoutController
Creation-Date: 24.11.2006, 13:56:30- Author:
- Thomas Morgner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ElementLayoutController.ElementPrecomputeKey
-
Field Summary
Fields Modifier and Type Field Description static int
FINISHED
static int
FINISHING
static int
NOT_STARTED
static int
OPENED
static int
WAITING_FOR_JOIN
-
Constructor Summary
Constructors Modifier Constructor Description protected
ElementLayoutController()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description LayoutController
advance(ReportTarget target)
Advances the layout controller to the next state.java.lang.Object
clone()
Creates a copy of this layout controller.protected org.jfree.layouting.util.AttributeMap
computeAttributes(FlowController fc, Element element, ReportTarget target)
LayoutController
createPrecomputeInstance(FlowController fc)
Derives a copy of this controller that is suitable to perform a precomputation.protected LayoutController
finishElement(ReportTarget target)
Finishes the processing of this element.org.jfree.layouting.util.AttributeMap
getAttributeMap()
Element
getElement()
int
getExpressionsCount()
FlowController
getFlowController()
int
getIterationCount()
java.lang.Object
getNode()
LayoutController
getParent()
Retrieves the parent of this layout controller.int
getProcessingState()
protected FlowController
handleDefaultEndElement(ReportTarget target)
void
initialize(java.lang.Object node, FlowController flowController, LayoutController parent)
Initializes the layout controller.boolean
isAdvanceable()
Checks, whether the layout controller would be advanceable.boolean
isPrecomputing()
protected FlowController
performElementPrecomputation(Expression[] expressions, FlowController fc)
protected abstract LayoutController
processContent(ReportTarget target)
Processes any content in this element.void
setFlowController(FlowController flowController)
void
setParent(LayoutController parent)
void
setProcessingState(int processingState)
protected FlowController
startData(ReportTarget target, FlowController fc)
protected LayoutController
startElement(ReportTarget target)
This method is called for each newly instantiated layout controller.java.lang.String
toString()
protected FlowController
tryRepeatingCommit(FlowController fc)
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jfree.report.flow.layoutprocessor.LayoutController
join
-
-
-
-
Field Detail
-
NOT_STARTED
public static final int NOT_STARTED
- See Also:
- Constant Field Values
-
OPENED
public static final int OPENED
- See Also:
- Constant Field Values
-
WAITING_FOR_JOIN
public static final int WAITING_FOR_JOIN
- See Also:
- Constant Field Values
-
FINISHING
public static final int FINISHING
- See Also:
- Constant Field Values
-
FINISHED
public static final int FINISHED
- See Also:
- Constant Field Values
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getParent
public LayoutController getParent()
Retrieves the parent of this layout controller. This allows childs to query their context.- Specified by:
getParent
in interfaceLayoutController
- Returns:
- the layout controller's parent to
null
if there is no parent.
-
initialize
public void initialize(java.lang.Object node, FlowController flowController, LayoutController parent) throws DataSourceException, ReportDataFactoryException, ReportProcessingException
Initializes the layout controller. This method is called exactly once. It is the creators responsibility to call this method. Calling initialize after the first advance must result in a IllegalStateException.- Specified by:
initialize
in interfaceLayoutController
- Parameters:
node
- the currently processed object or layout node.flowController
- the current flow controller.parent
- the parent layout controller that was responsible for instantiating this controller.- Throws:
DataSourceException
- if there was a problem reading data from the datasource.ReportProcessingException
- if there was a general problem during the report processing.ReportDataFactoryException
- if a query failed.
-
advance
public final LayoutController advance(ReportTarget target) throws DataSourceException, ReportProcessingException, ReportDataFactoryException
Advances the layout controller to the next state. This method delegates the call to one of the following methods:- Specified by:
advance
in interfaceLayoutController
- Parameters:
target
- the report target that receives generated events.- Returns:
- the new layout controller instance representing the new state.
- Throws:
DataSourceException
- if there was a problem reading data from the datasource.ReportProcessingException
- if there was a general problem during the report processing.ReportDataFactoryException
- if a query failed.
-
startElement
protected LayoutController startElement(ReportTarget target) throws DataSourceException, ReportProcessingException, ReportDataFactoryException
This method is called for each newly instantiated layout controller. The returned layout controller instance should have a processing state of either 'OPEN' or 'FINISHING' depending on whether there is any content or any child nodes to process.- Parameters:
target
- the report target that receives generated events.- Returns:
- the new layout controller instance representing the new state.
- Throws:
DataSourceException
- if there was a problem reading data from the datasource.ReportProcessingException
- if there was a general problem during the report processing.ReportDataFactoryException
- if a query failed.
-
getAttributeMap
public org.jfree.layouting.util.AttributeMap getAttributeMap()
-
getExpressionsCount
public int getExpressionsCount()
-
getIterationCount
public int getIterationCount()
-
startData
protected FlowController startData(ReportTarget target, FlowController fc) throws DataSourceException, ReportProcessingException, ReportDataFactoryException
-
computeAttributes
protected org.jfree.layouting.util.AttributeMap computeAttributes(FlowController fc, Element element, ReportTarget target) throws DataSourceException
- Throws:
DataSourceException
-
processContent
protected abstract LayoutController processContent(ReportTarget target) throws DataSourceException, ReportProcessingException, ReportDataFactoryException
Processes any content in this element. This method is called when the processing state is 'OPENED'. The returned layout controller will retain the 'OPENED' state as long as there is more content available. Once all content has been processed, the returned layout controller should carry a 'FINISHED' state.- Parameters:
target
- the report target that receives generated events.- Returns:
- the new layout controller instance representing the new state.
- Throws:
DataSourceException
- if there was a problem reading data from the datasource.ReportProcessingException
- if there was a general problem during the report processing.ReportDataFactoryException
- if a query failed.
-
finishElement
protected LayoutController finishElement(ReportTarget target) throws ReportProcessingException, DataSourceException, ReportDataFactoryException
Finishes the processing of this element. This method is called when the processing state is 'FINISHING'. The element should be closed now and all privatly owned resources should be freed. If the element has a parent, it would be time to join up with the parent now, else the processing state should be set to 'FINISHED'.- Parameters:
target
- the report target that receives generated events.- Returns:
- the new layout controller instance representing the new state.
- Throws:
DataSourceException
- if there was a problem reading data from the datasource.ReportProcessingException
- if there was a general problem during the report processing.ReportDataFactoryException
- if there was an error trying query data.
-
handleDefaultEndElement
protected FlowController handleDefaultEndElement(ReportTarget target) throws ReportProcessingException, DataSourceException, ReportDataFactoryException
-
isAdvanceable
public boolean isAdvanceable()
Description copied from interface:LayoutController
Checks, whether the layout controller would be advanceable. If this method returns true, it is generally safe to call the 'advance()' method.- Specified by:
isAdvanceable
in interfaceLayoutController
- Returns:
- true, if the layout controller is advanceable, false otherwise.
-
getElement
public Element getElement()
-
getFlowController
public FlowController getFlowController()
- Specified by:
getFlowController
in interfaceLayoutController
-
getProcessingState
public int getProcessingState()
-
setProcessingState
public void setProcessingState(int processingState)
-
setFlowController
public void setFlowController(FlowController flowController)
-
setParent
public void setParent(LayoutController parent)
-
clone
public java.lang.Object clone()
Description copied from interface:LayoutController
Creates a copy of this layout controller.- Specified by:
clone
in interfaceLayoutController
- Overrides:
clone
in classjava.lang.Object
- Returns:
- a copy.
-
isPrecomputing
public boolean isPrecomputing()
-
performElementPrecomputation
protected FlowController performElementPrecomputation(Expression[] expressions, FlowController fc) throws ReportProcessingException, ReportDataFactoryException, DataSourceException
-
tryRepeatingCommit
protected FlowController tryRepeatingCommit(FlowController fc) throws DataSourceException
- Throws:
DataSourceException
-
createPrecomputeInstance
public LayoutController createPrecomputeInstance(FlowController fc)
Derives a copy of this controller that is suitable to perform a precomputation.- Specified by:
createPrecomputeInstance
in interfaceLayoutController
- Parameters:
fc
-- Returns:
-
getNode
public java.lang.Object getNode()
- Specified by:
getNode
in interfaceLayoutController
-
-