ar.com.fdvs.dj.core.layout
Class AbstractLayoutManager

java.lang.Object
  extended by ar.com.fdvs.dj.core.layout.AbstractLayoutManager
All Implemented Interfaces:
LayoutManager
Direct Known Subclasses:
ClassicLayoutManager, ListLayoutManager

public abstract class AbstractLayoutManager
extends java.lang.Object
implements LayoutManager

Abstract Class used as base for the different Layout Managers.

A Layout Manager is always invoked after the entities registration stage.
A subclass should be created whenever we want to give the users the chance to
easily apply global layout changes to their reports. Example: Ignore groups
and styles for an Excel optimized report.


Field Summary
protected static java.lang.String EXPRESSION_TRUE_WHEN_EVEN
           
protected static java.lang.String EXPRESSION_TRUE_WHEN_ODD
           
protected  java.util.List realGroups
          Holds the original groups binded to a column.
 
Constructor Summary
AbstractLayoutManager()
           
 
Method Summary
 void addStyleToDesign(Style style)
           
 void applyLayout(net.sf.jasperreports.engine.design.JasperDesign design, DynamicReport report)
          Entry point for applying a given layout.
 void applyStyleToElement(Style style, net.sf.jasperreports.engine.design.JRDesignElement designElemen)
          Given a dj-Style, it is applied to the jasper element.
protected  net.sf.jasperreports.engine.design.JRDesignChart createChart(DJChart djChart)
          Creates the JRDesignChart from the DJChart.
protected  net.sf.jasperreports.engine.design.JRDesignChart createChart(DJChart djChart, java.lang.String name)
          Creates the JRDesignChart from the DJChart.
protected  net.sf.jasperreports.engine.design.JRDesignBand createGroupForChartAndGetBand(DJChart djChart)
           
protected  net.sf.jasperreports.engine.design.JRDesignBand createGroupForChartAndGetBand(DJChart djChart)
           
protected  java.lang.String createUniqueStyleName()
           
protected  void endLayout()
           
protected  void ensureDJStyles()
          Sets a default style for every element that doesn't have one
protected  boolean existsGroupWithColumnNames()
          Returns true if at least one group is configured to show the column name in its header
protected  void generateHeaderBand(net.sf.jasperreports.engine.design.JRDesignBand band)
          MOVED INSIDE ExpressionUtils protected JRDesignExpression getExpressionForConditionalStyle(ConditionalStyle condition, AbstractColumn column) { //String text = "(("+CustomExpression.class.getName()+")$P{"+paramName+"})."+CustomExpression.EVAL_METHOD_NAME+"("+textForExpression+")"; String columExpression = column.getTextForExpression(); //condition.getCondition().setFieldToEvaluate(exprParams) // PeS17 patch, 2008-11-29: put all fields to fields map, including "invisible" i.e.
protected  net.sf.jasperreports.engine.design.JRDesignTextField generateTextFieldFromColumn(AbstractColumn col, int height, DJGroup group)
          Creates a JasperReport DesignTextField from a DynamicJasper AbstractColumn.
protected  net.sf.jasperreports.engine.design.JRDesignGroup getChartColumnsGroup(DJChart djChart)
           
protected  net.sf.jasperreports.engine.design.JasperDesign getDesign()
           
protected  DJGroup getDJGroup(AbstractColumn col)
           
protected  net.sf.jasperreports.engine.design.JRDesignGroup getJRGroupFromDJGroup(DJGroup group)
          Finds JRDesignGroup associated to a DJGroup
protected  net.sf.jasperreports.engine.design.JRDesignGroup getParent(net.sf.jasperreports.engine.design.JRDesignGroup group)
          Finds the parent group of the given one and returns it
protected  DynamicReport getReport()
           
 java.util.HashMap getReportStyles()
           
protected  java.util.List getVisibleColumns()
           
protected  void interpeterOptions(DJChart djChart, net.sf.jasperreports.engine.design.JRDesignChart chart)
           
protected  void layoutCharts()
           
protected  net.sf.jasperreports.engine.design.JRDesignConditionalStyle makeConditionalStyle(Style style)
           
protected  java.util.List registerChartVariable(DJChart chart)
          Creates and registers a variable to be used by the Chart
protected  java.util.Map registerChartVariable(DJChart chart)
          Creates and registers a variable to be used by the Chart
protected  void registerRemainingStyles()
           
protected  void setBandFinalHeight(net.sf.jasperreports.engine.design.JRDesignBand band)
          Sets the band's height to hold all its children
protected  void setBandsFinalHeight()
          Sets the necessary height for all bands in the report, to hold their children
protected  void setColumnsFinalWidth()
          Sets the columns width by reading some report options like the printableArea and useFullPageWidth.
protected  void setDesign(net.sf.jasperreports.engine.design.JasperDesign design)
           
protected  void setReport(DynamicReport report)
           
 void setReportStyles(java.util.HashMap reportStyles)
           
protected  void setWhenNoDataBand()
          Creates the graphic element to be shown when the datasource is empty
protected  void startLayout()
           
protected  void transformDetailBand()
          For each column, puts the elements in the detail band
protected abstract  void transformDetailBandTextField(AbstractColumn column, net.sf.jasperreports.engine.design.JRDesignTextField textField)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ar.com.fdvs.dj.core.layout.LayoutManager
getReferencesMap
 

Field Detail

EXPRESSION_TRUE_WHEN_ODD

protected static final java.lang.String EXPRESSION_TRUE_WHEN_ODD
See Also:
Constant Field Values

EXPRESSION_TRUE_WHEN_EVEN

protected static final java.lang.String EXPRESSION_TRUE_WHEN_EVEN
See Also:
Constant Field Values

realGroups

protected java.util.List realGroups
Holds the original groups binded to a column. Needed for later reference List

Constructor Detail

AbstractLayoutManager

public AbstractLayoutManager()
Method Detail

transformDetailBandTextField

protected abstract void transformDetailBandTextField(AbstractColumn column,
                                                     net.sf.jasperreports.engine.design.JRDesignTextField textField)

getReportStyles

public java.util.HashMap getReportStyles()

setReportStyles

public void setReportStyles(java.util.HashMap reportStyles)

applyLayout

public void applyLayout(net.sf.jasperreports.engine.design.JasperDesign design,
                        DynamicReport report)
                 throws LayoutException
Description copied from interface: LayoutManager
Entry point for applying a given layout.

Specified by:
applyLayout in interface LayoutManager
Parameters:
design - The deseign to be used
report - The report to show
Throws:
LayoutException

setWhenNoDataBand

protected void setWhenNoDataBand()
Creates the graphic element to be shown when the datasource is empty


startLayout

protected void startLayout()

endLayout

protected void endLayout()

registerRemainingStyles

protected void registerRemainingStyles()

ensureDJStyles

protected void ensureDJStyles()
Sets a default style for every element that doesn't have one

Throws:
net.sf.jasperreports.engine.JRException

addStyleToDesign

public void addStyleToDesign(Style style)
Parameters:
baseStyle -
Throws:
net.sf.jasperreports.engine.JRException

createUniqueStyleName

protected java.lang.String createUniqueStyleName()

transformDetailBand

protected void transformDetailBand()
For each column, puts the elements in the detail band


generateHeaderBand

protected void generateHeaderBand(net.sf.jasperreports.engine.design.JRDesignBand band)
MOVED INSIDE ExpressionUtils protected JRDesignExpression getExpressionForConditionalStyle(ConditionalStyle condition, AbstractColumn column) { //String text = "(("+CustomExpression.class.getName()+")$P{"+paramName+"})."+CustomExpression.EVAL_METHOD_NAME+"("+textForExpression+")"; String columExpression = column.getTextForExpression(); //condition.getCondition().setFieldToEvaluate(exprParams) // PeS17 patch, 2008-11-29: put all fields to fields map, including "invisible" i.e. only registered ones String fieldsMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentFiels()"; String parametersMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentParams()"; String variablesMap = "(("+DJDefaultScriptlet.class.getName() + ")$P{REPORT_SCRIPTLET}).getCurrentVariables()"; String evalMethodParams = fieldsMap +", " + variablesMap + ", " + parametersMap + ", " + columExpression; String text = "(("+ConditionStyleExpression.class.getName()+")$P{"+condition.getName()+"})."+CustomExpression.EVAL_METHOD_NAME+"("+evalMethodParams+")"; JRDesignExpression expression = new JRDesignExpression(); expression.setValueClass(Boolean.class); expression.setText(text); return expression; }


applyStyleToElement

public void applyStyleToElement(Style style,
                                net.sf.jasperreports.engine.design.JRDesignElement designElemen)
Given a dj-Style, it is applied to the jasper element. If the style is being used by the first time, it is registered in the jasper-design, if it is the second time, the one created before is used (cached one)

Parameters:
style -
designElemen -

setColumnsFinalWidth

protected void setColumnsFinalWidth()
Sets the columns width by reading some report options like the printableArea and useFullPageWidth. columns with fixedWidth property set in TRUE will not be modified


getVisibleColumns

protected java.util.List getVisibleColumns()
Returns:

setBandsFinalHeight

protected void setBandsFinalHeight()
Sets the necessary height for all bands in the report, to hold their children


setBandFinalHeight

protected void setBandFinalHeight(net.sf.jasperreports.engine.design.JRDesignBand band)
Sets the band's height to hold all its children

Parameters:
band - Band to be resized

generateTextFieldFromColumn

protected net.sf.jasperreports.engine.design.JRDesignTextField generateTextFieldFromColumn(AbstractColumn col,
                                                                                           int height,
                                                                                           DJGroup group)
Creates a JasperReport DesignTextField from a DynamicJasper AbstractColumn.

Parameters:
AbstractColumn - col
int - height
DJGroup - group
Returns:
JRDesignTextField

makeConditionalStyle

protected net.sf.jasperreports.engine.design.JRDesignConditionalStyle makeConditionalStyle(Style style)

layoutCharts

protected void layoutCharts()

createGroupForChartAndGetBand

protected net.sf.jasperreports.engine.design.JRDesignBand createGroupForChartAndGetBand(DJChart djChart)

createChart

protected net.sf.jasperreports.engine.design.JRDesignChart createChart(DJChart djChart)
Creates the JRDesignChart from the DJChart. To do so it also creates needed variables and data-set

Parameters:
djChart -
Returns:

interpeterOptions

protected void interpeterOptions(DJChart djChart,
                                 net.sf.jasperreports.engine.design.JRDesignChart chart)

registerChartVariable

protected java.util.List registerChartVariable(DJChart chart)
Creates and registers a variable to be used by the Chart

Parameters:
chart - Chart that needs a variable to be generated
Returns:
the generated variables

getChartColumnsGroup

protected net.sf.jasperreports.engine.design.JRDesignGroup getChartColumnsGroup(DJChart djChart)

createGroupForChartAndGetBand

protected net.sf.jasperreports.engine.design.JRDesignBand createGroupForChartAndGetBand(DJChart djChart)

createChart

protected net.sf.jasperreports.engine.design.JRDesignChart createChart(DJChart djChart,
                                                                       java.lang.String name)
Creates the JRDesignChart from the DJChart. To do so it also creates needed variables and data-set

Parameters:
djChart -
Returns:

registerChartVariable

protected java.util.Map registerChartVariable(DJChart chart)
Creates and registers a variable to be used by the Chart

Parameters:
chart - Chart that needs a variable to be generated
Returns:
the generated variables

getParent

protected net.sf.jasperreports.engine.design.JRDesignGroup getParent(net.sf.jasperreports.engine.design.JRDesignGroup group)
Finds the parent group of the given one and returns it

Parameters:
group - Group for which the parent is needed
Returns:
The parent group of the given one. If the given one is the first one, it returns the same group

getJRGroupFromDJGroup

protected net.sf.jasperreports.engine.design.JRDesignGroup getJRGroupFromDJGroup(DJGroup group)
Finds JRDesignGroup associated to a DJGroup

Parameters:
group -
Returns:

getDJGroup

protected DJGroup getDJGroup(AbstractColumn col)

existsGroupWithColumnNames

protected boolean existsGroupWithColumnNames()
Returns true if at least one group is configured to show the column name in its header

Parameters:
groups -
Returns:

getDesign

protected net.sf.jasperreports.engine.design.JasperDesign getDesign()

setDesign

protected void setDesign(net.sf.jasperreports.engine.design.JasperDesign design)

getReport

protected DynamicReport getReport()

setReport

protected void setReport(DynamicReport report)


Copyright © 2006-2011 FDV Solutions. All Rights Reserved.