← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22335: Report table, XLS representation, using pretty name as column header, respect display propery for...

 

------------------------------------------------------------
revno: 22335
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 17:42:15 +0100
message:
  Report table, XLS representation, using pretty name as column header, respect display propery for names.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.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-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2016-02-28 12:29:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2016-03-15 16:42:15 +0000
@@ -404,16 +404,16 @@
     }
 
     /**
-     * Generates a pretty column name based on short-names of the argument
-     * objects. Null arguments are ignored in the name.
+     * Generates a pretty column name based on the given display property of the 
+     * argument objects. Null arguments are ignored in the name.
      */
-    public static String getPrettyColumnName( List<DimensionalItemObject> objects )
+    public static String getPrettyColumnName( List<DimensionalItemObject> objects, DisplayProperty displayProperty )
     {
         StringBuilder builder = new StringBuilder();
 
         for ( DimensionalItemObject object : objects )
         {
-            builder.append( object != null ? (object.getDisplayShortName() + SPACE) : EMPTY );
+            builder.append( object != null ? ( object.getDisplayProperty( displayProperty ) + SPACE ) : EMPTY );
         }
 
         return builder.length() > 0 ? builder.substring( 0, builder.lastIndexOf( SPACE ) ) : TOTAL_COLUMN_PRETTY_NAME;
@@ -439,7 +439,7 @@
             }
             else
             {
-                buffer.append( object != null ? (object.getShortName() + SEPARATOR) : EMPTY );
+                buffer.append( object != null ? ( object.getShortName() + SEPARATOR ) : EMPTY );
             }
         }
 
@@ -576,7 +576,7 @@
 
         for ( List<DimensionalItemObject> column : gridColumns )
         {
-            grid.addHeader( new GridHeader( getPrettyColumnName( column ), getColumnName( column ), Double.class
+            grid.addHeader( new GridHeader( getPrettyColumnName( column, displayProperty ), getColumnName( column ), Double.class
                 .getName(), false, false ) );
         }
 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2016-03-15 16:42:15 +0000
@@ -303,7 +303,7 @@
         
         for ( GridHeader header : headers )
         {
-            sheet.addCell( new Label( columnIndex++, rowNumber, header.getColumn(), XLS_FORMAT_LABEL ) );
+            sheet.addCell( new Label( columnIndex++, rowNumber, header.getName(), XLS_FORMAT_LABEL ) );
         }
 
         rowNumber++;