dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09306
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2428: Removed the proprietary Arial true type font and replaced with the nice Ubuntu font for PDF writi...
------------------------------------------------------------
revno: 2428
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-12-26 22:40:52 +0100
message:
Removed the proprietary Arial true type font and replaced with the nice Ubuntu font for PDF writing. Cleaned up the PDF writing code.
removed:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ExtendedDataElementConverter.java
dhis-2/dhis-support/dhis-support-system/src/main/resources/arial.ttf
added:
dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-bold.ttf
dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-font-licence-1.0.txt
dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-italic.ttf
dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu.ttf
modified:
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserPdfService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitHierarchyConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/synchronous/ExportPivotViewService.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/util/XsltUtils.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserPdfService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserPdfService.java 2010-10-21 06:21:39 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserPdfService.java 2010-12-26 21:40:52 +0000
@@ -29,13 +29,8 @@
import static org.hisp.dhis.system.util.PDFUtils.addTableToDocument;
import static org.hisp.dhis.system.util.PDFUtils.closeDocument;
-import static org.hisp.dhis.system.util.PDFUtils.getHeader5Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getHeader6Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getHeader7Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getText5Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getText6Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getText7Cell;
-import static org.hisp.dhis.system.util.PDFUtils.getTrueTypeFontByDimension;
+import static org.hisp.dhis.system.util.PDFUtils.getHeaderCell;
+import static org.hisp.dhis.system.util.PDFUtils.getTextCell;
import static org.hisp.dhis.system.util.PDFUtils.openDocument;
import java.awt.Color;
@@ -45,6 +40,7 @@
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.system.util.DateUtils;
+import org.hisp.dhis.system.util.PDFUtils;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
@@ -54,7 +50,6 @@
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
@@ -65,24 +60,6 @@
public class DefaultDataBrowserPdfService
implements DataBrowserPdfService
{
- private static BaseFont bf;
-
- private Font titleFont;
-
- private Font periodFont;
-
- private Font header5Font;
-
- private Font header6Font;
-
- private Font header7Font;
-
- private Font text5Font;
-
- private Font text6Font;
-
- private Font text7Font;
-
private static final Color headColor = new Color( 0xC0D9D9 ); // Blueish
private static final Color parColor = new Color( 0xDDDDDD ); // Greyish
@@ -103,7 +80,6 @@
try
{
- this.initFont();
Document document;
// DataBrowser table
@@ -154,8 +130,7 @@
String dataBrowserToDate, String dataBrowserPeriodType, I18n i18n )
throws DocumentException
{
- Paragraph titleParagraph = new Paragraph( i18n.getString( "export_results_for" ) + " " + dataBrowserTitleName,
- titleFont );
+ Paragraph titleParagraph = new Paragraph( i18n.getString( "export_results_for" ) + " " + dataBrowserTitleName, PDFUtils.getBoldFont( 12 ) );
String fromDate = dataBrowserFromDate;
if ( dataBrowserFromDate.length() == 0 )
@@ -171,7 +146,7 @@
Paragraph periodParagraph = new Paragraph( i18n.getString( "from_date" ) + ": " + fromDate + " "
+ i18n.getString( "to_date" ) + ": " + toDate + ", " + i18n.getString( "period_type" ) + ": "
- + i18n.getString( dataBrowserPeriodType ), periodFont );
+ + i18n.getString( dataBrowserPeriodType ), PDFUtils.getFont( 8 ) );
if ( i18n != null )
{
@@ -261,22 +236,7 @@
private PdfPCell createHeaderCell( String columnName, int fontSize, Color color )
{
- PdfPCell cell;
-
- // Set font size for header cell
- if ( fontSize == 4 )
- {
- cell = new PdfPCell( getHeader7Cell( columnName, 1, header7Font ) );
- }
- else if ( fontSize == 6 )
- {
- cell = new PdfPCell( getHeader6Cell( columnName, 1, header6Font ) );
- }
- else
- // Default is 8
- {
- cell = new PdfPCell( getHeader5Cell( columnName, 1, header5Font ) );
- }
+ PdfPCell cell = getHeaderCell( columnName, 1 );
cell.setMinimumHeight( fontSize );
cell.setBorder( Rectangle.BOX );
@@ -287,22 +247,7 @@
private PdfPCell createTextCell( String columnName, int fontSize, Color color )
{
- PdfPCell cell;
-
- // Set font size for header cell
- if ( fontSize == 4 )
- {
- cell = new PdfPCell( getText7Cell( columnName, text7Font ) );
- }
- else if ( fontSize == 6 )
- {
- cell = new PdfPCell( getText6Cell( columnName, text6Font ) );
- }
- else
- // Default is 8
- {
- cell = new PdfPCell( getText5Cell( columnName, text5Font ) );
- }
+ PdfPCell cell = getTextCell( columnName );
cell.setMinimumHeight( fontSize );
cell.setBorder( Rectangle.BOX );
@@ -324,19 +269,4 @@
}
table.setWidths( widths );
}
-
- private void initFont()
- {
- bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
-
- titleFont = new Font( bf, 16, Font.HELVETICA );
- periodFont = new Font( bf, 8, Font.HELVETICA );
- header5Font = new Font( bf, 8, Font.BOLD );
- header6Font = new Font( bf, 6, Font.BOLD );
- header7Font = new Font( bf, 4, Font.BOLD );
- text5Font = new Font( bf, 8, Font.NORMAL );
- text6Font = new Font( bf, 6, Font.NORMAL );
- text7Font = new Font( bf, 4, Font.NORMAL );
- }
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java 2010-12-26 21:40:52 +0000
@@ -75,14 +75,9 @@
List<DataElement> elements = new ArrayList<DataElement>( dataElementService.getDataElements( params.getDataElements() ) );
Collections.sort( elements, new DataElementNameComparator() );
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font ITALIC = new Font( bf, 9, Font.ITALIC );
- Font HEADER3 = new Font( bf, 12, Font.BOLD );
-
for ( DataElement element : elements )
{
- addTableToDocument( document, printDataElement( element, i18n, HEADER3, ITALIC, TEXT, true, 0.40f, 0.60f ) );
+ addTableToDocument( document, printDataElement( element, i18n, true, 0.40f, 0.60f ) );
}
}
}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ExtendedDataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ExtendedDataElementConverter.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ExtendedDataElementConverter.java 1970-01-01 00:00:00 +0000
@@ -1,242 +0,0 @@
-package org.hisp.dhis.importexport.pdf.converter;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.PDFConverter;
-import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.PDFUtils;
-
-import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.pdf.PdfPTable;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: ExtendedDataElementConverter.java 4646 2008-02-26 14:54:29Z
- * larshelg $
- * @modifier Dang Duy Hieu
- * @since 2010-05-19
- */
-public class ExtendedDataElementConverter
- extends PDFUtils
- implements PDFConverter
-{
- private DataElementService dataElementService;
-
- public ExtendedDataElementConverter( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- // -------------------------------------------------------------------------
- // PDFConverter implementation
- // -------------------------------------------------------------------------
-
- public void write( Document document, ExportParams params )
- {
- I18n i18n = params.getI18n();
- I18nFormat format = params.getFormat();
-
- PDFUtils.printObjectFrontPage( document, params.getDataElements(), i18n, format, "data_elments" );
-
- Collection<DataElement> elements = dataElementService.getDataElements( params.getDataElements() );
-
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font ITALIC = new Font( bf, 9, Font.ITALIC );
- Font HEADER3 = new Font( bf, 12, Font.BOLD );
- Font HEADER4 = new Font( bf, 9, Font.BOLD );
-
- for ( DataElement element : elements )
- {
- PdfPTable table = getPdfPTable( true, 0.40f, 0.60f );
-
- table.addCell( getHeader3Cell( element.getName(), 2, HEADER3 ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- // -------------------------------------------------------------------------
- // Identifying and definitional attributes
- // -------------------------------------------------------------------------
-
- table.addCell( getHeader4Cell( i18n.getString( "identifying_and_definitional_attributes" ), 2, HEADER4 ) );
-
- table.addCell( getCell( 2, 8 ) );
-
- table.addCell( getItalicCell( i18n.getString( "short_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getShortName(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "alternative_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getAlternativeName(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "code" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getCode(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "description" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getDescription(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "active" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( String.valueOf( element.isActive() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "type" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( element.getType() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "aggregation_operator" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( element.getAggregationOperator() ) ) );
-
- if ( element.getExtended() != null )
- {
- table.addCell( getItalicCell( i18n.getString( "mnemonic" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getMnemonic(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "version" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getVersion(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "context" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getContext(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "synonyms" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getSynonyms(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "hononyms" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getHononyms(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "keywords" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getKeywords(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "status" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getStatus(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "status_date" ), 1, ITALIC ) );
- table.addCell( getTextCell( DateUtils.getMediumDateString( element.getExtended().getStatusDate() ) ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- // -------------------------------------------------------------------------
- // Relational and representational attributes
- // -------------------------------------------------------------------------
-
- table.addCell( getHeader4Cell( i18n.getString( "relational_and_representational_attributes" ), 2,
- HEADER4 ) );
-
- table.addCell( getCell( 2, 8 ) );
-
- table.addCell( getItalicCell( i18n.getString( "data_type" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getDataType(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "representational_form" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getRepresentationalForm(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "representational_layout" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getRepresentationalLayout(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "minimum_size" ), 1, ITALIC ) );
- table.addCell( getTextCell( String.valueOf( element.getExtended().getMinimumSize() ) ) );
-
- table.addCell( getItalicCell( i18n.getString( "maximum_size" ), 1, ITALIC ) );
- table.addCell( getTextCell( String.valueOf( element.getExtended().getMaximumSize() ) ) );
-
- table.addCell( getItalicCell( i18n.getString( "data_domain" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getDataDomain(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "validation_rules" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getValidationRules(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "related_data_references" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getRelatedDataReferences(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "guide_for_use" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getGuideForUse(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "collection_methods" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getCollectionMethods(), TEXT ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- // -------------------------------------------------------------------------
- // Administrative attributes
- // -------------------------------------------------------------------------
-
- table.addCell( getHeader4Cell( i18n.getString( "administrative_attributes" ), 2, HEADER4 ) );
-
- table.addCell( getCell( 2, 8 ) );
-
- table.addCell( getItalicCell( i18n.getString( "responsible_authority" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getResponsibleAuthority(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "update_rules" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getUpdateRules(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "access_authority" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getAccessAuthority(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "update_frequency" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getUpdateFrequency(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "location" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getLocation(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "reporting_methods" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getReportingMethods(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "version_status" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getVersionStatus(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "previous_version_references" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getPreviousVersionReferences(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "source_document" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getSourceDocument(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "source_organisation" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getSourceOrganisation(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "comment" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getExtended().getComment(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "saved" ), 1, ITALIC ) );
- table.addCell( getTextCell( DateUtils.getMediumDateString( element.getExtended().getSaved() ) ) );
-
- table.addCell( getItalicCell( i18n.getString( "last_updated" ), 1, ITALIC ) );
- table.addCell( getTextCell( DateUtils.getMediumDateString( element.getExtended().getLastUpdated() ) ) );
- }
-
- table.addCell( getCell( 2, 30 ) );
-
- addTableToDocument( document, table );
- }
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java 2010-12-26 21:40:52 +0000
@@ -42,8 +42,6 @@
import org.hisp.dhis.system.util.PDFUtils;
import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
/**
* @author Lars Helge Overland
@@ -79,15 +77,9 @@
List<Indicator> indicators = new ArrayList<Indicator>( indicatorService.getIndicators( params.getIndicators() ) );
Collections.sort( indicators, new IndicatorNameComparator() );
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font ITALIC = new Font( bf, 9, Font.ITALIC );
- Font HEADER3 = new Font( bf, 12, Font.BOLD );
-
for ( Indicator indicator : indicators )
{
- addTableToDocument( document, printIndicator( indicator, i18n, expressionService, HEADER3, ITALIC, TEXT,
- true, 0.40f, 0.60f ) );
+ addTableToDocument( document, printIndicator( indicator, i18n, expressionService, true, 0.40f, 0.60f ) );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitConverter.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitConverter.java 2010-12-26 21:40:52 +0000
@@ -41,8 +41,6 @@
import org.hisp.dhis.system.util.PDFUtils;
import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
/**
* @author Lars Helge Overland
@@ -76,14 +74,9 @@
List<OrganisationUnit> units = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnits( params.getOrganisationUnits() ) );
Collections.sort( units, new OrganisationUnitNameComparator() );
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
- Font ITALIC = new Font( bf, 9, Font.ITALIC );
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font HEADER3 = new Font( bf, 12, Font.BOLD );
-
for ( OrganisationUnit unit : units )
{
- addTableToDocument( document, printOrganisationUnit( unit, i18n, format, HEADER3, ITALIC, TEXT, true, 0.40f, 0.60f ) );
+ addTableToDocument( document, printOrganisationUnit( unit, i18n, format, true, 0.40f, 0.60f ) );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitHierarchyConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitHierarchyConverter.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/OrganisationUnitHierarchyConverter.java 2010-12-26 21:40:52 +0000
@@ -39,8 +39,6 @@
import org.hisp.dhis.system.util.PDFUtils;
import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPTable;
/**
@@ -76,8 +74,6 @@
if ( params.getOrganisationUnits() != null && params.getOrganisationUnits().size() > 0 )
{
- Font TEXT = new Font( getTrueTypeFontByDimension( BaseFont.IDENTITY_H ), 9, Font.NORMAL );
-
Collection<OrganisationUnit> hierarchy = getHierarchy();
PdfPTable table = getPdfPTable( false, 0.100f );
@@ -86,7 +82,7 @@
{
String indent = getIndent( unit.getLevel() );
- table.addCell( getTextCell( indent + unit.getName(), TEXT ) );
+ table.addCell( getTextCell( indent + unit.getName() ) );
}
addTableToDocument( document, table );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java 2010-12-09 06:25:37 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java 2010-12-26 21:40:52 +0000
@@ -42,8 +42,6 @@
import org.hisp.dhis.validation.comparator.ValidationRuleNameComparator;
import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
/**
* @author Dang Duy Hieu
@@ -80,15 +78,9 @@
List<ValidationRule> validationRules = new ArrayList<ValidationRule>( validationRuleService.getValidationRules( params.getValidationRules() ) );
Collections.sort( validationRules, new ValidationRuleNameComparator() );
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font ITALIC = new Font( bf, 9, Font.ITALIC );
- Font HEADER3 = new Font( bf, 12, Font.BOLD );
-
for ( ValidationRule rule : validationRules )
{
- addTableToDocument( document, printValidationRule( rule, i18n, expressionService, HEADER3, ITALIC, TEXT,
- true, 0.40f, 0.60f ) );
+ addTableToDocument( document, printValidationRule( rule, i18n, expressionService, true, 0.40f, 0.60f ) );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java 2010-12-26 21:40:52 +0000
@@ -41,7 +41,6 @@
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.ExportService;
import org.hisp.dhis.importexport.pdf.converter.DataElementConverter;
-import org.hisp.dhis.importexport.pdf.converter.ExtendedDataElementConverter;
import org.hisp.dhis.importexport.pdf.converter.IndicatorConverter;
import org.hisp.dhis.importexport.pdf.converter.OrganisationUnitConverter;
import org.hisp.dhis.importexport.pdf.converter.OrganisationUnitHierarchyConverter;
@@ -132,7 +131,6 @@
thread.setDataElementConverter( new DataElementConverter( dataElementService ) );
thread.setIndicatorConverter( new IndicatorConverter( indicatorService, expressionService ) );
- thread.setExtendedDataElementConverter( new ExtendedDataElementConverter( dataElementService ) );
thread.setOrganisationUnitHierarchyConverter( new OrganisationUnitHierarchyConverter(
organisationUnitService ) );
thread.setOrganisationUnitConverter( new OrganisationUnitConverter( organisationUnitService ) );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/synchronous/ExportPivotViewService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/synchronous/ExportPivotViewService.java 2010-12-22 11:09:05 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/synchronous/ExportPivotViewService.java 2010-12-26 21:40:52 +0000
@@ -1,11 +1,32 @@
+package org.hisp.dhis.importexport.synchronous;
+
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package org.hisp.dhis.importexport.synchronous;
-
-
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
@@ -13,11 +34,11 @@
import java.io.Writer;
import java.util.Collection;
import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.aggregation.AggregatedDataValue;
import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.aggregation.AggregatedDataValueStore;
import org.hisp.dhis.aggregation.AggregatedDataValueStoreIterator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -34,7 +55,6 @@
*
* @author bobj
*/
-
public class ExportPivotViewService {
private static final Log log = LogFactory.getLog( ExportPivotViewService.class );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/util/XsltUtils.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/util/XsltUtils.java 2010-10-29 08:56:13 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/util/XsltUtils.java 2010-12-26 21:40:52 +0000
@@ -38,7 +38,6 @@
import org.hisp.dhis.DhisTest;
import org.hisp.dhis.external.location.LocationManager;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java 2010-12-26 16:55:25 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java 2010-12-26 21:40:52 +0000
@@ -27,15 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.PDFUtils.ALIGN_CENTER;
import static org.hisp.dhis.system.util.PDFUtils.addTableToDocument;
import static org.hisp.dhis.system.util.PDFUtils.closeDocument;
-import static org.hisp.dhis.system.util.PDFUtils.getCell;
-import static org.hisp.dhis.system.util.PDFUtils.getHeader3Cell;
+import static org.hisp.dhis.system.util.PDFUtils.getEmptyCell;
import static org.hisp.dhis.system.util.PDFUtils.getItalicCell;
import static org.hisp.dhis.system.util.PDFUtils.getPdfPTable;
+import static org.hisp.dhis.system.util.PDFUtils.getSubtitleCell;
import static org.hisp.dhis.system.util.PDFUtils.getTextCell;
-import static org.hisp.dhis.system.util.PDFUtils.getTrueTypeFontByDimension;
+import static org.hisp.dhis.system.util.PDFUtils.getTitleCell;
import static org.hisp.dhis.system.util.PDFUtils.openDocument;
import java.io.OutputStream;
@@ -54,8 +53,6 @@
import org.springframework.transaction.annotation.Transactional;
import com.lowagie.text.Document;
-import com.lowagie.text.Font;
-import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPTable;
/**
@@ -69,25 +66,12 @@
implements PdfService
{
// -------------------------------------------------------------------------
- // Variables
- // -------------------------------------------------------------------------
-
- private static BaseFont bf;
-
- private static Font TEXT;
-
- private static Font ITALIC;
-
- private static Font HEADER3;
-
- // -------------------------------------------------------------------------
// PdfService implementation
// -------------------------------------------------------------------------
public void writeDataSetCompletenessResult( Collection<DataSetCompletenessResult> results, OutputStream out,
I18n i18n, OrganisationUnit unit, DataSet dataSet )
{
- initFont();
Document document = openDocument( out );
PdfPTable table = getPdfPTable( true, 0.501f, 0.10f, 0.10f, 0.10f, 0.10f, 0.10f );
@@ -96,30 +80,30 @@
String dataSetName = dataSet != null ? " - " + dataSet.getName() : "";
- table.addCell( getHeader3Cell( i18n.getString( "data_completeness_report" ) + " - " + unit.getName()
- + dataSetName, 6, HEADER3 ) );
-
- table.addCell( getCell( 6, 8 ) );
-
- table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - "
- + DateUtils.getMediumDateString(), 6, TEXT ) );
-
- table.addCell( getCell( 6, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "name" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "actual" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "target" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "percent" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "on_time" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "percent" ), 1, ITALIC ) );
-
- table.addCell( getCell( 6, 8 ) );
+ table.addCell( getTitleCell( i18n.getString( "data_completeness_report" ) + " - " + unit.getName()
+ + dataSetName, 6 ) );
+
+ table.addCell( getEmptyCell( 6, 10 ) );
+
+ table.addCell( getSubtitleCell( i18n.getString( "district_health_information_software" ) + " - "
+ + DateUtils.getMediumDateString(), 6 ) );
+
+ table.addCell( getEmptyCell( 6, 25 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "name" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "actual" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "target" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "percent" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "on_time" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "percent" ) ) );
+
+ table.addCell( getEmptyCell( 6, 8 ) );
if ( results != null )
{
for ( DataSetCompletenessResult result : results )
{
- table.addCell( getTextCell( result.getName(), TEXT ) );
+ table.addCell( getTextCell( result.getName() ) );
table.addCell( getTextCell( String.valueOf( result.getRegistrations() ) ) );
table.addCell( getTextCell( String.valueOf( result.getSources() ) ) );
table.addCell( getTextCell( String.valueOf( result.getPercentage() ) ) );
@@ -135,31 +119,30 @@
public void writeValidationResult( List<ValidationResult> results, OutputStream out, I18n i18n, I18nFormat format )
{
- initFont();
Document document = openDocument( out );
PdfPTable table = getPdfPTable( true, 0.19f, 0.13f, 0.21f, 0.07f, 0.12f, 0.07f, 0.21f );
table.setHeaderRows( 0 );
- table.addCell( getHeader3Cell( i18n.getString( "data_quality_report" ), 7, HEADER3 ) );
-
- table.addCell( getCell( 7, 8 ) );
-
- table.addCell( getTextCell( i18n.getString( "district_health_information_software" ) + " - "
- + format.parseDate( DateUtils.getMediumDateString() ), 7, TEXT ) );
-
- table.addCell( getCell( 7, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "source" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "period" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "left_side_description" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "value" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "operator" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "value" ), 1, ITALIC ) );
- table.addCell( getItalicCell( i18n.getString( "right_side_description" ), 1, ITALIC ) );
-
- table.addCell( getCell( 7, 8 ) );
+ table.addCell( getTitleCell( i18n.getString( "data_quality_report" ), 7 ) );
+
+ table.addCell( getEmptyCell( 7, 10 ) );
+
+ table.addCell( getSubtitleCell( i18n.getString( "district_health_information_software" ) + " - "
+ + format.parseDate( DateUtils.getMediumDateString() ), 7) );
+
+ table.addCell( getEmptyCell( 7, 25 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "source" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "period" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "left_side_description" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "value" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "operator" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "value" ) ) );
+ table.addCell( getItalicCell( i18n.getString( "right_side_description" ) ) );
+
+ table.addCell( getEmptyCell( 7, 8 ) );
if ( results != null )
{
@@ -169,16 +152,13 @@
Period period = validationResult.getPeriod();
- table.addCell( getTextCell( unit.getName(), TEXT ) );
- table.addCell( getTextCell( format.formatPeriod( period ), TEXT ) );
- table
- .addCell( getTextCell( validationResult.getValidationRule().getLeftSide().getDescription(), TEXT ) );
+ table.addCell( getTextCell( unit.getName() ) );
+ table.addCell( getTextCell( format.formatPeriod( period ) ) );
+ table.addCell( getTextCell( validationResult.getValidationRule().getLeftSide().getDescription() ) );
table.addCell( getTextCell( String.valueOf( validationResult.getLeftsideValue() ) ) );
- table.addCell( getTextCell( i18n.getString( validationResult.getValidationRule().getOperator() ), 1,
- ALIGN_CENTER ) );
+ table.addCell( getTextCell( i18n.getString( validationResult.getValidationRule().getOperator() ) ) );
table.addCell( getTextCell( String.valueOf( validationResult.getRightsideValue() ) ) );
- table
- .addCell( getTextCell( validationResult.getValidationRule().getRightSide().getDescription(), TEXT ) );
+ table.addCell( getTextCell( validationResult.getValidationRule().getRightSide().getDescription() ) );
}
}
@@ -186,18 +166,4 @@
closeDocument( document );
}
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private void initFont()
- {
- bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
-
- TEXT = new Font( bf, 9, Font.NORMAL );
- ITALIC = new Font( bf, 9, Font.ITALIC );
- HEADER3 = new Font( bf, 12, Font.BOLD );
- }
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java 2010-10-15 10:47:44 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java 2010-12-26 21:40:52 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.PDFUtils.getTrueTypeFontByDimension;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
@@ -36,6 +34,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.system.util.PDFUtils;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
@@ -43,7 +42,6 @@
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
-import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
@@ -56,8 +54,8 @@
public class DefaultTallySheetPdfService
implements TallySheetPdfService
{
- private static BaseFont bf;
-
+ //TODO this class must be improved and use PdfUtils
+
private static Font headerFont;
private static Font tableFont;
@@ -229,9 +227,7 @@
private void initFont()
{
- bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
-
- headerFont = new Font( bf, 12, Font.NORMAL );
- tableFont = new Font( bf, 8, Font.NORMAL );
+ headerFont = PDFUtils.getBoldFont( 12 );
+ tableFont = PDFUtils.getFont( 8 );
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2010-12-26 21:40:52 +0000
@@ -28,6 +28,7 @@
*/
import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+import static com.lowagie.text.pdf.PdfPCell.*;
import java.io.OutputStream;
import java.util.Calendar;
@@ -56,44 +57,10 @@
/**
* @author Lars Helge Overland
- * @version $Id$
- * @modifier Dang Duy Hieu
- * @since 2010-05-19
+ * @author Dang Duy Hieu
*/
public class PDFUtils
{
- public static final int ALIGN_CENTER = PdfPCell.ALIGN_CENTER;
-
- public static final int ALIGN_LEFT = PdfPCell.ALIGN_LEFT;
-
- public static final int ALIGN_RIGHT = PdfPCell.ALIGN_RIGHT;
-
- private static final Font TEXT = new Font( Font.HELVETICA, 9, Font.NORMAL );
-
- private static final Font TEXT5 = new Font( Font.HELVETICA, 8, Font.NORMAL );
-
- private static final Font TEXT6 = new Font( Font.HELVETICA, 6, Font.NORMAL );
-
- private static final Font TEXT7 = new Font( Font.HELVETICA, 4, Font.NORMAL );
-
- private static final Font ITALIC = new Font( Font.HELVETICA, 9, Font.ITALIC );
-
- private static final Font HEADER1 = new Font( Font.HELVETICA, 20, Font.BOLD );
-
- private static final Font HEADER2 = new Font( Font.HELVETICA, 16, Font.BOLD );
-
- private static final Font HEADER3 = new Font( Font.HELVETICA, 12, Font.BOLD );
-
- private static final Font HEADER4 = new Font( Font.HELVETICA, 9, Font.BOLD );
-
- private static final Font HEADER5 = new Font( Font.HELVETICA, 8, Font.BOLD );
-
- private static final Font HEADER6 = new Font( Font.HELVETICA, 6, Font.BOLD );
-
- private static final Font HEADER7 = new Font( Font.HELVETICA, 4, Font.BOLD );
-
- public static final String PDF_ARIAL_FONT = "arial.ttf";
-
/**
* Creates a document.
*
@@ -233,6 +200,31 @@
return cell;
}
+
+ public static PdfPCell getTitleCell( String text, int colspan )
+ {
+ return getCell( text, colspan, getBoldFont( 16 ), ALIGN_CENTER );
+ }
+
+ public static PdfPCell getSubtitleCell( String text, int colspan )
+ {
+ return getCell( text, colspan, getItalicFont( 12 ), ALIGN_CENTER );
+ }
+
+ public static PdfPCell getHeaderCell( String text, int colspan )
+ {
+ return getCell( text, colspan, getFont( 12 ), ALIGN_LEFT );
+ }
+
+ public static PdfPCell getTextCell( String text )
+ {
+ return getCell( text, 1, getFont( 9 ), ALIGN_LEFT );
+ }
+
+ public static PdfPCell getItalicCell( String text )
+ {
+ return getCell( text, 1, getItalicFont( 9 ), ALIGN_LEFT );
+ }
/**
* Creates an empty cell.
@@ -241,7 +233,7 @@
* @param height The height of the column.
* @return A PdfCell.
*/
- public static PdfPCell getCell( int colSpan, int height )
+ public static PdfPCell getEmptyCell( int colSpan, int height )
{
PdfPCell cell = new PdfPCell();
@@ -252,340 +244,42 @@
return cell;
}
- /**
- * Creates a cell spanning one column.
- *
- * @param text The text to include in the cell.
- * @param font The font of the cell content.
- * @return A PdfCell.
- */
- public static PdfPCell getCell( String text, Font font )
- {
- return getCell( text, 1, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getTextCell( String text, int colspan )
- {
- return getCell( text, colspan, TEXT, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The font for text in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getTextCell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param horizontalAlign The horizontal align, either ALIGN_LEFT,
- * ALIGN_RIGHT, or ALIGN_CENTER.
- * @return A PdfCell.
- */
- public static PdfPCell getTextCell( String text, int colspan, int horizontalAlign )
- {
- return getCell( text, colspan, TEXT, horizontalAlign );
- }
-
- /**
- * Creates a cell with text font spanning one column.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getTextCell( String text )
- {
- return getCell( text, 1, TEXT, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text font spanning one column.
- *
- * @param text The text to include in the cell.
- * @param font The font for text in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getTextCell( String text, Font font )
- {
- return getCell( text, 1, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 5 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getText5Cell( String text )
- {
- return getCell( text, 1, TEXT5, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 5 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getText5Cell( String text, Font font )
- {
- return getCell( text, 1, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 6 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getText6Cell( String text )
- {
- return getCell( text, 1, TEXT6, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 5 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getText6Cell( String text, Font font )
- {
- return getCell( text, 1, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 7 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getText7Cell( String text )
- {
- return getCell( text, 1, TEXT7, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with text 5 font.
- *
- * @param text The text to include in the cell.
- * @return A PdfCell.
- */
-
- public static PdfPCell getText7Cell( String text, Font font )
- {
- return getCell( text, 1, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with italic text font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getItalicCell( String text, int colspan )
- {
- return getCell( text, colspan, ITALIC, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with italic text font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The font to embed in text of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getItalicCell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 1 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader1Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER1, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 2 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader2Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER2, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 3 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader3Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER3, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 3 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The font of the cell content.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader3Cell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 3 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader4Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER4, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 3 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The font of the cell content.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader4Cell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 5 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader5Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER5, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 5 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The customize font of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader5Cell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 6 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader6Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER6, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 6 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The customize font of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader6Cell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 7 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader7Cell( String text, int colspan )
- {
- return getCell( text, colspan, HEADER7, ALIGN_LEFT );
- }
-
- /**
- * Creates a cell with header 7 font.
- *
- * @param text The text to include in the cell.
- * @param colspan The column span of the cell.
- * @param font The customize font of the cell.
- * @return A PdfCell.
- */
- public static PdfPCell getHeader7Cell( String text, int colspan, Font font )
- {
- return getCell( text, colspan, font, ALIGN_LEFT );
- }
-
- /**
- * Creates a BaseFont with the given dimension
- *
- * @param dimension whether horizontal or vertical
- * @return A BaseFont.
- */
- public static BaseFont getTrueTypeFontByDimension( String dimension )
+ // -------------------------------------------------------------------------
+ // Font methods
+ // -------------------------------------------------------------------------
+
+ public static Font getFont( float size )
+ {
+ return getFont( "ubuntu.ttf", size );
+ }
+
+ public static Font getBoldFont( float size )
+ {
+ return getFont( "ubuntu-bold.ttf", size );
+ }
+
+ public static Font getItalicFont( float size )
+ {
+ return getFont( "ubuntu-italic.ttf", size );
+ }
+
+ private static Font getFont( String fontPath, float size )
{
try
{
- return BaseFont.createFont( PDF_ARIAL_FONT, dimension, BaseFont.EMBEDDED );
+ BaseFont baseFont = BaseFont.createFont( fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED );
+ return new Font( baseFont, size );
}
- catch ( Exception e )
+ catch ( Exception ex )
{
- throw new RuntimeException( "Error occurred in creating a BaseFont instance by the given dimension" );
- }
-
+ throw new RuntimeException( "Error while creating base font", ex );
+ }
}
+ // -------------------------------------------------------------------------
+ // Domain object methods
+ // -------------------------------------------------------------------------
+
/**
* Writes a "Data Elements" title in front of page
*
@@ -621,7 +315,7 @@
}
/**
- * Writes a DHIS2.0 title in front of page
+ * Writes a DHIS 2 title in front of page
*
* @param document The document
* @param exportParams the exporting params
@@ -629,24 +323,19 @@
*/
private static void printFrontPage( Document document, String title, I18n i18n, I18nFormat format )
{
- BaseFont bf = getTrueTypeFontByDimension( BaseFont.IDENTITY_H );
-
- Font TEXT = new Font( bf, 9, Font.NORMAL );
- Font HEADER2 = new Font( bf, 16, Font.BOLD );
-
PdfPTable table = getPdfPTable( true, 1.00f );
- table.addCell( getCell( i18n.getString( "district_health_information_software" ), 1, TEXT, ALIGN_CENTER ) );
-
- table.addCell( getCell( 1, 40 ) );
-
- table.addCell( getCell( title, 1, HEADER2, ALIGN_CENTER ) );
-
- table.addCell( getCell( 1, 40 ) );
+ table.addCell( getTitleCell( i18n.getString( "district_health_information_software" ), 1 ) );
+
+ table.addCell( getEmptyCell( 1, 40 ) );
+
+ table.addCell( getSubtitleCell( title, 1 ) );
+
+ table.addCell( getEmptyCell( 1, 40 ) );
String date = format.formatDate( Calendar.getInstance().getTime() );
- table.addCell( getCell( date, 1, TEXT, ALIGN_CENTER ) );
+ table.addCell( getSubtitleCell( date, 1 ) );
addTableToDocument( document, table );
@@ -665,45 +354,43 @@
* multiple pages or should be kept at one page.
* @param columnWidths The column widths.
*/
- public static PdfPTable printDataElement( DataElement element, I18n i18n, Font HEADER3, Font ITALIC, Font TEXT,
- boolean keepTogether, float... columnWidths )
+ public static PdfPTable printDataElement( DataElement element, I18n i18n, boolean keepTogether, float... columnWidths )
{
PdfPTable table = getPdfPTable( keepTogether, columnWidths );
- table.addCell( getHeader3Cell( element.getName(), 2, HEADER3 ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "short_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getShortName(), TEXT ) );
+ table.addCell( getHeaderCell( element.getName(), 2 ) );
+
+ table.addCell( getEmptyCell( 2, 15 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "short_name" ) ) );
+ table.addCell( getTextCell( element.getShortName() ) );
if ( nullIfEmpty( element.getAlternativeName() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "alternative_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getAlternativeName(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "alternative_name" ) ) );
+ table.addCell( getTextCell( element.getAlternativeName() ) );
}
if ( nullIfEmpty( element.getCode() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "code" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "code" ) ) );
table.addCell( getTextCell( element.getCode() ) );
}
if ( nullIfEmpty( element.getDescription() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "description" ), 1, ITALIC ) );
- table.addCell( getTextCell( element.getDescription(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "description" ) ) );
+ table.addCell( getTextCell( element.getDescription() ) );
}
- table.addCell( getItalicCell( i18n.getString( "active" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getBoolean().get( element.isActive() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "type" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getType().get( element.getType() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "aggregation_operator" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( element.getAggregationOperator() ) ),
- TEXT ) );
-
- table.addCell( getCell( 2, 30 ) );
+ table.addCell( getItalicCell( i18n.getString( "active" ) ) );
+ table.addCell( getTextCell( i18n.getString( getBoolean().get( element.isActive() ) ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "type" ) ) );
+ table.addCell( getTextCell( i18n.getString( getType().get( element.getType() ) ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "aggregation_operator" ) ) );
+ table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( element.getAggregationOperator() ) ) ) );
+
+ table.addCell( getEmptyCell( 2, 30 ) );
return table;
}
@@ -721,61 +408,59 @@
* multiple pages or should be kept at one page.
* @param columnWidths The column widths.
*/
- public static PdfPTable printIndicator( Indicator indicator, I18n i18n, ExpressionService expressionService,
- Font HEADER3, Font ITALIC, Font TEXT, boolean keepTogether, float... columnWidths )
+ public static PdfPTable printIndicator( Indicator indicator, I18n i18n,
+ ExpressionService expressionService, boolean keepTogether, float... columnWidths )
{
PdfPTable table = getPdfPTable( keepTogether, columnWidths );
- table.addCell( getHeader3Cell( indicator.getName(), 2, HEADER3 ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "short_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getShortName(), TEXT ) );
+ table.addCell( getHeaderCell( indicator.getName(), 2 ) );
+
+ table.addCell( getEmptyCell( 2, 15 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "short_name" ) ) );
+ table.addCell( getTextCell( indicator.getShortName() ) );
if ( nullIfEmpty( indicator.getAlternativeName() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "alternative_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getAlternativeName(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "alternative_name" ) ) );
+ table.addCell( getTextCell( indicator.getAlternativeName() ) );
}
if ( nullIfEmpty( indicator.getCode() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "code" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "code" ) ) );
table.addCell( getTextCell( indicator.getCode() ) );
}
if ( nullIfEmpty( indicator.getDescription() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "description" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getDescription(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "description" ) ) );
+ table.addCell( getTextCell( indicator.getDescription() ) );
}
- table.addCell( getItalicCell( i18n.getString( "annualized" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getBoolean().get( indicator.getAnnualized() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "indicator_type" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getIndicatorType().getName(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "numerator_description" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getNumeratorDescription(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "numerator_aggregation_operator" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getAggregationOperator().get(
- indicator.getNumeratorAggregationOperator() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "numerator_formula" ), 1, ITALIC ) );
- table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getNumerator() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "denominator_description" ), 1, ITALIC ) );
- table.addCell( getTextCell( indicator.getDenominatorDescription(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "denominator_aggregation_operator" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getAggregationOperator().get(
- indicator.getDenominatorAggregationOperator() ) ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "denominator_formula" ), 1, ITALIC ) );
- table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getDenominator() ), TEXT ) );
-
- table.addCell( getCell( 2, 30 ) );
+ table.addCell( getItalicCell( i18n.getString( "annualized" ) ) );
+ table.addCell( getTextCell( i18n.getString( getBoolean().get( indicator.getAnnualized() ) ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "indicator_type" ) ) );
+ table.addCell( getTextCell( indicator.getIndicatorType().getName() ) );
+
+ table.addCell( getItalicCell( i18n.getString( "numerator_description" ) ) );
+ table.addCell( getTextCell( indicator.getNumeratorDescription() ) );
+
+ table.addCell( getItalicCell( i18n.getString( "numerator_aggregation_operator" ) ) );
+ table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( indicator.getNumeratorAggregationOperator() ) ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "numerator_formula" ) ) );
+ table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getNumerator() ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "denominator_description" ) ) );
+ table.addCell( getTextCell( indicator.getDenominatorDescription() ) );
+
+ table.addCell( getItalicCell( i18n.getString( "denominator_aggregation_operator" ) ) );
+ table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( indicator.getDenominatorAggregationOperator() ) ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "denominator_formula" ) ) );
+ table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getDenominator() ) ) );
+
+ table.addCell( getEmptyCell( 2, 30 ) );
return table;
}
@@ -793,43 +478,42 @@
* multiple pages or should be kept at one page.
* @param columnWidths The column widths.
*/
- public static PdfPTable printOrganisationUnit( OrganisationUnit unit, I18n i18n, I18nFormat format, Font HEADER3,
- Font ITALIC, Font TEXT, boolean keepTogether, float... columnWidths )
+ public static PdfPTable printOrganisationUnit( OrganisationUnit unit, I18n i18n, I18nFormat format, boolean keepTogether, float... columnWidths )
{
PdfPTable table = getPdfPTable( keepTogether, columnWidths );
- table.addCell( getHeader3Cell( unit.getName(), 2, HEADER3 ) );
-
- table.addCell( getCell( 2, 15 ) );
-
- table.addCell( getItalicCell( i18n.getString( "short_name" ), 1, ITALIC ) );
- table.addCell( getTextCell( unit.getShortName(), TEXT ) );
+ table.addCell( getHeaderCell( unit.getName(), 2 ) );
+
+ table.addCell( getEmptyCell( 2, 15 ) );
+
+ table.addCell( getItalicCell( i18n.getString( "short_name" ) ) );
+ table.addCell( getTextCell( unit.getShortName() ) );
if ( nullIfEmpty( unit.getCode() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "code" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "code" ) ) );
table.addCell( getTextCell( unit.getCode() ) );
}
- table.addCell( getItalicCell( i18n.getString( "opening_date" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "opening_date" ) ) );
table.addCell( getTextCell( unit.getOpeningDate() != null ? format.formatDate( unit.getOpeningDate() ) : "" ) );
- if ( nullIfEmpty( unit.getClosedDate().toString() ) != null )
+ if ( unit.getClosedDate() != null )
{
- table.addCell( getItalicCell( i18n.getString( "closed_date" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "closed_date" ) ) );
table.addCell( getTextCell( unit.getClosedDate() != null ? format.formatDate( unit.getClosedDate() ) : "" ) );
}
- table.addCell( getItalicCell( i18n.getString( "active" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( getBoolean().get( unit.isActive() ) ), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "active" ) ) );
+ table.addCell( getTextCell( i18n.getString( getBoolean().get( unit.isActive() ) ) ) );
if ( nullIfEmpty( unit.getComment() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "comment" ), 1, ITALIC ) );
- table.addCell( getTextCell( unit.getComment(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "comment" ) ) );
+ table.addCell( getTextCell( unit.getComment() ) );
}
- table.addCell( getCell( 2, 30 ) );
+ table.addCell( getEmptyCell( 2, 30 ) );
return table;
}
@@ -847,46 +531,45 @@
* multiple pages or should be kept at one page.
* @param columnWidths The column widths.
*/
- public static PdfPTable printValidationRule( ValidationRule validationRule, I18n i18n,
- ExpressionService expressionService, Font HEADER3, Font ITALIC, Font TEXT, boolean keepTogether,
- float... columnWidths )
+ public static PdfPTable printValidationRule( ValidationRule validationRule, I18n i18n,
+ ExpressionService expressionService, boolean keepTogether, float... columnWidths )
{
PdfPTable table = getPdfPTable( keepTogether, columnWidths );
- table.addCell( getHeader3Cell( validationRule.getName(), 2, HEADER3 ) );
+ table.addCell( getHeaderCell( validationRule.getName(), 2 ) );
- table.addCell( getCell( 2, 15 ) );
+ table.addCell( getEmptyCell( 2, 15 ) );
if ( nullIfEmpty( validationRule.getDescription() ) != null )
{
- table.addCell( getItalicCell( i18n.getString( "description" ), 1, ITALIC ) );
- table.addCell( getTextCell( validationRule.getDescription(), TEXT ) );
+ table.addCell( getItalicCell( i18n.getString( "description" ) ) );
+ table.addCell( getTextCell( validationRule.getDescription() ) );
}
- table.addCell( getItalicCell( i18n.getString( "type" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( validationRule.getType() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "operator" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( validationRule.getOperator() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "left_side_of_expression" ), 1, ITALIC ) );
+ table.addCell( getItalicCell( i18n.getString( "type" ) ) );
+ table.addCell( getTextCell( i18n.getString( validationRule.getType() ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "operator" ) ) );
+ table.addCell( getTextCell( i18n.getString( validationRule.getOperator() ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "left_side_of_expression" ) ) );
table.addCell( getTextCell( expressionService.getExpressionDescription( validationRule.getLeftSide()
- .getExpression() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "left_side_description" ), 1, ITALIC ) );
- table.addCell( getTextCell( validationRule.getLeftSide().getDescription(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "right_side_of_expression" ), 1, ITALIC ) );
+ .getExpression() ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "left_side_description" ) ) );
+ table.addCell( getTextCell( validationRule.getLeftSide().getDescription() ) );
+
+ table.addCell( getItalicCell( i18n.getString( "right_side_of_expression" ) ) );
table.addCell( getTextCell( expressionService.getExpressionDescription( validationRule.getRightSide()
- .getExpression() ), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "right_side_description" ), 1, ITALIC ) );
- table.addCell( getTextCell( validationRule.getRightSide().getDescription(), TEXT ) );
-
- table.addCell( getItalicCell( i18n.getString( "period_type" ), 1, ITALIC ) );
- table.addCell( getTextCell( i18n.getString( validationRule.getPeriodType().getName() ), TEXT ) );
-
- table.addCell( getCell( 2, 30 ) );
+ .getExpression() ) ) );
+
+ table.addCell( getItalicCell( i18n.getString( "right_side_description" ) ) );
+ table.addCell( getTextCell( validationRule.getRightSide().getDescription() ) );
+
+ table.addCell( getItalicCell( i18n.getString( "period_type" ) ) );
+ table.addCell( getTextCell( i18n.getString( validationRule.getPeriodType().getName() ) ) );
+
+ table.addCell( getEmptyCell( 2, 30 ) );
return table;
}
@@ -920,5 +603,4 @@
map.put( DataElement.AGGREGATION_OPERATOR_COUNT, "count" );
return map;
}
-
}
=== removed file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/arial.ttf'
Binary files dhis-2/dhis-support/dhis-support-system/src/main/resources/arial.ttf 2010-06-03 07:44:47 +0000 and dhis-2/dhis-support/dhis-support-system/src/main/resources/arial.ttf 1970-01-01 00:00:00 +0000 differ
=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-bold.ttf'
Binary files dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-bold.ttf 1970-01-01 00:00:00 +0000 and dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-bold.ttf 2010-12-26 21:40:52 +0000 differ
=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-font-licence-1.0.txt'
--- dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-font-licence-1.0.txt 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-font-licence-1.0.txt 2010-12-26 21:40:52 +0000
@@ -0,0 +1,96 @@
+-------------------------------
+UBUNTU FONT LICENCE Version 1.0
+-------------------------------
+
+PREAMBLE
+This licence allows the licensed fonts to be used, studied, modified and
+redistributed freely. The fonts, including any derivative works, can be
+bundled, embedded, and redistributed provided the terms of this licence
+are met. The fonts and derivatives, however, cannot be released under
+any other licence. The requirement for fonts to remain under this
+licence does not require any document created using the fonts or their
+derivatives to be published under this licence, as long as the primary
+purpose of the document is not to be a vehicle for the distribution of
+the fonts.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this licence and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Original Version" refers to the collection of Font Software components
+as received under this licence.
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to
+a new environment.
+
+"Copyright Holder(s)" refers to all individuals and companies who have a
+copyright ownership of the Font Software.
+
+"Substantially Changed" refers to Modified Versions which can be easily
+identified as dissimilar to the Font Software by users of the Font
+Software comparing the Original Version with the Modified Version.
+
+To "Propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification and with or without charging
+a redistribution fee), making available to the public, and in some
+countries other activities as well.
+
+PERMISSION & CONDITIONS
+This licence does not grant any rights under trademark law and all such
+rights are reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of the Font Software, to propagate the Font Software, subject to
+the below conditions:
+
+1) Each copy of the Font Software must contain the above copyright
+notice and this licence. These can be included either as stand-alone
+text files, human-readable headers or in the appropriate machine-
+readable metadata fields within text or binary files as long as those
+fields can be easily viewed by the user.
+
+2) The font name complies with the following:
+(a) The Original Version must retain its name, unmodified.
+(b) Modified Versions which are Substantially Changed must be renamed to
+avoid use of the name of the Original Version or similar names entirely.
+(c) Modified Versions which are not Substantially Changed must be
+renamed to both (i) retain the name of the Original Version and (ii) add
+additional naming elements to distinguish the Modified Version from the
+Original Version. The name of such Modified Versions must be the name of
+the Original Version, with "derivative X" where X represents the name of
+the new work, appended to that name.
+
+3) The name(s) of the Copyright Holder(s) and any contributor to the
+Font Software shall not be used to promote, endorse or advertise any
+Modified Version, except (i) as required by this licence, (ii) to
+acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
+their explicit written permission.
+
+4) The Font Software, modified or unmodified, in part or in whole, must
+be distributed entirely under this licence, and must not be distributed
+under any other licence. The requirement for fonts to remain under this
+licence does not affect any document created using the Font Software,
+except any version of the Font Software extracted from a document
+created using the Font Software may only be distributed under this
+licence.
+
+TERMINATION
+This licence becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
+DEALINGS IN THE FONT SOFTWARE.
=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-italic.ttf'
Binary files dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-italic.ttf 1970-01-01 00:00:00 +0000 and dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu-italic.ttf 2010-12-26 21:40:52 +0000 differ
=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu.ttf'
Binary files dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu.ttf 1970-01-01 00:00:00 +0000 and dhis-2/dhis-support/dhis-support-system/src/main/resources/ubuntu.ttf 2010-12-26 21:40:52 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2010-12-26 18:47:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2010-12-26 21:40:52 +0000
@@ -102,15 +102,15 @@
table.setHeaderRows( 1 );
- table.addCell( getHeader2Cell( grid.getTitle(), grid.getWidth() ) );
- table.addCell( getCell( grid.getWidth(), 8 ) );
+ table.addCell( getTitleCell( grid.getTitle(), grid.getWidth() ) );
+ table.addCell( getEmptyCell( grid.getWidth(), 20 ) );
for ( String header : grid.getHeaders() )
{
- table.addCell( getItalicCell( header, 1 ) );
+ table.addCell( getItalicCell( header ) );
}
- table.addCell( getCell( grid.getWidth(), 8 ) );
+ table.addCell( getEmptyCell( grid.getWidth(), 8 ) );
for ( List<String> row : grid.getRows() )
{
Follow ups