From 656c73c2e4138f110f1b08f60482ae66f8f843ef Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 7 Jan 2011 08:37:24 +0100 Subject: dba34c: #i108590# convert number to date --- .../pentaho/layoutprocessor/FormatValueUtility.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'reportbuilder') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index fc1baaa8c9a3..707c2de1c8ab 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -29,6 +29,7 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; +import java.math.BigDecimal; import java.sql.Time; @@ -46,7 +47,6 @@ import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil; - /** * Creation-Date: 06.06.2007, 17:03:30 * @@ -125,18 +125,31 @@ public class FormatValueUtility } else if (value instanceof java.sql.Date) { - if ( "float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + if ("float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); } else + { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + } } else if (value instanceof Date) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float"); variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); } + else if (value instanceof BigDecimal) + { + if ("date".equals(valueType)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); + } + } else if (value instanceof Number) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); -- cgit v1.2.3 From 1b46f8da574d7c3dfe469f91821f63f9017300bb Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Mon, 17 Jan 2011 12:32:14 +0100 Subject: dba34d: #i116463# fix string and NaN --- .../layoutprocessor/FormatValueUtility.java | 24 ++++++++++++++-------- .../layoutprocessor/TableCellLayoutController.java | 8 +++++--- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'reportbuilder') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index 707c2de1c8ab..76ee85b52aba 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -143,7 +143,7 @@ public class FormatValueUtility { if ("date".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal) value, false, 0))); } else { @@ -156,13 +156,21 @@ public class FormatValueUtility } else if (value instanceof Boolean) { - if (Boolean.TRUE.equals(value)) + if ("float".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + float fvalue = Boolean.TRUE.equals(value) ? 1 : 0; + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(fvalue)); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + if (Boolean.TRUE.equals(value)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + } } } else if (value != null) @@ -178,12 +186,10 @@ public class FormatValueUtility } if (!"string".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); + //variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } else { 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 f3c5ef383057..e575831ebf2a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -69,12 +69,12 @@ public class TableCellLayoutController extends SectionLayoutController { final AttributeMap attributeMap = new AttributeMap(super.computeAttributes(fc, element, target)); final String definedStyle = (String) attributeMap.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); - final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); attributeMap.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, getDisplayStyleName((Section) element, definedStyle)); try { - final DataFlags value = computeValue(); + final DataFlags value = computeValue(attributeMap); + final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); if (value != null) { FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); @@ -100,7 +100,7 @@ public class TableCellLayoutController extends SectionLayoutController return attributeMap; } - private DataFlags computeValue() throws DataSourceException + private DataFlags computeValue(final AttributeMap attributeMap) throws DataSourceException { // Search for the first FormattedTextElement final Section cell = (Section) getElement(); @@ -115,6 +115,8 @@ public class TableCellLayoutController extends SectionLayoutController final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc); if (Boolean.FALSE.equals(o)) { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE_TYPE, "string"); return null; } } -- cgit v1.2.3 From 55bed7a505dae776c8781c5aeca2f04d98469ab6 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 4 Apr 2011 13:05:38 +0200 Subject: masterfix DEV300: #i10000# build fix --- .../java/com/sun/star/report/function/metadata/makefile.mk | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'reportbuilder') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 9ba0c026c224..937114c4be35 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -49,21 +49,17 @@ JAVAFILES := AuthorFunction.java \ TitleFunctionDescription.java \ MetaDataFunctionCategory.java -# PROPERTYFILES := $(shell @$(FIND) . -name "*.properties") -PROPERTYFILES:=$(CLASSDIR)$/$(PACKAGE)$/category.properties \ +COPYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \ $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties\ $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties -L10NPROPERTYFILES = $(PROPERTYFILES) -ALLTAR : $(PROPERTYFILES) +ALLTAR : $(COPYFILES) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.IF "$(WITH_LANG)"=="" -$(CLASSDIR)/$(PACKAGE)/%.properties : %.properties - @@-$(MKDIRHIER) $(@:d) - $(COMMAND_ECHO)$(COPY) $< $@ -.ENDIF +$(COPYFILES): $$(@:f) + +$(COPY) $< $@ + -- cgit v1.2.3 From d36b7a5f861f5eac28a854a8e75c8299203859ce Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 4 Apr 2011 14:10:39 +0200 Subject: masterfix DEV300: #i10000# added mkdir --- reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'reportbuilder') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 937114c4be35..8694dec7c155 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -61,5 +61,6 @@ ALLTAR : $(COPYFILES) .INCLUDE : target.mk $(COPYFILES): $$(@:f) + +$(MKDIRHIER) $(CLASSDIR)$/$(PACKAGE) +$(COPY) $< $@ -- cgit v1.2.3