summaryrefslogtreecommitdiff
path: root/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-02-19 11:38:16 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2013-02-19 12:35:02 +0100
commit532421d208f21531d55554a356dd51105ba718bf (patch)
tree5a49f44ab94fb2efed4cd97350a23f81721b4688 /reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
parent818b84eb1573b55961cba56baca857806c0e8c8b (diff)
fdo#52948 fix print-repeated-values=no with formatted values
Factorise the "should this element be printed" decision into an utility function, which is used by 1) AbstractReportElementLayoutController (in charge of non-formatted values: string, image, OLE object, ...) which already obeyed PrintRepeatedValues. 2) TableCellLayoutController (in charge of formatted values: dates, numbers, ...) which blissfully ignored PrintRepeatedValues, but obeyed the display condition. Rename the inconsistently named PrintWhenGroupChange PrintWhenGroupChanges print-only-when-group-change print-when-group-change to PrintWhenGroupChange / print-when-group-change Change the meaning of "PrintWhenGroupChange" to "override PrintRepeatedValues in first occurrence in group". Since this feature never worked under the old semantics, no loss of feature. Since we change the XML attribute name, no ascending compatibility problem: it will be reset to its default value. Pursuant to the new meaning of PrintWhenGroupChange, change its default to *true*, which is the sane default. Change-Id: Idbe8e90565a354f70db222d047b3d51eeddbbb9f
Diffstat (limited to 'reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java')
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
index bb1af2f6644f..148909876471 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
@@ -27,6 +27,7 @@ import org.jfree.layouting.util.AttributeMap;
import org.jfree.report.DataFlags;
import org.jfree.report.DataSourceException;
import org.jfree.report.expressions.Expression;
+import org.jfree.report.expressions.FormulaExpression;
import org.jfree.report.flow.FlowController;
import org.jfree.report.flow.ReportTarget;
import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
@@ -34,6 +35,9 @@ import org.jfree.report.flow.layoutprocessor.SectionLayoutController;
import org.jfree.report.structure.Element;
import org.jfree.report.structure.Node;
import org.jfree.report.structure.Section;
+import org.pentaho.reporting.libraries.formula.Formula;
+import org.pentaho.reporting.libraries.formula.lvalues.LValue;
+import org.pentaho.reporting.libraries.formula.parser.ParseException;
import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
@@ -99,18 +103,36 @@ public class TableCellLayoutController extends SectionLayoutController
{
return null;
}
- final Expression dc = element.getDisplayCondition();
- if (dc != null)
+ if (!FormatValueUtility.shouldPrint(this, element))
{
- final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc);
- if (Boolean.FALSE.equals(o))
+ attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS,
+ FormatValueUtility.VALUE_TYPE, "string");
+ return null;
+ }
+ return FormatValueUtility.computeDataFlag(element, getFlowController());
+ }
+
+ public boolean isValueChanged()
+ {
+ try
+ {
+ final Section cell = (Section) getElement();
+ final FormattedTextElement element = findFormattedTextElement(cell);
+ if (element == null)
+ return false;
+ else
{
- attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS,
- FormatValueUtility.VALUE_TYPE, "string");
- return null;
+ final FormulaExpression formulaExpression = element.getValueExpression();
+ final Formula formula = formulaExpression.getCompiledFormula();
+ final LValue lValue = formula.getRootReference();
+ return FormatValueUtility.isReferenceChanged(this, lValue);
}
}
- return FormatValueUtility.computeDataFlag(element, getFlowController());
+ catch (final ParseException e)
+ {
+ //LOGGER.debug("Parse Exception", e);
+ return false;
+ }
}
private FormattedTextElement findFormattedTextElement(final Section section)