← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7939: Improved title on reporting rate summary

 

------------------------------------------------------------
revno: 7939
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-08-20 13:31:22 +0200
message:
  Improved title on reporting rate summary
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.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-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java	2012-03-15 12:47:27 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessAction.java	2012-08-20 11:31:22 +0000
@@ -39,8 +39,10 @@
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.util.SessionUtils;
@@ -60,8 +62,8 @@
 
     private static final String DEFAULT_TYPE = "html";
 
-    private static final String SPACE = " ";
-
+    private static final String TITLE_SEP = " - ";
+    
     private static final String EMPTY = "";
 
     // -------------------------------------------------------------------------
@@ -102,6 +104,13 @@
     {
         this.i18n = i18n;
     }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
 
     // -------------------------------------------------------------------------
     // Input
@@ -173,7 +182,8 @@
             }
             else
             {
-                Integer _periodId = periodService.getPeriodByExternalId( periodId ).getId();
+                Period period = periodService.getPeriodByExternalId( periodId );
+                Integer _periodId = period.getId();
 
                 DataSet dataSet = null;
                 List<DataSetCompletenessResult> mainResults = new ArrayList<DataSetCompletenessResult>();
@@ -198,7 +208,7 @@
                         _periodId, selectedUnit.getId() ) );
                 }
 
-                grid = getGrid( mainResults, footerResults, selectedUnit, dataSet );
+                grid = getGrid( mainResults, footerResults, selectedUnit, dataSet, period );
 
                 SessionUtils.setSessionVar( KEY_DATA_COMPLETENESS, grid );
             }
@@ -208,13 +218,14 @@
     }
 
     private Grid getGrid( List<DataSetCompletenessResult> mainResults, List<DataSetCompletenessResult> footerResults,
-        OrganisationUnit unit, DataSet dataSet )
+        OrganisationUnit unit, DataSet dataSet, Period period )
     {
-        String title = i18n.getString( "reporting_rate_summary" );
-        String subtitle = ( unit != null ? unit.getName() : EMPTY ) + SPACE
-            + ( dataSet != null ? dataSet.getName() : EMPTY );
+        String title = 
+            ( unit != null ? unit.getName() : EMPTY ) + 
+            ( dataSet != null ? TITLE_SEP + dataSet.getName() : EMPTY ) +
+            ( period != null ? TITLE_SEP + format.formatPeriod( period ) : EMPTY );
 
-        Grid grid = new ListGrid().setTitle( title ).setSubtitle( subtitle );
+        Grid grid = new ListGrid().setTitle( title );
 
         grid.addHeader( new GridHeader( i18n.getString( "name" ), false, true ) );
         grid.addHeader( new GridHeader( i18n.getString( "actual" ), false, false ) );